diff options
| -rw-r--r-- | src/world.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/world.c b/src/world.c index 1750608..bae50d9 100644 --- a/src/world.c +++ b/src/world.c @@ -1231,13 +1231,18 @@ static void end_contract_with_employee(world* world, employee* emp) if (curr_loc) array_remove_by(&curr_loc->employees, &emp);
}
+static bool world_check_location_accessibility(world_location* orig, world_location* source, int depth, double dist);
+
static void world_update_location_scores(world* world)
{
for (s32 i = 0; i < world->locations.length; i++)
{
world_location* location = array_at(&world->locations, i);
+ location->is_accessible = world_check_location_accessibility(location, location, 1, 0);
+
if (!location->is_owned) continue;
+
s32 total_scheduled_slots = 0;
for (int x = 0; x < location->schedule.jobs.length; x++)
{
@@ -1298,8 +1303,9 @@ 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);
-
+ world_assign_new_job_offers(world, false);
+ world_update_location_scores(world);
+
if (curr_time->tm_mday <= 28) {
world_payout_salaries(world); // Pay salary first 28 days of month.
world_pay_investments(world);
@@ -1320,7 +1326,6 @@ static void world_run_simulation_tick(world* world) }
world_update_active_jobs(world);
- world_update_location_scores(world);
}
void world_update(platform_window* window, world* world)
@@ -1411,7 +1416,6 @@ 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 = world_check_location_accessibility(location, location, 1, 0);
location->is_hovered = hovered;
if (hovered && location->is_accessible) {
@@ -1458,6 +1462,7 @@ world_update_result world_render(platform_window* window, world* world) renderer->render_image_tint(img_locationdot, job->px_pos.x-(dotsize/2),job->px_pos.y-(dotsize/2), dotsize,dotsize, job->is_hovered ? COLOR_DOT_HOVERED : rgb(255,0,0));
}
+
renderer->set_render_depth(1);
dotsize = 5 * scale * zoom;
// Draw connections
|
