From 00f5fdada11870fad11020902b3f380179394be1 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sun, 1 Dec 2024 10:32:38 +0100 Subject: close #31 --- src/world.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index 7da1d2d..963568a 100644 --- a/src/world.c +++ b/src/world.c @@ -1234,12 +1234,20 @@ static void end_contract_with_random_job(world* world) array_remove_by(&location->schedule.jobs, scheduled_job); } +static float get_fine_multiplier(world* world) +{ + // $100 = 1% off of fine. + float multiplier = 1.0f; + multiplier -= (world->investments.legal / 100.0f) * 0.01f; + return multiplier; +} + static void give_random_fine(world* world) { world_location* location = get_random_owned_location(world); employee* emp = *(employee**)array_at(&location->employees, get_random_number(0, location->employees.length)); - s32 fine = get_random_number(world->money / 20, world->money / 10); // fine is between 5% and 10% of current money. minimum 2k. + s32 fine = get_random_number(world->money / 20, world->money / 10) * get_fine_multiplier(world); // fine is between 5% and 10% of current money. minimum 2k. if (fine < 2000) fine = 2000; char error_msg[MAX_EVENT_MESSAGE_LENGTH]; @@ -1290,7 +1298,7 @@ static void do_random_inspection(world* world) world_report_event(world, error_msg, EVENT_TYPE_INFO,location); } else { - s32 fine = total_employees_overworking * 1000; + s32 fine = total_employees_overworking * 1000 * get_fine_multiplier(world); char error_msg[MAX_EVENT_MESSAGE_LENGTH]; snprintf(error_msg, MAX_EVENT_MESSAGE_LENGTH, "A random inspection was performed in %s and %d employees were found to be working more hours than allowed. Fine: $%d.", location->name, total_employees_overworking, fine); -- cgit v1.2.3-70-g09d2