From 04f26cdf1dc7c85624bff3a20290408f34a38c8b Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 4 Dec 2018 19:16:39 +0100 Subject: [PATCH] racing:: failure now uses gamegen_failure flag -- no more game starting multiple times --- racing.cpp | 6 ++---- system.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/racing.cpp b/racing.cpp index 204a4d4a..5bf2fe91 100644 --- a/racing.cpp +++ b/racing.cpp @@ -206,9 +206,8 @@ void generate_track() { traversed++; if(cellbydist.empty()) { printf("reset after traversing %d\n", traversed); - stop_game(); race_try++; - start_game(); + gamegen_failure = true; return; } auto it = cellbydist.end(); @@ -435,9 +434,8 @@ void generate_track() { } if(!goal) { printf("error: goal unreachable\n"); - stop_game(); + gamegen_failure = true; race_try++; - start_game(); return; } } diff --git a/system.cpp b/system.cpp index f95fae42..3253687b 100644 --- a/system.cpp +++ b/system.cpp @@ -22,6 +22,8 @@ bool timerstopped; int savecount; bool showoff = false, doCross = false; +bool gamegen_failure; + eLand top_land; bool verless(string v, string cmp) { @@ -98,6 +100,7 @@ hookset *hooks_initgame; // initialize the game void initgame() { + restart: DEBB(DF_INIT, (debugfile,"initGame\n")); callhooks(hooks_initgame); @@ -105,6 +108,8 @@ void initgame() { multi::players = 1; multi::whereto[0].d = MD_UNDECIDED; multi::cpid = 0; + + gamegen_failure = false; yendor::init(1); @@ -183,6 +188,11 @@ void initgame() { if(racing::on) racing::generate_track(); #endif + if(gamegen_failure) { + stop_game(); + goto restart; + } + clear_euland(specialland); if(euclid && specialland == laPrincessQuest) {