diff options
| -rw-r--r-- | src/include/world.h | 1 | ||||
| -rw-r--r-- | src/scenes/world_map.c | 2 | ||||
| -rw-r--r-- | src/world.c | 37 |
3 files changed, 17 insertions, 23 deletions
diff --git a/src/include/world.h b/src/include/world.h index efb4059..bb45a4e 100644 --- a/src/include/world.h +++ b/src/include/world.h @@ -244,7 +244,6 @@ typedef struct t_world_location array job_offers;
array resumes;
array trucks;
- float reliability;
schedule schedule;
u16 purchase_year;
array insights;
diff --git a/src/scenes/world_map.c b/src/scenes/world_map.c index 7ceb34b..af50eed 100644 --- a/src/scenes/world_map.c +++ b/src/scenes/world_map.c @@ -167,7 +167,7 @@ static void world_map_draw_info_panel(platform_window* window, bool enabled) push_info_panel_button(scale, img_bank, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*2, btn_y, btn_size, enabled, false);
// Event log button
- if (push_info_panel_button(scale, img_invest, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*3, btn_y, btn_size, enabled, _active_world->log.has_unread_messages)) {
+ if (push_info_panel_button(scale, img_invest, screen_center_x - (total_btn_w/2) + (btn_size+btn_spacing)*3, btn_y, btn_size, enabled, false)) {
scene_state = (scene_state == WORLD_SCENE_STATE_INVEST) ? WORLD_SCENE_STATE_IDLE : WORLD_SCENE_STATE_INVEST;
}
}
diff --git a/src/world.c b/src/world.c index 5da8ba8..c23205b 100644 --- a/src/world.c +++ b/src/world.c @@ -1,6 +1,6 @@ #include <float.h>
-static void world_assign_new_job_offers(world* world);
+static void world_assign_new_job_offers(world* world, bool force);
static double distance_between_location(world_location* location1, world_location* location2);
static void world_payout_salaries(world* world);
static void enable_insights_for_current_month(world* world);
@@ -96,7 +96,6 @@ static world_location world_create_location(u8 size, double latitude, double lon location.resumes = array_create(sizeof(resume));
location.id = assets_hash_path(location.name);
- location.reliability = 1.0f;
location.score = 0.0f;
return location;
@@ -617,7 +616,7 @@ world* world_create_new() return 0;
}
- world_assign_new_job_offers(new_world);
+ world_assign_new_job_offers(new_world, true);
enable_insights_for_current_month(new_world);
return new_world;
@@ -719,7 +718,7 @@ static s32 world_get_max_depth_for_location(world_location* location) return location_depth;
}
-static void world_assign_new_job_offers(world* world)
+static void world_assign_new_job_offers(world* world, bool force)
{
for (s32 i = 0; i < world->locations.length; i++)
{
@@ -728,10 +727,10 @@ static void world_assign_new_job_offers(world* world) 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.
+ rand_offer_chance += ((world->investments.marketing / 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;
+ if (!force && 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);
@@ -815,14 +814,12 @@ static void world_assign_resumes_to_locations(world* world) world_location* location = array_at(&world->locations, i);
if (!location->is_owned) continue;
- // 0.5 reliability = 0%
- // 1.0 reliability = 10%
- // 1.5 reliability = 20%
- // etc.
- // % = change of a new resume being submitted per day.
- #if 1
- if (get_random_number(0, 10) >= ceil(location->reliability)) continue;
- #endif
+ float rand_offer_chance = (1/20.0f); // 1 in 20 change of getting a new resume submission.
+ rand_offer_chance += ((world->investments.human_resources / INVESTMENT_INCREMENT)*0.005f); // 100 eur = 0.5% increase in submissions.
+ 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;
+
resume new_resume;
new_resume.animation = animation_create(RESUME_FADEOUT_MS);
new_resume.expire_date = world->simulation_time+DAYS(10);
@@ -1300,16 +1297,13 @@ static void world_run_simulation_tick(world* world) world_remove_expired_job_offers(world);
world_assign_resumes_to_locations(world);
world_start_random_events(world);
+ world_assign_new_job_offers(world, false);
if (curr_time->tm_mday <= 28) {
world_payout_salaries(world); // Pay salary first 28 days of month.
world_pay_investments(world);
}
}
-
- if (prev_time->tm_wday != curr_time->tm_wday) { // Run once per day
- world_assign_new_job_offers(world);
- }
if (curr_time->tm_hour >= WORK_HOUR_START && curr_time->tm_hour < WORK_HOUR_END) { // Run every 15min
s32 hour_part = 60 / TIME_SLOTS_PER_HOUR;
@@ -1416,7 +1410,7 @@ world_update_result world_render(platform_window* window, world* world) s32 circle_x = location->map_position_x - dotsize/2;
s32 circle_y = location->map_position_y - dotsize/2;
bool hovered = mouse_interacts(circle_x, circle_y, dotsize, dotsize);
- location->is_accessible = true;//world_check_location_accessibility(location, location, 1, 0);
+ location->is_accessible = world_check_location_accessibility(location, location, 1, 0);
location->is_hovered = hovered;
if (hovered && location->is_accessible) {
@@ -1436,10 +1430,11 @@ world_update_result world_render(platform_window* window, world* world) tint = COLOR_LOCATION_DOT_UNACCESSIBLE;
}
+ renderer->render_image_tint(img_locationdot, circle_x, circle_y, dotsize, dotsize, tint);
+
if (!world_map_location_is_in_sun(map_pos)) {
- tint = rgb(255, 255, 0);
+ renderer->render_image_tint(img_locationdot, circle_x, circle_y, dotsize, dotsize, rgba(255, 255, 0, 110));
}
- renderer->render_image_tint(img_locationdot, circle_x, circle_y, dotsize, dotsize, tint);
}
renderer->set_render_depth(2);
|
