diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-12-01 10:58:23 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-12-01 10:58:23 +0100 |
| commit | 315fae0968c0a786a23a1dc6f94bab7056ac6668 (patch) | |
| tree | b5c0498c39165b446b2c84533f0cfe27602c3b8d /src/world.c | |
| parent | 80e16c93ffd5ac868aae42e32b5af29fdf956595 (diff) | |
close #35
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);
|
