@@ -25,21 +25,23 @@ void building_festival_square::static_params::planer_setup_preview_graphics(buil
25
25
}
26
26
27
27
void building_festival_square::static_params::planer_ghost_preview (build_planner &planer, painter &ctx, tile2i start, tile2i end, vec2i pixel) const {
28
- int can_build = 0 ;
29
-
30
- int size = building_impl::params (type).building_size ;
31
28
int orientation = 0 ;
32
29
33
- can_build = map_orientation_for_venue_with_map_orientation (end, e_venue_mode_festival_square, &orientation);
30
+ bool can_build = map_orientation_for_venue_with_map_orientation (end, e_venue_mode_festival_square, &orientation);
34
31
// TODO: proper correct for map orientation (for now, just use a different orientation)
35
32
orientation = abs (orientation + (8 - city_view_orientation ())) % 8 ;
36
33
37
34
if (can_build != 1 ) { // no can place
38
- for (int i = 0 ; i < size * size ; i++) {
35
+ for (int i = 0 ; i < building_size * building_size ; i++) {
39
36
planer.draw_flat_tile (ctx, pixel + VIEW_OFFSETS[i], COLOR_MASK_RED);
40
37
}
41
38
} else { // can place (theoretically)
42
- building_festival_square::ghost_preview (ctx, end, pixel, orientation);
39
+ int square_id = current_params ().anim [animkeys ().square ].first_img ();
40
+ bool is_exist = building_count_total (BUILDING_FESTIVAL_SQUARE);
41
+ int color_mask = is_exist ? COLOR_MASK_RED : COLOR_MASK_GREEN;
42
+ for (int i = 0 ; i < building_size * building_size; i++) {
43
+ ImageDraw::isometric (ctx, square_id + i, pixel + vec2i{ ((i % building_size) - (i / building_size)) * 30 , ((i % building_size) + (i / building_size)) * 15 }, color_mask);
44
+ }
43
45
}
44
46
}
45
47
@@ -90,13 +92,3 @@ void building_festival_square::on_undo() {
90
92
void building_festival_square::on_post_load () {
91
93
g_city.buildings .festival_square = this ->tile ();
92
94
}
93
-
94
- void building_festival_square::ghost_preview (painter &ctx, tile2i tile, vec2i pixel, int orientation) {
95
- int square_id = current_params ().anim [animkeys ().square ].first_img ();
96
- int size = festival_square_m.building_size ;
97
- bool is_exist = building_count_total (BUILDING_FESTIVAL_SQUARE);
98
- int color_mask = is_exist ? COLOR_MASK_RED : COLOR_MASK_GREEN;
99
- for (int i = 0 ; i < size * size; i++) {
100
- ImageDraw::isometric (ctx, square_id + i, pixel + vec2i{((i % size) - (i / size)) * 30 , ((i % size) + (i / size)) * 15 }, color_mask);
101
- }
102
- }
0 commit comments