Consume pop capacity + evade AI boiler plate

This commit is contained in:
2024-01-23 21:43:58 +01:00
parent 07d1852fb9
commit 0423a962df
14 changed files with 125 additions and 28 deletions

View File

@@ -77,6 +77,26 @@ void buildingRemovePopCapacity(ecs_iter_t *it) {
res->popCapacity -= addPop[i].amount;
}
}
void entityConsumePopCapacity(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
ConsumePopCapacity *pop = ecs_field(it, ConsumePopCapacity, 1);
Owner *owner = ecs_field(it, Owner, 2);
for (i32 i = 0; i < it->count; i++) {
PlayerResources *res = &game->playerResources[owner[i].player];
res->pop += pop[i].amount;
}
}
void entityUnConsumePopCapacity(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);
ConsumePopCapacity *pop = ecs_field(it, ConsumePopCapacity, 1);
Owner *owner = ecs_field(it, Owner, 2);
for (i32 i = 0; i < it->count; i++) {
PlayerResources *res = &game->playerResources[owner[i].player];
res->pop -= pop[i].amount;
}
}
void entityUpdateSpatialID(ecs_iter_t *it) {
Game *game = ecs_singleton_get_mut(ECS, Game);