prevent freezes in West Wall with wrong data

This commit is contained in:
Zeno Rogue 2021-08-08 18:32:10 +02:00
parent 4902d2db8d
commit 683ab67ad9
1 changed files with 7 additions and 0 deletions

View File

@ -225,6 +225,13 @@ EX namespace westwall {
again:
cell *at = whirlline[isize(whirlline)-1];
cell *prev = whirlline[isize(whirlline)-2];
if(isize(whirlline) > 2 && at == whirlline[isize(whirlline)/2]) {
/* something weird must have happened... */
static bool once = true;
if(once) addMessage("warning: a bug in building a whirl line");
once = false;
return;
}
for(int i=0; i<at->type; i++)
if(at->move(i) && coastvalEdge1(at->move(i)) == d && at->move(i) != prev) {
whirlline.push_back(at->move(i));