Consume pop capacity + evade AI boiler plate
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user