Properly set building owner + apply building pop capacity
This commit is contained in:
@@ -57,6 +57,26 @@ void updateTextureOwnerTile(ecs_iter_t *it) {
|
||||
tex[i].rec.y += offset.y;
|
||||
}
|
||||
}
|
||||
void buildingAddPopCapacity(ecs_iter_t *it) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
AddPopCapacity *addPop = ecs_field(it, AddPopCapacity, 1);
|
||||
Owner *owner = ecs_field(it, Owner, 2);
|
||||
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
PlayerResources *res = &game->playerResources[owner[i].player];
|
||||
res->popCapacity += addPop[i].amount;
|
||||
}
|
||||
}
|
||||
void buildingRemovePopCapacity(ecs_iter_t *it) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
AddPopCapacity *addPop = ecs_field(it, AddPopCapacity, 1);
|
||||
Owner *owner = ecs_field(it, Owner, 2);
|
||||
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
PlayerResources *res = &game->playerResources[owner->player];
|
||||
res->popCapacity -= addPop[i].amount;
|
||||
}
|
||||
}
|
||||
|
||||
void entityUpdateSpatialID(ecs_iter_t *it) {
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
|
||||
Reference in New Issue
Block a user