diff --git a/game/buildings.c b/game/buildings.c index a624f0a..3347cdd 100644 --- a/game/buildings.c +++ b/game/buildings.c @@ -65,7 +65,7 @@ ecs_entity_t placeBuilding(Game *game, BuildingType type, ecs_set(ECS, building, Rotation, {0}); SpatialGridID gridID = bzSpatialGridInsert(game->entityGrid, &building, - pos.x, pos.y, + pos.x - size.x * 0.5f, pos.y - size.y * 0.5f, size.x, size.y); ecs_set_ptr(ECS, building, SpatialGridID, &gridID); ecs_set_ptr(ECS, building, Owner, &owner); diff --git a/game/entity_factory.c b/game/entity_factory.c index 5f80666..736583d 100644 --- a/game/entity_factory.c +++ b/game/entity_factory.c @@ -14,7 +14,7 @@ ecs_entity_t entityCreateWorker(const Position position, Game *game) { ecs_set_ptr(ECS, e, Position, &position); ecs_set_ptr(ECS, e, Size, &size); BzSpatialGridID spatialID = bzSpatialGridInsert(game->entityGrid, &e, - position.x, position.y, + position.x - size.x * 0.5f, position.y - size.y * 0.5f, size.x, size.y); ecs_set(ECS, e, SpatialGridID, { spatialID }); ecs_set(ECS, e, Rotation, { 0.0f }); diff --git a/game/systems/s_input.c b/game/systems/s_input.c index aff9a29..8d71a1f 100644 --- a/game/systems/s_input.c +++ b/game/systems/s_input.c @@ -61,7 +61,7 @@ void inputPrimaryAction(Game *game, InputState *input) { type = INPUT_SELECTED_UNITS; else if (selectEntity(game->entityGrid, input->mouseDownWorld, ecs_id(Harvestable))) type = INPUT_SELECTED_OBJECT; - else if (selectEntity(game->entityGrid, input->mouseDownWorld, ecs_id(Buildable))) + else if (selectEntity(game->entityGrid, input->mouseDownWorld, ecs_id(Building))) type = INPUT_SELECTED_BUILDING; selectedCount = ecs_query_entity_count(input->queries.selected); if (selectedCount > 0) {