@@ -193,6 +193,18 @@ void tutorial1_handle_population_changed(event_population_changed ev) {
193
193
post_message (MESSAGE_TUTORIAL_FOOD_OR_FAMINE);
194
194
}
195
195
196
+ void tutorial1_handle_collapse (event_collase_damage) {
197
+ if (g_tutorials_flags.tutorial_1 .collapse ) {
198
+ return ;
199
+ }
200
+
201
+ g_city_events.removeListener (typeid (event_collase_damage), &tutorial1_handle_collapse);
202
+
203
+ g_tutorials_flags.tutorial_1 .collapse = true ;
204
+ building_menu_update (tutorial_stage.tutorial_collapse );
205
+ post_message (MESSAGE_TUTORIAL_COLLAPSED_BUILDING);
206
+ }
207
+
196
208
bool tutorial1_is_success () {
197
209
auto &tut = g_tutorials_flags.tutorial_1 ;
198
210
return tut.fire && tut.collapse && tut.population_150_reached && tut.gamemeat_400_stored ;
@@ -207,6 +219,8 @@ bool tutorial_menu_update(int tut) {
207
219
else g_city_events.appendListener (typeid (event_population_changed), &tutorial1_handle_population_changed);
208
220
209
221
if (g_tutorials_flags.tutorial_1 .collapse ) building_menu_update (tutorial_stage.tutorial_collapse );
222
+ else g_city_events.appendListener (typeid (event_collase_damage), &tutorial1_handle_collapse);
223
+
210
224
if (g_tutorials_flags.tutorial_1 .gamemeat_400_stored ) building_menu_update (tutorial_stage.tutorial_water );
211
225
212
226
g_city.victory_state .add_condition (&tutorial1_is_success);
@@ -336,21 +350,11 @@ int tutorial_extra_fire_risk(void) {
336
350
&& scenario_is_mission_rank (1 ); // Fix for extra fire risk in late tutorials
337
351
}
338
352
339
- int tutorial_extra_damage_risk (void ) {
353
+ int tutorial_extra_damage_risk () {
340
354
return g_tutorials_flags.tutorial_1 .fire && !g_tutorials_flags.tutorial_1 .collapse
341
355
&& scenario_is_mission_rank (1 ); // Fix for extra damage risk in late tutorials
342
356
}
343
357
344
- int tutorial_handle_collapse (void ) {
345
- if (g_tutorials_flags.tutorial_1 .collapse )
346
- return 0 ;
347
-
348
- g_tutorials_flags.tutorial_1 .collapse = 1 ;
349
- building_menu_update (tutorial_stage.tutorial_collapse );
350
- post_message (MESSAGE_TUTORIAL_COLLAPSED_BUILDING);
351
- return 1 ;
352
- }
353
-
354
358
void tutorial_flags_t::on_crime () {
355
359
if (!g_tutorials_flags.pharaoh .crime ) {
356
360
g_tutorials_flags.pharaoh .crime = 1 ;
@@ -439,7 +443,7 @@ void tutorial_update_step(pcstr s) {
439
443
const xstring step (s);
440
444
if (step == tutorial_stage.tutorial_fire ) {
441
445
g_tutorials_flags.tutorial_1 .fire = false ;
442
- tutorial1_handle_fire (event_fire_damage {0 });
446
+ tutorial1_handle_fire ({0 });
443
447
} else if (step == tutorial_stage.tutorial_food ) {
444
448
building_menu_update (step);
445
449
post_message (MESSAGE_TUTORIAL_FOOD_OR_FAMINE);
@@ -448,7 +452,7 @@ void tutorial_update_step(pcstr s) {
448
452
post_message (MESSAGE_TUTORIAL_CLEAN_WATER);
449
453
} else if (step == tutorial_stage.tutorial_collapse ) {
450
454
g_tutorials_flags.tutorial_1 .collapse = false ;
451
- tutorial_handle_collapse ( );
455
+ tutorial1_handle_collapse ({ 0 } );
452
456
} else if (step == tutorial_stage.tutorial_gods ) {
453
457
building_menu_update (step);
454
458
post_message (MESSAGE_TUTORIAL_GODS_OF_EGYPT);
0 commit comments