Add Game as singleton
This commit is contained in:
@@ -70,6 +70,7 @@ bool canPlaceBuilding(BzTileMap *map, BuildingType type, BzTile tileX, BzTile ti
|
||||
}
|
||||
|
||||
ecs_entity_t placeBuilding(BzTileMap *map, BuildingType type, BzTile tileX, BzTile tileY) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
i32 sizeX, sizeY;
|
||||
getBuildingSize(type, &sizeX, &sizeY);
|
||||
ECS_COMPONENT(ECS, TilePosition);
|
||||
@@ -94,7 +95,7 @@ ecs_entity_t placeBuilding(BzTileMap *map, BuildingType type, BzTile tileX, BzTi
|
||||
bzTileLayerSetTile(buildingLayer, layerTile, x, y, 1, 1);
|
||||
buildingTile++;
|
||||
|
||||
GAME->entityMap[y * buildingLayer->width + x] = e;
|
||||
game->entityMap[y * buildingLayer->width + x] = e;
|
||||
|
||||
bzTileMapUpdateCollider(map, x, y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user