From 69264dd20ec917c738d56431cd4a85dcacee9a40 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Fri, 29 Nov 2024 20:59:16 +0100 Subject: more locations --- data/world/locations.json | 258 ++++++++++++++++++++++++++++++++++++++++++++++ src/scenery.c | 2 +- src/world.c | 25 +++-- 3 files changed, 276 insertions(+), 9 deletions(-) diff --git a/data/world/locations.json b/data/world/locations.json index fecaf24..a7e1a92 100644 --- a/data/world/locations.json +++ b/data/world/locations.json @@ -172,5 +172,263 @@ "latitude": 33.311295, "name": "Dallas", "size": 1 + }, + { + "latitude": 27.272346, + "longitude": -85.471260, + "name": "Tampa", + "size": 1 + }, + { + "latitude": 27.019321, + "longitude": -83.237450, + "name": "Tampa", + "size": 1 + }, + { + "latitude": 30.218376, + "longitude": -84.436646, + "name": "jacksonville", + "size": 1 + }, + { + "latitude": 30.406326, + "longitude": -93.595970, + "name": "New orleans", + "size": 1 + }, + { + "latitude": 35.084545, + "longitude": -92.343361, + "name": "Memphis", + "size": 1 + }, + { + "latitude": 38.871674, + "longitude": -110.130417, + "name": "Denver", + "size": 1 + }, + { + "latitude": 33.525139, + "longitude": -87.583443, + "name": "Atlanta", + "size": 1 + }, + { + "latitude": 30.850197, + "longitude": -87.527733, + "name": "Tallahassee", + "size": 1 + }, + { + "latitude": 34.229427, + "longitude": -95.634689, + "name": "Little Rock", + "size": 1 + }, + { + "latitude": 33.328300, + "longitude": -83.220901, + "name": "Charleston", + "size": 1 + }, + { + "latitude": 34.679989, + "longitude": -111.341942, + "name": "Albequerque", + "size": 1 + }, + { + "latitude": 32.862217, + "longitude": -91.175179, + "name": "Birmingham", + "size": 1 + }, + { + "latitude": 32.862217, + "longitude": -91.175179, + "name": "Nashville", + "size": 1 + }, + { + "latitude": 36.162640, + "longitude": -79.470184, + "name": "Norfolk", + "size": 1 + }, + { + "latitude": 39.463062, + "longitude": -79.184692, + "name": "Washington DC", + "size": 1 + }, + { + "latitude": 40.732456, + "longitude": -80.897621, + "name": "Pittsburgh", + "size": 1 + }, + { + "latitude": 40.732456, + "longitude": -80.897621, + "name": "Philadelphia", + "size": 1 + }, + { + "latitude": 41.494095, + "longitude": -84.323471, + "name": "Cleveland", + "size": 1 + }, + { + "latitude": 35.515648, + "longitude": -81.766403, + "name": "Durham", + "size": 1 + }, + { + "latitude": 34.213188, + "longitude": -116.331085, + "name": "Phoenix", + "size": 1 + }, + { + "latitude": 32.129250, + "longitude": -104.028412, + "name": "Big Spring", + "size": 1 + }, + { + "latitude": 39.683521, + "longitude": -124.532883, + "name": "Sacramento", + "size": 1 + }, + { + "latitude": 42.548931, + "longitude": -126.876251, + "name": "Portland", + "size": 1 + }, + { + "latitude": 35.575237, + "longitude": -105.367195, + "name": "Lubbock", + "size": 1 + }, + { + "latitude": 38.478462, + "longitude": -99.134712, + "name": "Kansas City", + "size": 1 + }, + { + "latitude": 34.614929, + "longitude": -123.090103, + "name": "Los Angeles", + "size": 1 + }, + { + "latitude": 40.849869, + "longitude": -76.451653, + "name": "New York City", + "size": 1 + }, + { + "latitude": 42.747459, + "longitude": -75.841995, + "name": "Albany", + "size": 1 + }, + { + "latitude": 45.729385, + "longitude": -75.537170, + "name": "Montreal", + "size": 1 + }, + { + "latitude": 47.084808, + "longitude": -74.013039, + "name": "Quebec", + "size": 1 + }, + { + "latitude": 41.663120, + "longitude": -91.083321, + "name": "Chicago", + "size": 1 + }, + { + "latitude": 45.458302, + "longitude": -96.570190, + "name": "Minneapolis", + "size": 1 + }, + { + "latitude": 50.337818, + "longitude": -99.313629, + "name": "Winnepeg", + "size": 1 + }, + { + "latitude": 48.440231, + "longitude": -93.217102, + "name": "Thunder Bay", + "size": 1 + }, + { + "latitude": 45.729385, + "longitude": -123.090103, + "name": "Spokane", + "size": 1 + }, + { + "latitude": 44.557728, + "longitude": -91.990479, + "name": "Appleton", + "size": 1 + }, + { + "latitude": 44.832539, + "longitude": -95.389618, + "name": "Rochester", + "size": 1 + }, + { + "latitude": 40.160782, + "longitude": -94.771591, + "name": "Springfield", + "size": 1 + }, + { + "latitude": 38.834896, + "longitude": -90.033485, + "name": "Indianapolis", + "size": 1 + }, + { + "latitude": 39.694767, + "longitude": -88.099739, + "name": "Columbus", + "size": 1 + }, + { + "latitude": 36.746174, + "longitude": -101.507416, + "name": "Oklahoma City", + "size": 1 + }, + { + "latitude": 32.529160, + "longitude": -109.371002, + "name": "Roswell", + "size": 1 + }, + { + "latitude": 48.666050, + "longitude": -127.173752, + "name": "Vancouver", + "size": 1 } ] \ No newline at end of file diff --git a/src/scenery.c b/src/scenery.c index 39c91e6..cb8f9c6 100644 --- a/src/scenery.c +++ b/src/scenery.c @@ -54,7 +54,7 @@ void update_render_scenery(world* world) { #if 0 if (is_left_clicked()) { vec2f coords = px_to_coords(main_window, _global_mouse.x, _global_mouse.y); - printf("Location: %f %f\n", coords.y, coords.x); + printf("Location: \"latitude\": %f, \"longitude\":%f\n", coords.y, coords.x); } #endif diff --git a/src/world.c b/src/world.c index 13dc644..e8024a7 100644 --- a/src/world.c +++ b/src/world.c @@ -104,10 +104,12 @@ static world_location world_create_location(u8 size, double latitude, double lon static void world_create_connections(world* world) { - const double max_distance = 410; + double max_distance = 410; for (s32 i = 0; i < world->locations.length; i++) { world_location* source = array_at(&world->locations, i); + if (source->longitude < -90) max_distance = 600; + else max_distance = 410; double closest = FLT_MAX; world_location* closest_loc = 0; @@ -121,19 +123,22 @@ static void world_create_connections(world* world) printf("%s %s -> %f\n", source->name, destination->name, distance_between_location(source, destination)); #endif - if (total_dist < closest) { - closest = total_dist; - closest_loc = destination; - } + if (total_dist < max_distance) { array_push(&source->connections, &destination); } + else { + if (total_dist < closest) { + closest = total_dist; + closest_loc = destination; + } + } } - //if (source->connections.length == 0 && closest_loc != 0) { - // array_push(&source->connections, &closest_loc); - //} + if (source->connections.length <= ((source->longitude < -90) ? 1 : 0) && closest_loc != 0) { + array_push(&source->connections, &closest_loc); + } } } @@ -1434,6 +1439,10 @@ world_update_result world_render(platform_window* window, world* world) color line_clr = COLOR_CONNECTION_BETWEEN_LOCATION_ACCESSIBLE; if (!source->is_accessible) line_clr = COLOR_CONNECTION_BETWEEN_LOCATION_INACCESSIBLE; if (!destination->is_accessible) line_clr = COLOR_CONNECTION_BETWEEN_LOCATION_INACCESSIBLE; + line_clr.a = 100; + if (!world_map_location_is_in_sun((vec2f){source->map_position_x, source->map_position_y})) { + line_clr = rgba(255,255,0, 50); + } renderer->render_line(source->map_position_x, source->map_position_y, destination->map_position_x, destination->map_position_y, 2, line_clr); } } -- cgit v1.2.3-70-g09d2