diff --git a/game/entity_factory.c b/game/entity_factory.c index 654e020..e471ef5 100644 --- a/game/entity_factory.c +++ b/game/entity_factory.c @@ -65,9 +65,11 @@ ecs_entity_t entityCreateBaseUnit(const Position position, f32 size, Player play .deceleration = 0.1f, .unitType = type }; - if (unit) - unitComp = *unit; - ecs_set_ptr(ECS, e, Unit, &unitComp); + if (unit) { + *unit = unitComp; + } else { + ecs_set_ptr(ECS, e, Unit, &unitComp); + } ecs_set(ECS, e, ConsumePopCapacity, {1}); return e; }