@@ -168,60 +168,6 @@ void tutorial_map_update(int tut) {
168
168
}
169
169
}
170
170
171
- void tutorial1_handle_fire (event_fire_damage) {
172
- if (g_tutorials_flags.tutorial_1 .fire ) {
173
- return ;
174
- }
175
-
176
- g_city_events.removeListener (typeid (event_fire_damage), &tutorial1_handle_fire);
177
-
178
- g_tutorials_flags.tutorial_1 .fire = true ;
179
- g_scenario_data.add_fire_damage .clear ();
180
-
181
- building_menu_update (tutorial_stage.tutorial_fire );
182
- post_message (MESSAGE_TUTORIAL_FIRE_IN_THE_VILLAGE);
183
- }
184
-
185
- void tutorial1_handle_population_150 (event_population_changed ev) {
186
- if (g_tutorials_flags.tutorial_1 .population_150_reached || ev.value < 150 ) {
187
- return ;
188
- }
189
-
190
- g_city_events.removeListener (typeid (event_population_changed), &tutorial1_handle_population_150);
191
-
192
- g_tutorials_flags.tutorial_1 .population_150_reached = true ;
193
- building_menu_update (tutorial_stage.tutorial_food );
194
- post_message (MESSAGE_TUTORIAL_FOOD_OR_FAMINE);
195
- }
196
-
197
- void tutorial1_handle_collapse (event_collase_damage) {
198
- if (g_tutorials_flags.tutorial_1 .collapse ) {
199
- return ;
200
- }
201
-
202
- g_city_events.removeListener (typeid (event_collase_damage), &tutorial1_handle_collapse);
203
-
204
- g_tutorials_flags.tutorial_1 .collapse = true ;
205
- building_menu_update (tutorial_stage.tutorial_collapse );
206
- post_message (MESSAGE_TUTORIAL_COLLAPSED_BUILDING);
207
- }
208
-
209
- void tutorial1_on_filled_granary (event_granary_filled ev) {
210
- if (g_tutorials_flags.tutorial_1 .gamemeat_400_stored ) {
211
- return ;
212
- }
213
-
214
- if (ev.amount <= 400 ) {
215
- return ;
216
- }
217
-
218
- g_city_events.removeListener (typeid (event_granary_filled), &tutorial1_on_filled_granary);
219
-
220
- g_tutorials_flags.tutorial_1 .gamemeat_400_stored = true ;
221
- building_menu_update (tutorial_stage.tutorial_water );
222
- post_message (MESSAGE_TUTORIAL_CLEAN_WATER);
223
- }
224
-
225
171
void tutorial3_on_filled_granary (event_granary_filled ev) {
226
172
if (g_tutorials_flags.tutorial_3 .figs_800_stored ) {
227
173
return ;
@@ -245,31 +191,9 @@ void tutorial3_on_filled_granary(event_granary_filled ev) {
245
191
post_message (MESSAGE_TUTORIAL_INDUSTRY);
246
192
}
247
193
248
- bool tutorial1_is_success () {
249
- auto &tut = g_tutorials_flags.tutorial_1 ;
250
- return tut.fire && tut.collapse && tut.population_150_reached && tut.gamemeat_400_stored ;
251
- }
252
-
253
194
bool tutorial_menu_update (int tut) {
254
195
if (tut == 1 ) {
255
- if (g_tutorials_flags.tutorial_1 .fire ) building_menu_update (tutorial_stage.tutorial_fire );
256
- else g_city_events.appendListener (typeid (event_fire_damage), &tutorial1_handle_fire);
257
-
258
- if (g_tutorials_flags.tutorial_1 .population_150_reached ) building_menu_update (tutorial_stage.tutorial_food );
259
- else g_city_events.appendListener (typeid (event_population_changed), &tutorial1_handle_population_150);
260
-
261
- // if (!g_tutorials_flags.tutorial_1.architector_built) {
262
- // g_city_events.appendListener(typeid(event_building_create), &tutorial1_handle_building_create);
263
- // }
264
-
265
- if (g_tutorials_flags.tutorial_1 .collapse ) building_menu_update (tutorial_stage.tutorial_collapse );
266
- else g_city_events.appendListener (typeid (event_collase_damage), &tutorial1_handle_collapse);
267
-
268
- if (g_tutorials_flags.tutorial_1 .gamemeat_400_stored ) building_menu_update (tutorial_stage.tutorial_water );
269
- else g_city_events.appendListener (typeid (event_granary_filled), &tutorial1_on_filled_granary);
270
-
271
- g_city.victory_state .add_condition (&tutorial1_is_success);
272
-
196
+ tutorial_1::init ();
273
197
return true ;
274
198
}
275
199
@@ -472,33 +396,27 @@ void tutorial_on_house_evolve(e_house_level level) {
472
396
}
473
397
}
474
398
475
- void tutorial_update_step (pcstr s) {
476
- const xstring step (s);
477
- if (step == tutorial_stage.tutorial_fire ) {
478
- g_tutorials_flags.tutorial_1 .fire = false ;
479
- tutorial1_handle_fire ({0 });
480
- } else if (step == tutorial_stage.tutorial_food ) {
481
- building_menu_update (step);
399
+ void tutorial_update_step (xstring s) {
400
+ tutorial_1::update_step (s);
401
+ if (s == tutorial_stage.tutorial_food ) {
402
+ building_menu_update (s);
482
403
post_message (MESSAGE_TUTORIAL_FOOD_OR_FAMINE);
483
- } else if (step == tutorial_stage.tutorial_water ) {
484
- building_menu_update (step );
404
+ } else if (s == tutorial_stage.tutorial_water ) {
405
+ building_menu_update (s );
485
406
post_message (MESSAGE_TUTORIAL_CLEAN_WATER);
486
- } else if (step == tutorial_stage.tutorial_collapse ) {
487
- g_tutorials_flags.tutorial_1 .collapse = false ;
488
- tutorial1_handle_collapse ({0 });
489
- } else if (step == tutorial_stage.tutorial_gods ) {
490
- building_menu_update (step);
407
+ } else if (s == tutorial_stage.tutorial_gods ) {
408
+ building_menu_update (s);
491
409
post_message (MESSAGE_TUTORIAL_GODS_OF_EGYPT);
492
- } else if (step == tutorial_stage.tutorial_entertainment ) {
493
- building_menu_update (step );
494
- } else if (step == tutorial_stage.tutorial_industry ) {
495
- building_menu_update (step );
410
+ } else if (s == tutorial_stage.tutorial_entertainment ) {
411
+ building_menu_update (s );
412
+ } else if (s == tutorial_stage.tutorial_industry ) {
413
+ building_menu_update (s );
496
414
post_message (MESSAGE_TUTORIAL_INDUSTRY);
497
- } else if (step == tutorial_stage.tutorial_health ) {
498
- building_menu_update (step );
415
+ } else if (s == tutorial_stage.tutorial_health ) {
416
+ building_menu_update (s );
499
417
post_message (MESSAGE_TUTORIAL_BASIC_HEALTHCARE);
500
- } else if (step == tutorial_stage.tutorial_gardens ) {
501
- building_menu_update (step );
418
+ } else if (s == tutorial_stage.tutorial_gardens ) {
419
+ building_menu_update (s );
502
420
post_message (MESSAGE_TUTORIAL_MUNICIPAL_STRUCTURES);
503
421
}
504
422
}
@@ -609,6 +527,5 @@ io_buffer* iob_tutorial_flags = new io_buffer([](io_buffer* iob, size_t version)
609
527
iob->bind (BIND_SIGNATURE_UINT8, &g_tutorials_flags.pharaoh .flags [35 ]);
610
528
iob->bind (BIND_SIGNATURE_UINT8, &g_tutorials_flags.pharaoh .flags [36 ]); // goal: entertainment
611
529
iob->bind (BIND_SIGNATURE_UINT8, &g_tutorials_flags.pharaoh .flags [37 ]); // goal: temples
612
- iob->bind (BIND_SIGNATURE_UINT8, &g_tutorials_flags.pharaoh .flags [38 ]);
613
- iob->bind (BIND_SIGNATURE_UINT8, &g_tutorials_flags.pharaoh .flags [39 ]);
530
+ iob->bind (BIND_SIGNATURE_UINT16, &g_tutorials_flags.pharaoh .last_action );
614
531
});
0 commit comments