Rename BUILDINGS to BuildingType, add owner component to entities
This commit is contained in:
@@ -49,6 +49,7 @@ ecs_entity_t *entityMap = NULL;
|
||||
bool prepareBuildings(BzTileLayer *layer, BzTile *data, i32 dataCount) {
|
||||
ECS_COMPONENT(ECS, TilePosition);
|
||||
ECS_COMPONENT(ECS, TileSize);
|
||||
ECS_COMPONENT(ECS, Owner);
|
||||
|
||||
entityMap = bzCalloc(sizeof(*entityMap), layer->width * layer->height);
|
||||
|
||||
@@ -74,6 +75,9 @@ bool prepareBuildings(BzTileLayer *layer, BzTile *data, i32 dataCount) {
|
||||
ecs_entity_t e = ecs_new_id(ECS);
|
||||
ecs_set(ECS, e, TilePosition, {.x=x, .y=y});
|
||||
ecs_set(ECS, e, TileSize, {.w=size.w, .h=size.h});
|
||||
ownerTile = bzTilesetGetTile(buildingTileset, ownerTile);
|
||||
ownerTile = getTileBuilding(ownerTile);
|
||||
ecs_set(ECS, e, Owner, {.playerID=ownerTile});
|
||||
|
||||
for (i32 yIdx = y; yIdx < y + size.h; yIdx++) {
|
||||
for (i32 xIdx = x; xIdx < x + size.w; xIdx++) {
|
||||
|
||||
Reference in New Issue
Block a user