@@ -69,21 +69,17 @@ struct pavilion_model : public buildings::model_t<building_pavilion> {
69
69
for (auto &pdir : place_dir) {
70
70
pdir.load (arch, bstring32 ().printf (" place_dir_%d" , std::distance (place_dir, &pdir)).c_str ());
71
71
}
72
+
73
+ dancer_tile = anim[animkeys ().base ].first_img ();
74
+ booth_tile = anim[animkeys ().booth ].first_img ();
75
+ musician_tile_s = anim[animkeys ().stand_sn_s ].first_img ();
76
+ musician_tile_e = anim[animkeys ().stand_sn_e ].first_img ();
72
77
}
73
78
74
79
preview_offset preview_dir[8 ];
75
80
place_offset place_dir[8 ];
76
81
} pavilion_m;
77
82
78
- ANK_REGISTER_CONFIG_ITERATOR (config_load_building_pavilion);
79
- void config_load_building_pavilion () {
80
- pavilion_m.load ();
81
- pavilion_m.dancer_tile = pavilion_m.anim [" base" ].first_img ();
82
- pavilion_m.booth_tile = pavilion_m.anim [" booth" ].first_img ();
83
- pavilion_m.musician_tile_s = pavilion_m.anim [" stand_sn_s" ].first_img ();
84
- pavilion_m.musician_tile_e = pavilion_m.anim [" stand_sn_e" ].first_img ();
85
- }
86
-
87
83
void building_pavilion::on_create (int orientation) {
88
84
89
85
}
@@ -109,7 +105,7 @@ void building_pavilion::on_place_update_tiles(int orientation, int variant) {
109
105
data.entertainment .orientation = orientation;
110
106
111
107
int size = pavilion_m.building_size ;
112
- int image_id = pavilion_m. anim [ " square" ] .first_img ();
108
+ int image_id = anim ( animkeys (). square ) .first_img ();
113
109
114
110
int basic_orientation;
115
111
map_orientation_for_venue_with_map_orientation (tile (), e_venue_mode_pavilion, &basic_orientation);
@@ -130,23 +126,23 @@ void building_pavilion::on_place_checks() {
130
126
131
127
bool building_pavilion::draw_ornaments_and_animations_height (painter &ctx, vec2i point, tile2i tile, color color_mask) {
132
128
if (data.entertainment .dancer_visited && map_image_at (tile) == pavilion_m.dancer_tile ) {
133
- const animation_t &anim = pavilion_m. anim [ " dancer" ] ;
134
- building_draw_normal_anim (ctx, point, &base, tile, anim , color_mask);
129
+ const animation_t &ranim = anim ( animkeys (). dancer ) ;
130
+ building_draw_normal_anim (ctx, point, &base, tile, ranim , color_mask);
135
131
}
136
132
137
133
if (data.entertainment .musician_visited ) {
138
134
if (map_image_at (tile) == pavilion_m.musician_tile_s ) {
139
- const animation_t &anim = pavilion_m. anim [ " musician_sn" ] ;
140
- building_draw_normal_anim (ctx, point, &base, tile, anim , color_mask);
135
+ const animation_t &ranim = anim ( animkeys (). musician_sn ) ;
136
+ building_draw_normal_anim (ctx, point, &base, tile, ranim , color_mask);
141
137
} else if (map_image_at (tile) == pavilion_m.musician_tile_e ) {
142
- const animation_t &anim = pavilion_m. anim [ " musician_we" ] ;
143
- building_draw_normal_anim (ctx, point, &base, tile, anim , color_mask);
138
+ const animation_t &ranim = anim ( animkeys (). musician_we ) ;
139
+ building_draw_normal_anim (ctx, point, &base, tile, ranim , color_mask);
144
140
}
145
141
}
146
142
147
143
if (data.entertainment .juggler_visited && map_image_at (tile) == pavilion_m.booth_tile ) {
148
- const animation_t &anim = pavilion_m. anim [ " juggler" ] ;
149
- building_draw_normal_anim (ctx, point, &base, tile, anim , color_mask);
144
+ const animation_t &ranim = anim ( animkeys (). juggler ) ;
145
+ building_draw_normal_anim (ctx, point, &base, tile, ranim , color_mask);
150
146
}
151
147
152
148
return true ;
@@ -181,15 +177,17 @@ void building_pavilion::spawn_figure() {
181
177
182
178
void building_pavilion::ghost_preview (painter &ctx, tile2i tile, vec2i pixel, int orientation) {
183
179
int size = pavilion_m.building_size ;
184
- int square_id = building_impl::params (BUILDING_PAVILLION).anim [" square" ].first_img ();
180
+ const auto ¶ms = building_impl::params (BUILDING_PAVILLION);
181
+ int square_id = params.anim [animkeys ().square ].first_img ();
185
182
for (int i = 0 ; i < size * size; i++) {
186
183
ImageDraw::isometric (ctx, square_id + i, pixel + vec2i{((i % size) - (i / size)) * 30 , ((i % size) + (i / size)) * 15 }, COLOR_MASK_GREEN);
187
184
}
188
- int stand_sn_n = pavilion_m .anim [" stand_sn_n" ].first_img ();
189
- int stand_sn_s = pavilion_m .anim [" stand_sn_s" ].first_img ();
190
- int booth = pavilion_m .anim [" booth" ].first_img ();
191
- int stand = pavilion_m .anim [" base" ].first_img ();
185
+ int stand_sn_n = params .anim [animkeys (). stand_sn_n ].first_img ();
186
+ int stand_sn_s = params .anim [animkeys (). stand_sn_s ].first_img ();
187
+ int booth = params .anim [animkeys (). booth ].first_img ();
188
+ int stand = params .anim [animkeys (). base ].first_img ();
192
189
const auto &preview_conf = pavilion_m.preview_dir [orientation];
190
+
193
191
draw_building_ghost (ctx, stand, pixel + preview_conf.stand , COLOR_MASK_GREEN);
194
192
draw_building_ghost (ctx, stand_sn_n + preview_conf.stand_b_img , pixel + preview_conf.stand_b , COLOR_MASK_GREEN);
195
193
draw_building_ghost (ctx, stand_sn_s + preview_conf.stand_e_img , pixel + preview_conf.stand_e , COLOR_MASK_GREEN);
@@ -199,8 +197,9 @@ void building_pavilion::ghost_preview(painter &ctx, tile2i tile, vec2i pixel, in
199
197
void building_pavilion::on_undo () {
200
198
for (int dy = 0 ; dy < 4 ; dy++) {
201
199
for (int dx = 0 ; dx < 4 ; dx++) {
202
- if (map_building_at (data.entertainment .booth_corner_grid_offset + GRID_OFFSET (dx, dy)) == 0 )
203
- map_building_set (data.entertainment .booth_corner_grid_offset + GRID_OFFSET (dx, dy), id ());
200
+ const uint32_t offset = data.entertainment .booth_corner_grid_offset + GRID_OFFSET (dx, dy);
201
+ if (map_building_at (offset) == 0 )
202
+ map_building_set (offset, id ());
204
203
}
205
204
}
206
205
}
0 commit comments