summaryrefslogtreecommitdiff
path: root/src/world.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-11-30 17:38:09 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-11-30 17:38:09 +0100
commit3d8003241bfd02caf37b2bac97c3b213b2991c59 (patch)
tree3c4bfafa559353be392cc791956f5b9a7609a74e /src/world.c
parent5603b2b4d767d03859299a1615819297cea8a900 (diff)
close #24
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c
index 2892246..5da8ba8 100644
--- a/src/world.c
+++ b/src/world.c
@@ -727,6 +727,12 @@ static void world_assign_new_job_offers(world* world)
if (!location->is_owned) continue;
if (location->job_offers.length >= MAX_JOBOFFER_COUNT) continue;
+ float rand_offer_chance = (1/10.0f); // 1 in 10 change of getting a job offer by default
+ rand_offer_chance += ((world->investments.human_resources / INVESTMENT_INCREMENT)*0.005f); // 100 eur = 0.5% increase in job offers.
+ if (rand_offer_chance > 0.4f) rand_offer_chance = 0.4f; // Cap investment influence at 40%.
+ rand_offer_chance += (location->score / 4.0f);
+ if (get_random_number(0, 100) > rand_offer_chance*100.0f) continue;
+
s32 company_id = get_random_number(0, world->companies.length);
company* company = array_at(&world->companies, company_id);
s32 product_id = get_random_number(0, company->products.length);
@@ -1301,7 +1307,7 @@ static void world_run_simulation_tick(world* world)
}
}
- if (prev_time->tm_wday == SUNDAY && curr_time->tm_wday == MONDAY) { // Run once per week
+ if (prev_time->tm_wday != curr_time->tm_wday) { // Run once per day
world_assign_new_job_offers(world);
}