From 103a3a3411789f76a8a1cbc1b565839a62455d53 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 1 Mar 2020 14:09:24 +0100 Subject: [PATCH] more changes.ccell added --- complex.cpp | 5 ++++- complex2.cpp | 2 ++ mapeffects.cpp | 1 + pcmove.cpp | 21 ++++++++++++++++++--- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/complex.cpp b/complex.cpp index 41084372..76217034 100644 --- a/complex.cpp +++ b/complex.cpp @@ -617,6 +617,7 @@ struct info { } void setdist(info *i, int newdist) { + changes.value_keep(*i); if(newdist < ALTDIST_ERROR && newdist > i->bestdist) { i->bestdist = newdist; // printf("Improved dist to %d\n", newdist); @@ -648,7 +649,7 @@ struct info { EX void save(cell *princess) { if(euclid) return; princess::info *i = princess::getPrincessInfo(princess); - if(!i || i->bestdist <= 3) princess->monst = moNone; + if(!i || i->bestdist <= 3) changes.ccell(princess), princess->monst = moNone; else if(i) setdist(i, OUT_OF_PRISON); } @@ -664,6 +665,7 @@ struct info { addMessage("Warning: unknown princess (that's a bug, please report)"); } else { + changes.value_keep(*i); i->princess = ct; setdist(i, dist(ct)); // printf("newdist = %d (vs %d)\n", newdist, i->bestdist); @@ -770,6 +772,7 @@ struct info { int d = dist(c); // if(i) printf("d=%d bn=%d\n", d, i->bestnear); if(i && d < i->bestnear) { + changes.value_keep(*i); if(i->bestnear > 100 && d <= 100) { i->value = items[itPalace]; if(princess::challenge) diff --git a/complex2.cpp b/complex2.cpp index e31491ad..ce8b3244 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -486,6 +486,7 @@ EX bool uncoverMines(cell *c, int lev, int dist, bool just_checking) { if(just_checking) return true; else { + changes.ccell(c); c->wall = waMineOpen; b = true; } @@ -512,6 +513,7 @@ EX bool uncoverMines(cell *c, int lev, int dist, bool just_checking) { if(minesNearby && !nominesNearby && dist == 0) { for(cell *c2: adj) if(c2->wall == waMineMine && c2->land == laMinefield) + changes.ccell(c2), c2->landparam |= 1; } diff --git a/mapeffects.cpp b/mapeffects.cpp index dc7f93c6..6e12b9e2 100644 --- a/mapeffects.cpp +++ b/mapeffects.cpp @@ -848,6 +848,7 @@ EX array traplimits(cell *c) { EX void activateArrowTrap(cell *c) { if(c->wall == waArrowTrap && c->wparam == 0) { + changes.ccell(c); playSound(c, "click"); c->wparam = shmup::on ? 2 : 1; forCellEx(c2, c) activateArrowTrap(c2); diff --git a/pcmove.cpp b/pcmove.cpp index 55e9eabe..8c9248f7 100644 --- a/pcmove.cpp +++ b/pcmove.cpp @@ -413,7 +413,8 @@ struct changes_t { void init(bool ch) { on = true; - for(cell *dc: dcal) ccell(dc); + ccell(cwt.at); + forCellEx(c1, cwt.at) ccell(c1); value_keep(kills); value_keep(items); checking = ch; @@ -1186,6 +1187,7 @@ EX void playerMoveEffects(cell *c1, cell *c2) { if(c2->wall == waFireTrap && c2->wparam == 0 && normal_gravity_at(c2) &&!markOrb(itOrbAether)) { playSound(c2, "click"); + changes.ccell(c2); c2->wparam = 1; } @@ -1226,6 +1228,7 @@ EX void afterplayermoved() { EX void produceGhost(cell *c, eMonster victim, eMonster who) { if(who != moPlayer && !items[itOrbEmpathy]) return; if(markOrb(itOrbUndeath) && !c->monst && isGhostable(victim)) { + changes.ccell(c); c->monst = moFriendlyGhost, c->stuntime = 0; if(who != moPlayer) markOrb(itOrbEmpathy); } @@ -1236,6 +1239,7 @@ EX bool swordAttack(cell *mt, eMonster who, cell *c, int bb) { if(c->wall == waCavewall) markOrb(bb ? itOrbSword2: itOrbSword); if(c->wall == waSmallTree || c->wall == waBigTree || c->wall == waRose || c->wall == waCTree || c->wall == waVinePlant || thruVine(mt, c) || c->wall == waBigBush || c->wall == waSmallBush || c->wall == waSolidBranch || c->wall == waWeakBranch) { + changes.ccell(c); playSound(NULL, "hit-axe"+pick123()); markOrb(bb ? itOrbSword2: itOrbSword); drawParticles(c, winf[c->wall].color, 16); @@ -1244,12 +1248,14 @@ EX bool swordAttack(cell *mt, eMonster who, cell *c, int bb) { c->wall = waNone; } if(c->wall == waBarrowDig) { + changes.ccell(c); playSound(NULL, "hit-axe"+pick123()); markOrb(bb ? itOrbSword2: itOrbSword); drawParticles(c, winf[c->wall].color, 16); c->wall = waNone; } if(c->wall == waBarrowWall && items[itBarrow] >= 25) { + changes.ccell(c); playSound(NULL, "hit-axe"+pick123()); markOrb(bb ? itOrbSword2: itOrbSword); drawParticles(c, winf[c->wall].color, 16); @@ -1258,6 +1264,7 @@ EX bool swordAttack(cell *mt, eMonster who, cell *c, int bb) { if(c->wall == waExplosiveBarrel) explodeBarrel(c); if(!peace::on && canAttack(mt, who, c, m, AF_SWORD)) { + changes.ccell(c); markOrb(bb ? itOrbSword2: itOrbSword); int k = tkills(); attackMonster(c, AF_NORMAL | AF_MSG | AF_SWORD, who); @@ -1305,6 +1312,7 @@ EX void sideAttackAt(cell *mf, int dir, cell *mt, eMonster who, eItem orb, cell if((f & AF_CRUSH) && !canAttack(mf, who, mt, m, AF_SIDE | AF_MUSTKILL)) markOrb(itOrbSlaying); markOrb(orb); + changes.ccell(mt); plague_particles(); if(who != moPlayer) markOrb(itOrbEmpathy); if(attackMonster(mt, AF_NORMAL | AF_SIDE | AF_MSG, who) || isAnyIvy(m)) { @@ -1313,24 +1321,29 @@ EX void sideAttackAt(cell *mf, int dir, cell *mt, eMonster who, eItem orb, cell } } else if(mt->wall == waSmallTree) { + changes.ccell(mt); plague_particles(); markOrb(orb); mt->wall = waNone; spread_plague(mf, mt, dir, who); } else if(mt->wall == waShrub && markEmpathy(itOrbSlaying)) { + changes.ccell(mt); plague_particles(); markOrb(orb); mt->wall = waNone; spread_plague(mf, mt, dir, who); } else if(mt->wall == waBigTree) { + changes.ccell(mt); plague_particles(); markOrb(orb); mt->wall = waSmallTree; } - else if(mt->wall == waExplosiveBarrel && orb != itOrbPlague) - explodeBarrel(mt); + else if(mt->wall == waExplosiveBarrel && orb != itOrbPlague) { + changes.ccell(mt); + explodeBarrel(mt); + } } EX void sideAttack(cell *mf, int dir, eMonster who, int bonus, eItem orb) { @@ -1446,6 +1459,8 @@ EX void movecost(cell* from, cell *to, int phase) { chaosmode; if(tortoise::seek() && !from->item && !tortoiseOK && passable(from, NULL, 0) && (phase & 2)) { + changes.ccell(from); + changes.map_value(tortoise::babymap, from); from->item = itBabyTortoise; tortoise::babymap[from] = tortoise::seekbits; addMessage(XLAT("You leave %the1.", itBabyTortoise));