1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

fixed to PTM save at 0 treasure

This commit is contained in:
Zeno Rogue 2024-07-27 21:44:57 +02:00
parent 75a73f40b3
commit fecd98e758

View File

@ -46,6 +46,9 @@ EX bool game_active;
/** \brief God mode */ /** \brief God mode */
EX bool autocheat; EX bool autocheat;
/** \brief is the current game loaded from the save file */
EX bool loaded_from_save;
/** \brief which wall should we fill the Canvas with */ /** \brief which wall should we fill the Canvas with */
EX eWall canvas_default_wall = waNone; EX eWall canvas_default_wall = waNone;
@ -1079,7 +1082,7 @@ EX void saveStats(bool emergency IS(false)) {
if(peace::on && !save_cheats) return; if(peace::on && !save_cheats) return;
if(experimental) return; if(experimental) return;
if(!gold() && !racing::on && !items[itOrbSafety]) return; if(!gold() && !racing::on && !items[itOrbSafety] && !loaded_from_save) return;
remove_emergency_save(); remove_emergency_save();
@ -1131,9 +1134,11 @@ EX void saveStats(bool emergency IS(false)) {
int(xcode), int(xcode),
buf); buf);
if(!loaded_from_save) {
fclose(f); fclose(f);
return; return;
} }
}
#if CAP_RACING #if CAP_RACING
if(racing::on) { if(racing::on) {
@ -1392,6 +1397,7 @@ EX void load_last_save() {
yendor::on = false; yendor::on = false;
tour::on = false; tour::on = false;
save_turns = turncount; save_turns = turncount;
loaded_from_save = true;
} }
#endif #endif
@ -1667,6 +1673,7 @@ EX void start_game() {
game_active = true; game_active = true;
gamegen_failure = false; gamegen_failure = false;
ignored_memory_warning = false; ignored_memory_warning = false;
loaded_from_save = false;
check_cgi(); check_cgi();
cgi.require_basics(); cgi.require_basics();
#if CAP_ARCM #if CAP_ARCM
@ -1800,7 +1807,9 @@ EX void initAll() {
loadsave(); loadsave();
if(IRREGULAR && !irr::base) irr::auto_creator(); if(IRREGULAR && !irr::base) irr::auto_creator();
#endif #endif
bool b = loaded_from_save;
start_game(); start_game();
if(b) loaded_from_save = b;
restore_all_golems(); restore_all_golems();
firstland = firstland0; firstland = firstland0;