mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-10 20:27:39 +00:00
racing:: fixed handing incorrectly built track
This commit is contained in:
11
racing.cpp
11
racing.cpp
@@ -239,6 +239,8 @@ int race_checksum;
|
|||||||
|
|
||||||
ld start_line_width;
|
ld start_line_width;
|
||||||
|
|
||||||
|
struct hr_track_failure : hr_exception {};
|
||||||
|
|
||||||
void find_track(cell *start, int sign, int len) {
|
void find_track(cell *start, int sign, int len) {
|
||||||
int dl = 7 - getDistLimit() - genrange_bonus;
|
int dl = 7 - getDistLimit() - genrange_bonus;
|
||||||
cell *goal;
|
cell *goal;
|
||||||
@@ -252,9 +254,7 @@ void find_track(cell *start, int sign, int len) {
|
|||||||
traversed++;
|
traversed++;
|
||||||
if(cellbydist.empty()) {
|
if(cellbydist.empty()) {
|
||||||
printf("reset after traversing %d\n", traversed);
|
printf("reset after traversing %d\n", traversed);
|
||||||
race_try++;
|
throw hr_track_failure();
|
||||||
gamegen_failure = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
auto it = cellbydist.end();
|
auto it = cellbydist.end();
|
||||||
it--;
|
it--;
|
||||||
@@ -339,6 +339,11 @@ EX void generate_track() {
|
|||||||
else try {
|
else try {
|
||||||
find_track(s, 0, LENGTH);
|
find_track(s, 0, LENGTH);
|
||||||
}
|
}
|
||||||
|
catch(hr_track_failure&) {
|
||||||
|
race_try++;
|
||||||
|
gamegen_failure = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
catch(hr_shortest_path_exception&) {
|
catch(hr_shortest_path_exception&) {
|
||||||
addMessage("error: could not build path");
|
addMessage("error: could not build path");
|
||||||
gamegen_failure = true;
|
gamegen_failure = true;
|
||||||
|
Reference in New Issue
Block a user