From 5ce3f2b21ae7beab643e6922117eb982b913253a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 10 Feb 2023 23:42:06 +0200 Subject: [PATCH 8/8] Fix "Show Irrigation" toggle Irrigation was being drawn regardless of the setting See osdn #47316 Signed-off-by: Marko Lindqvist --- client/tilespec.c | 60 +++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/client/tilespec.c b/client/tilespec.c index 0b04da9c20..0d57713521 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -5478,13 +5478,15 @@ int fill_sprite_array(struct tileset *t, int didx = t->cardinal_tileset_dirs[dir]; extra_type_list_iterate(t->style_lists[ESTYLE_RIVER], priver) { - int idx = extra_index(priver); + if (is_extra_drawing_enabled(priver)) { + int idx = extra_index(priver); - if (BV_ISSET(textras_near[didx], idx)) { - if (t->sprites.extras[idx].u.road.ru.rivers.outlet[dir] != NULL) { - ADD_SPRITE_SIMPLE(t->sprites.extras[idx].u.road.ru.rivers.outlet[dir]); + if (BV_ISSET(textras_near[didx], idx)) { + if (t->sprites.extras[idx].u.road.ru.rivers.outlet[dir] != NULL) { + ADD_SPRITE_SIMPLE(t->sprites.extras[idx].u.road.ru.rivers.outlet[dir]); + } + break; } - break; } } extra_type_list_iterate_end; } @@ -5495,32 +5497,34 @@ int fill_sprite_array(struct tileset *t, if (gui_options.draw_terrain && !solid_bg) { extra_type_list_iterate(t->style_lists[ESTYLE_RIVER], priver) { - int idx = extra_index(priver); - - if (BV_ISSET(textras, idx)) { - int i; - - /* Draw rivers on top of irrigation. */ - tileno = 0; - for (i = 0; i < t->num_cardinal_tileset_dirs; i++) { - enum direction8 cdir = t->cardinal_tileset_dirs[i]; - - if (terrain_type_terrain_class(tterrain_near[cdir]) == TC_OCEAN) { - tileno |= 1 << i; - } else { - struct road_type *proad = extra_road_get(priver); - - if (proad != NULL) { - extra_type_list_iterate(proad->integrators, iextra) { - if (BV_ISSET(textras_near[cdir], extra_index(iextra))) { - tileno |= 1 << i; - } - } extra_type_list_iterate_end; + if (is_extra_drawing_enabled(priver)) { + int idx = extra_index(priver); + + if (BV_ISSET(textras, idx)) { + int i; + + /* Draw rivers on top of irrigation. */ + tileno = 0; + for (i = 0; i < t->num_cardinal_tileset_dirs; i++) { + enum direction8 cdir = t->cardinal_tileset_dirs[i]; + + if (terrain_type_terrain_class(tterrain_near[cdir]) == TC_OCEAN) { + tileno |= 1 << i; + } else { + struct road_type *proad = extra_road_get(priver); + + if (proad != NULL) { + extra_type_list_iterate(proad->integrators, iextra) { + if (BV_ISSET(textras_near[cdir], extra_index(iextra))) { + tileno |= 1 << i; + } + } extra_type_list_iterate_end; + } } } - } - ADD_SPRITE_SIMPLE(t->sprites.extras[idx].u.road.ru.rivers.spec[tileno]); + ADD_SPRITE_SIMPLE(t->sprites.extras[idx].u.road.ru.rivers.spec[tileno]); + } } } extra_type_list_iterate_end; } -- 2.39.1