racing:: fixed handing incorrectly built track

This commit is contained in:
Zeno Rogue 2019-09-27 17:35:14 +02:00
parent 4fe1fe8c38
commit 9ed730e10d
1 changed files with 8 additions and 3 deletions

View File

@ -239,6 +239,8 @@ int race_checksum;
ld start_line_width;
struct hr_track_failure : hr_exception {};
void find_track(cell *start, int sign, int len) {
int dl = 7 - getDistLimit() - genrange_bonus;
cell *goal;
@ -252,9 +254,7 @@ void find_track(cell *start, int sign, int len) {
traversed++;
if(cellbydist.empty()) {
printf("reset after traversing %d\n", traversed);
race_try++;
gamegen_failure = true;
return;
throw hr_track_failure();
}
auto it = cellbydist.end();
it--;
@ -339,6 +339,11 @@ EX void generate_track() {
else try {
find_track(s, 0, LENGTH);
}
catch(hr_track_failure&) {
race_try++;
gamegen_failure = true;
return;
}
catch(hr_shortest_path_exception&) {
addMessage("error: could not build path");
gamegen_failure = true;