From 3d8003241bfd02caf37b2bac97c3b213b2991c59 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 30 Nov 2024 17:38:09 +0100 Subject: close #24 --- src/world.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/world.c') 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); } -- cgit v1.2.3-70-g09d2