dalerank/Akhenaten

Well water overlay not working correctly

Closed this issue · 4 comments

Encountered this on the first mission. Building a well doesn't update water overlay with its range.
The problem comes from map_update_wells_range() referencing building_list_small_items() and its size building_list_small_size() which is always 0 so the loop does not run.
The only reference to building_list_small_add() is in determine_meeting_center() so it seems wells are never added to the list.

image

Also, when I changed the code to show the well range correctly, housing tooltip always displays text "No access to drinking water" even though it is in range of a well and the housing upgrade mechanic works. See screenshot

image

Changed code to test the well range drawing

void map_update_wells_range(void) {
    OZZY_PROFILER_SECTION("Game/Run/Tick/Wells Range Update");
    map_terrain_remove_all(TERRAIN_FOUNTAIN_RANGE);
     for (int i = 0; i < MAX_BUILDINGS; i++) {
         building* b = building_get(i);
        if (b->state == BUILDING_STATE_VALID && b->type == BUILDING_WELL)
            map_terrain_add_with_radius(b->tile.x(), b->tile.y(), 1, 3, TERRAIN_FOUNTAIN_RANGE);
    }
}

Thanks, look for it

@Asdow You can create a PR if you want for this, or I can fix it

I can do it. Do you want me to keep using the small building list for it?

better use

    buildings_valid_do([&] (building &b) {
       ....
    }, BUILDING_WELL);