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

This commit is contained in:
Zeno Rogue 2018-12-04 19:16:39 +01:00
parent cd01e6bbf1
commit 04f26cdf1d
2 changed files with 12 additions and 4 deletions

View File

@ -206,9 +206,8 @@ void generate_track() {
traversed++; traversed++;
if(cellbydist.empty()) { if(cellbydist.empty()) {
printf("reset after traversing %d\n", traversed); printf("reset after traversing %d\n", traversed);
stop_game();
race_try++; race_try++;
start_game(); gamegen_failure = true;
return; return;
} }
auto it = cellbydist.end(); auto it = cellbydist.end();
@ -435,9 +434,8 @@ void generate_track() {
} }
if(!goal) { if(!goal) {
printf("error: goal unreachable\n"); printf("error: goal unreachable\n");
stop_game(); gamegen_failure = true;
race_try++; race_try++;
start_game();
return; return;
} }
} }

View File

@ -22,6 +22,8 @@ bool timerstopped;
int savecount; int savecount;
bool showoff = false, doCross = false; bool showoff = false, doCross = false;
bool gamegen_failure;
eLand top_land; eLand top_land;
bool verless(string v, string cmp) { bool verless(string v, string cmp) {
@ -98,6 +100,7 @@ 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);
@ -105,6 +108,8 @@ void initgame() {
multi::players = 1; multi::players = 1;
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);
@ -183,6 +188,11 @@ void initgame() {
if(racing::on) racing::generate_track(); if(racing::on) racing::generate_track();
#endif #endif
if(gamegen_failure) {
stop_game();
goto restart;
}
clear_euland(specialland); clear_euland(specialland);
if(euclid && specialland == laPrincessQuest) { if(euclid && specialland == laPrincessQuest) {