1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

fixed the bug where tides may move on orb use

This commit is contained in:
Zeno Rogue 2023-12-22 00:51:07 +01:00
parent 95ed035180
commit eb3406d7dc
3 changed files with 15 additions and 14 deletions

View File

@ -304,8 +304,6 @@ EX vector<int> bfs_reachedfrom;
/** calculate cpdist, 'have' flags, and do general fixings */ /** calculate cpdist, 'have' flags, and do general fixings */
EX void bfs() { EX void bfs() {
calcTidalPhase();
yendor::onpath(); yendor::onpath();
int dcs = isize(dcal); int dcs = isize(dcal);
@ -330,12 +328,9 @@ EX void bfs() {
dcal.clear(); bfs_reachedfrom.clear(); dcal.clear(); bfs_reachedfrom.clear();
recalcTide = false;
for(cell *c: player_positions()) { for(cell *c: player_positions()) {
if(c->cpdist == 0) continue; if(c->cpdist == 0) continue;
c->cpdist = 0; c->cpdist = 0;
checkTide(c);
dcal.push_back(c); dcal.push_back(c);
bfs_reachedfrom.push_back(hrand(c->type)); bfs_reachedfrom.push_back(hrand(c->type));
if(!invismove) targets.push_back(c); if(!invismove) targets.push_back(c);
@ -436,8 +431,6 @@ EX void bfs() {
dcal.push_back(c2); dcal.push_back(c2);
bfs_reachedfrom.push_back(c->c.spin(i)); bfs_reachedfrom.push_back(c->c.spin(i));
checkTide(c2);
if(c2->wall == waBigStatue && c2->land != laTemple) if(c2->wall == waBigStatue && c2->land != laTemple)
statuecount++; statuecount++;
@ -548,11 +541,6 @@ EX void bfs() {
if(c2->wall == waThumperOn) { if(c2->wall == waThumperOn) {
targets.push_back(c2); targets.push_back(c2);
} }
while(recalcTide) {
recalcTide = false;
for(int i=0; i<isize(dcal); i++) checkTide(dcal[i]);
}
for(auto& t: tempmonsters) t.first->monst = t.second; for(auto& t: tempmonsters) t.first->monst = t.second;
@ -831,7 +819,16 @@ EX void findWormIvy(cell *c) {
else break; else break;
} }
} }
EX void advance_tides() {
calcTidalPhase();
recalcTide = true;
while(recalcTide) {
recalcTide = false;
for(int i=0; i<isize(dcal); i++) checkTide(dcal[i]);
}
}
EX void monstersTurn() { EX void monstersTurn() {
reset_spill(); reset_spill();
checkSwitch(); checkSwitch();
@ -869,6 +866,8 @@ EX void monstersTurn() {
if(!phase1) livecaves(); if(!phase1) livecaves();
if(!phase1) ca::simulate(); if(!phase1) ca::simulate();
if(!phase1) heat::processfires(); if(!phase1) heat::processfires();
// this depends on turncount, so we do it always
advance_tides();
for(cell *c: crush_now) { for(cell *c: crush_now) {
changes.ccell(c); changes.ccell(c);

View File

@ -640,7 +640,7 @@ EX bool cellEdgeUnstable(cell *c, flagtype flags IS(0)) {
return true; return true;
} }
int tidalphase; EX int tidalphase;
EX int tidalsize, tide[200]; EX int tidalsize, tide[200];

View File

@ -629,6 +629,7 @@ EX void teleportTo(cell *dest) {
playerMoveEffects(movei(cwt.at, dest, TELEPORT)); playerMoveEffects(movei(cwt.at, dest, TELEPORT));
afterplayermoved(); afterplayermoved();
bfs(); bfs();
advance_tides();
} }
return; return;
} }
@ -647,6 +648,7 @@ EX void teleportTo(cell *dest) {
afterplayermoved(); afterplayermoved();
bfs(); bfs();
advance_tides();
sword::reset(); sword::reset();
items[itOrbSword2] = 0; items[itOrbSword2] = 0;