diff options
Diffstat (limited to 'src/world.c')
| -rw-r--r-- | src/world.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/world.c b/src/world.c index 7f7252c..1969193 100644 --- a/src/world.c +++ b/src/world.c @@ -1438,6 +1438,22 @@ static void world_update_location_scores(world* world) }
}
+static void world_age_employee(world* world)
+{
+ for (s32 i = 0; i < world->locations.length; i++)
+ {
+ world_location* location = array_at(&world->locations, i);
+ if (!location->is_owned) continue;
+
+ for (s32 x = 0; x < location->employees.length; x++)
+ {
+ employee* em = *(employee**)array_at(&location->employees, x);
+ em->age += 1;
+ em->experience += 1;
+ }
+ }
+}
+
static void world_run_simulation_tick(world* world)
{
s32 elapsed_sec = MINUTES(world->simulation_speed);
@@ -1453,6 +1469,10 @@ static void world_run_simulation_tick(world* world) struct tm* curr_time = &curr_time_buf;
world->current_time = curr_time_buf;
+ if (prev_time->tm_year != curr_time->tm_year) { // Run once per year
+ world_age_employee(world);
+ }
+
if (prev_time->tm_wday != curr_time->tm_wday) { // Run once per day
world_remove_expired_job_offers(world);
world_assign_resumes_to_locations(world);
|
