town entry autosave wait for specials to run. fix #781
This commit is contained in:
@@ -70,6 +70,8 @@ void force_town_enter(short which_town,location where_start) {
|
||||
town_force_loc = where_start;
|
||||
}
|
||||
|
||||
bool need_enter_town_autosave = false;
|
||||
|
||||
//short entry_dir; // if 9, go to forced
|
||||
void start_town_mode(short which_town, short entry_dir, bool debug_enter) {
|
||||
short town_number;
|
||||
@@ -335,8 +337,9 @@ void start_town_mode(short which_town, short entry_dir, bool debug_enter) {
|
||||
if(no_thrash.count(&monst) == 0)
|
||||
monst.active = eCreatureStatus::DEAD;
|
||||
}
|
||||
bool specials_queued = false;
|
||||
if(!debug_enter)
|
||||
handle_town_specials(town_number, (short) town_toast,(entry_dir < 9) ? univ.town->start_locs[entry_dir] : town_force_loc);
|
||||
specials_queued = handle_town_specials(town_number, (short) town_toast,(entry_dir < 9) ? univ.town->start_locs[entry_dir] : town_force_loc);
|
||||
|
||||
// Flush excess doomguards and viscous goos
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
@@ -500,7 +503,9 @@ void start_town_mode(short which_town, short entry_dir, bool debug_enter) {
|
||||
// ... except it actually doesn't, because the town enter special is only queued, not run immediately.
|
||||
draw_terrain(1);
|
||||
|
||||
try_auto_save("EnterTown");
|
||||
// If special nodes still need to be called, we can't do the autosave yet.
|
||||
if(specials_queued) need_enter_town_autosave = true;
|
||||
else try_auto_save("EnterTown");
|
||||
}
|
||||
|
||||
|
||||
@@ -627,8 +632,8 @@ location end_town_mode(bool switching_level,location destination, bool debug_lea
|
||||
return to_return;
|
||||
}
|
||||
|
||||
void handle_town_specials(short /*town_number*/, bool town_dead,location /*start_loc*/) {
|
||||
queue_special(eSpecCtx::ENTER_TOWN, eSpecCtxType::TOWN, town_dead ? univ.town->spec_on_entry_if_dead : univ.town->spec_on_entry, univ.party.town_loc);
|
||||
bool handle_town_specials(short /*town_number*/, bool town_dead,location /*start_loc*/) {
|
||||
return queue_special(eSpecCtx::ENTER_TOWN, eSpecCtxType::TOWN, town_dead ? univ.town->spec_on_entry_if_dead : univ.town->spec_on_entry, univ.party.town_loc);
|
||||
}
|
||||
|
||||
void handle_leave_town_specials(short /*town_number*/, short which_spec,location /*start_loc*/) {
|
||||
|
Reference in New Issue
Block a user