summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/scenes/world_map.c1
-rw-r--r--src/world.c11
2 files changed, 8 insertions, 4 deletions
diff --git a/src/scenes/world_map.c b/src/scenes/world_map.c
index 2d9c32b..f96ba0e 100644
--- a/src/scenes/world_map.c
+++ b/src/scenes/world_map.c
@@ -868,6 +868,7 @@ static void world_map_draw_purchase_location_panel(platform_window* window)
_active_world->money -= world_location_get_price(scene_data.location_to_purchase);
+ world_update_location_scores(_active_world);
scene_state = WORLD_SCENE_STATE_IDLE;
}
diff --git a/src/world.c b/src/world.c
index 7ff0e19..e9401b4 100644
--- a/src/world.c
+++ b/src/world.c
@@ -119,6 +119,7 @@ static void connect_locations(world* world, char* str1, char* str2)
world_location* loc2 = world_get_location_by_name(world, str2);
array_push(&loc1->connections, &loc2);
+ array_push(&loc2->connections, &loc1);
}
static void world_create_manual_connections(world* world)
@@ -559,7 +560,7 @@ world* world_create_new()
world* new_world = mem_alloc(sizeof(world));
new_world->simulation_time = time(NULL);
new_world->start_year = gmtime(&new_world->simulation_time)->tm_year;
- new_world->money = 10000000.0f;
+ new_world->money = 100000.0f;
new_world->next_id = 1;
new_world->active_jobs = array_create(sizeof(active_job));
new_world->investments = (company_investments){0};
@@ -1225,9 +1226,9 @@ static world_location* get_random_owned_location(world* world)
{
world_location* location = array_at(&world->locations, i);
if (!location->is_owned) continue;
- count++;
if (count == rand_nr) return location;
+ count++;
}
return 0;
}
@@ -1268,6 +1269,7 @@ static float get_fine_multiplier(world* world)
static void give_random_fine(world* world)
{
world_location* location = get_random_owned_location(world);
+ if (location->employees.length == 0) return;
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) * get_fine_multiplier(world); // fine is between 5% and 10% of current money. minimum 2k.
@@ -1289,6 +1291,7 @@ static void brake_down_random_truck(world* world)
{
retry:;
world_location* location = get_random_owned_location(world);
+ if (location->employees.length == 0) return;
employee* emp = *(employee**)array_at(&location->employees, get_random_number(0, location->employees.length));
if (emp->assigned_truck == 0) goto retry;
@@ -1542,10 +1545,10 @@ void world_update(platform_window* window, world* world)
{
static float delta = 0;
delta += frame_delta;
- //if (delta >= (1/60.0f)) { // tick runs at 60 ticks per second regardless of fps.
+ if (delta >= (1/60.0f)) { // tick runs at 60 ticks per second regardless of fps.
world_run_simulation_tick(world);
delta = 0;
- //}
+ }
}
static vec2f get_world_location_for_job(platform_window* window, world* world, active_job* job)