1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-30 03:50:34 +00:00

racing:: failure now uses gamegen_failure flag -- no more game starting multiple times

This commit is contained in:
Zeno Rogue 2018-12-04 19:20:44 +01:00
parent 04f26cdf1d
commit a6ffdc8676

View File

@ -100,7 +100,6 @@ hookset<void()> *hooks_initgame;
// initialize the game // initialize the game
void initgame() { void initgame() {
restart:
DEBB(DF_INIT, (debugfile,"initGame\n")); DEBB(DF_INIT, (debugfile,"initGame\n"));
callhooks(hooks_initgame); callhooks(hooks_initgame);
@ -109,8 +108,6 @@ void initgame() {
multi::whereto[0].d = MD_UNDECIDED; multi::whereto[0].d = MD_UNDECIDED;
multi::cpid = 0; multi::cpid = 0;
gamegen_failure = false;
yendor::init(1); yendor::init(1);
if(safety && safetyseed) { if(safety && safetyseed) {
@ -188,10 +185,7 @@ void initgame() {
if(racing::on) racing::generate_track(); if(racing::on) racing::generate_track();
#endif #endif
if(gamegen_failure) { if(gamegen_failure) return;
stop_game();
goto restart;
}
clear_euland(specialland); clear_euland(specialland);
@ -1315,7 +1309,9 @@ void switch_game_mode(char switchWhat) {
void start_game() { void start_game() {
if(game_active) return; if(game_active) return;
DEBB(DF_INIT, (debugfile,"start_game\n")); DEBB(DF_INIT, (debugfile,"start_game\n"));
restart:
game_active = true; game_active = true;
gamegen_failure = false;
if(need_reset_geometry) resetGeometry(), need_reset_geometry = false; if(need_reset_geometry) resetGeometry(), need_reset_geometry = false;
initcells(); initcells();
expansion.reset(); expansion.reset();
@ -1333,6 +1329,10 @@ void start_game() {
} }
initgame(); initgame();
if(gamegen_failure) {
stop_game();
goto restart;
}
canmove = true; canmove = true;
restartGraph(); restartGraph();
resetmusic(); resetmusic();