diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-25 20:40:00 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-11-25 20:40:00 +0100 |
| commit | 13c7b579015d7f112da76aff3fecbe1b8e4ca076 (patch) | |
| tree | d60817a529fd95d171013625ed4a723632c653f0 /src/world.c | |
| parent | f414ecce34a507069b955f974f423eede6b2006a (diff) | |
fix location availability issue
Diffstat (limited to 'src/world.c')
| -rw-r--r-- | src/world.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/world.c b/src/world.c index 88ef7c6..e80f195 100644 --- a/src/world.c +++ b/src/world.c @@ -1320,7 +1320,7 @@ static bool world_check_location_accessibility(world_location* orig, world_locat if (destination == source) continue;
if (destination == orig) continue;
- if (destination->is_owned && world_get_max_depth_for_location(orig) >= depth) {
+ if (destination->is_owned && world_get_max_depth_for_location(destination) >= depth) {
return true;
}
else if (distance_between_location(destination, orig) > dist){
@@ -1357,6 +1357,7 @@ world_update_result world_render(platform_window* window, world* world) 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) {
platform_set_cursor(window, CURSOR_POINTER);
@@ -1403,8 +1404,6 @@ world_update_result world_render(platform_window* window, world* world) for (s32 i = 0; i < world->locations.length; i++)
{
world_location* source = array_at(&world->locations, i);
-
-
for (s32 d = 0; d < source->connections.length; d++)
{
world_location* destination = *(world_location**)array_at(&source->connections, d);
@@ -1412,6 +1411,7 @@ 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;
renderer->render_line(source->map_position_x, source->map_position_y, destination->map_position_x, destination->map_position_y, 2, line_clr);
}
}
|
