diff options
Diffstat (limited to 'src/world.c')
| -rw-r--r-- | src/world.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/world.c b/src/world.c index e94e7c3..9eede87 100644 --- a/src/world.c +++ b/src/world.c @@ -721,6 +721,16 @@ static s32 world_get_max_depth_for_location(world_location* location) return location_depth;
}
+int compare( const void* a, const void* b)
+{
+ weekday int_a = * ( (int*) a );
+ weekday int_b = * ( (int*) b );
+
+ if ( int_a == int_b ) return 0;
+ else if ( int_a < int_b ) return -1;
+ else return 1;
+}
+
static void world_assign_new_job_offers(world* world, bool force)
{
for (s32 i = 0; i < world->locations.length; i++)
@@ -754,6 +764,8 @@ static void world_assign_new_job_offers(world* world, bool force) s--;
}
}
+ // Sort for rendering order (because durations might overlap. see #11)
+ qsort(&new_offer.shipdays, amount_of_shipdays, sizeof(int), compare );
s32 max_depth = world_get_max_depth_for_location(location);
s32 amount_of_connections = get_random_number(1, max_depth + 1) + 1; // +1 because we add original location to connection list.
|
