diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-30 17:38:09 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-30 17:38:09 +0100 |
| commit | 3d8003241bfd02caf37b2bac97c3b213b2991c59 (patch) | |
| tree | 3c4bfafa559353be392cc791956f5b9a7609a74e | |
| parent | 5603b2b4d767d03859299a1615819297cea8a900 (diff) | |
close #24
| -rw-r--r-- | src/include/world.h | 2 | ||||
| -rw-r--r-- | src/scenes/world_map.c | 4 | ||||
| -rw-r--r-- | src/world.c | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/include/world.h b/src/include/world.h index 2c32581..efb4059 100644 --- a/src/include/world.h +++ b/src/include/world.h @@ -56,6 +56,8 @@ typedef struct t_employee employee; #define CDAYTORDAY(_day) (_day == 0 ? 7 : _day) // m = 1, s = 7
#define RDAYTOCDAY(_day) (_day == 7 ? 0 : _day) // m = 1, s = 0
+#define INVESTMENT_INCREMENT 100.0f
+
#define BASE_PAY 1800
#define RAISE_PER_YEAR 55
#define MAX_PAY 3250
diff --git a/src/scenes/world_map.c b/src/scenes/world_map.c index ec42a7b..7ceb34b 100644 --- a/src/scenes/world_map.c +++ b/src/scenes/world_map.c @@ -736,11 +736,11 @@ static s32 world_map_push_invest_panel_item(s32 x, s32 y, s32 w, s32 index, char renderer->render_text(fnt, content_x, content_y, text, COLOR_TEXT);
// Button decrease simulation speed
if (push_info_panel_button(scale, img_arrow_left, button_left_x, btn_y, btn_size, *fval > 0, false)) {
- *fval -= 100.0f;
+ *fval -= INVESTMENT_INCREMENT;
}
// Button increase simulation speed
if (push_info_panel_button(scale, img_arrow_right, button_left_x+total_val_editor_w-btn_size, btn_y, btn_size, true, false)) {
- *fval += 100.0f;
+ *fval += INVESTMENT_INCREMENT;
}
s32 item_text_w = renderer->calculate_text_width(fnt, value_str);
s32 item_text_x = button_left_x + (total_val_editor_w/2) - (item_text_w/2);
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);
}
|
