@@ -55,18 +55,16 @@ void config_load_city_overlays() {
55
55
}
56
56
57
57
const char *caption = arch.r_string (" caption" );
58
- auto walkers = arch.r_array_num <e_figure_type>(" walkers" );
59
- auto buildings = arch.r_array_num <e_building_type>(" buildings" );
60
58
int tooltip_base = arch.r_int (" tooltip_base" );
61
- e_column_type column_type = arch.r_type <e_column_type>(" column_type" );
62
- auto tooltips = arch.r_array_num (" tooltips" );
63
59
64
60
if (tooltip_base) { overlay->tooltip_base = tooltip_base; }
65
- if (buildings.size ()) { overlay->buildings = buildings; }
66
61
if (*caption) { overlay->caption = caption; }
67
- if (tooltips.size ()) { overlay->tooltips = tooltips; }
68
- if (walkers.size ()) { overlay->walkers = walkers; }
69
- if (column_type) { overlay->column_type = column_type; }
62
+
63
+ overlay->buildings = arch.r_array_num <e_building_type>(" buildings" );
64
+ overlay->walkers = arch.r_array_num <e_figure_type>(" walkers" );
65
+ overlay->column_type = arch.r_type <e_column_type>(" column_type" );
66
+ overlay->tooltips = arch.r_array_num (" tooltips" );
67
+ arch.r_anim (" column_anim" , overlay->anim );
70
68
});
71
69
}
72
70
@@ -226,33 +224,29 @@ bool city_overlay::is_drawable_building_corner(tile2i tile, tile2i main, int siz
226
224
return (offset_main == main);
227
225
}
228
226
229
- void city_overlay::draw_overlay_column (vec2i pixel, int height, int column_style, painter &ctx) const {
230
- int image_id = image_id_from_group (GROUP_OVERLAY_COLUMN);
231
- switch (column_style) {
232
- case COLUMN_TYPE_RISK:
233
- if (height <= 5 )
234
- image_id += COLUMN_COLOR_PLAIN;
235
- else if (height < 7 )
236
- image_id += COLUMN_COLOR_YELLOW;
237
- else if (height < 9 )
238
- image_id += COLUMN_COLOR_ORANGE;
239
- else
240
- image_id += COLUMN_COLOR_RED;
241
- break ;
242
-
243
- case COLUMN_TYPE_POSITIVE:
244
- image_id += COLUMN_COLOR_BLUE;
245
- break ;
246
-
247
- case COLUMN_TYPE_WATER_ACCESS:
248
- image_id += COLUMN_COLOR_BLUE;
249
- break ;
227
+ void city_overlay::draw_overlay_column (e_column_color color, vec2i pixel, int height, int column_style, painter &ctx) const {
228
+ if (color == COLUMN_COLOR_NONE) {
229
+ switch (column_style) {
230
+ case COLUMN_TYPE_RISK:
231
+ if (height <= 5 ) { color = COLUMN_COLOR_PLAIN; }
232
+ else if (height < 7 ) { color = COLUMN_COLOR_YELLOW; }
233
+ else if (height < 9 ) { color = COLUMN_COLOR_ORANGE; }
234
+ else { color = COLUMN_COLOR_RED; }
235
+ break ;
236
+
237
+ case COLUMN_TYPE_POSITIVE:
238
+ color = COLUMN_COLOR_BLUE;
239
+ break ;
240
+
241
+ case COLUMN_TYPE_WATER_ACCESS:
242
+ color = COLUMN_COLOR_BLUE;
243
+ break ;
244
+ }
250
245
}
251
246
252
- if (height > 10 ) {
253
- height = 10 ;
254
- }
247
+ int image_id = anim.first_img () + color;
255
248
249
+ height = std::min (height, 10 );
256
250
int capital_height = image_get (image_id)->height ;
257
251
// base
258
252
ImageDraw::img_generic (ctx, image_id + 2 , pixel.x + 9 , pixel.y - 8 );
@@ -381,7 +375,8 @@ void city_overlay::draw_building_top(vec2i pixel, tile2i tile, painter &ctx) con
381
375
}
382
376
383
377
int column_height = get_city_overlay ()->get_column_height (b);
384
- if (column_height == NO_COLUMN) {
378
+ e_column_color column_color = get_city_overlay ()->get_column_color (b);
379
+ if (column_height == COLUMN_TYPE_NONE) {
385
380
return ;
386
381
}
387
382
@@ -391,6 +386,6 @@ void city_overlay::draw_building_top(vec2i pixel, tile2i tile, painter &ctx) con
391
386
}
392
387
393
388
if (draw) {
394
- draw_overlay_column (pixel, column_height, get_city_overlay ()->column_type , ctx);
389
+ draw_overlay_column (column_color, pixel, column_height, get_city_overlay ()->column_type , ctx);
395
390
}
396
391
}
0 commit comments