mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-26 00:47:00 +00:00
fixed missing error messages on move
This commit is contained in:
parent
4a913485d0
commit
fcbb65b27e
38
pcmove.cpp
38
pcmove.cpp
@ -216,11 +216,15 @@ struct pcmove {
|
|||||||
|
|
||||||
movei mi, mip;
|
movei mi, mip;
|
||||||
pcmove() : mi(nullptr, nullptr, 0), mip(nullptr, nullptr, 0) {}
|
pcmove() : mi(nullptr, nullptr, 0), mip(nullptr, nullptr, 0) {}
|
||||||
|
|
||||||
|
bool vmsg();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EX cell *global_pushto;
|
EX cell *global_pushto;
|
||||||
|
|
||||||
|
bool pcmove::vmsg() { changes.rollback(); return errormsgs && !checkonly; }
|
||||||
|
|
||||||
EX bool movepcto(int d, int subdir IS(1), bool checkonly IS(false)) {
|
EX bool movepcto(int d, int subdir IS(1), bool checkonly IS(false)) {
|
||||||
pcmove pcm;
|
pcmove pcm;
|
||||||
pcm.checkonly = checkonly;
|
pcm.checkonly = checkonly;
|
||||||
@ -543,7 +547,7 @@ bool pcmove::actual_move() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(againstRose(cwt.at, c2) && !scentResistant()) {
|
if(againstRose(cwt.at, c2) && !scentResistant()) {
|
||||||
addMessage("Those roses smell too nicely. You have to come towards them.");
|
if(vmsg()) addMessage("Those roses smell too nicely. You have to come towards them.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +572,7 @@ bool pcmove::actual_move() {
|
|||||||
mip = determinePush(cwt, subdir, [c2] (cell *c) { return canPushThumperOn(c, c2, cwt.at); });
|
mip = determinePush(cwt, subdir, [c2] (cell *c) { return canPushThumperOn(c, c2, cwt.at); });
|
||||||
if(mip.t) changes.ccell(mip.t);
|
if(mip.t) changes.ccell(mip.t);
|
||||||
if(mip.d == NO_SPACE) {
|
if(mip.d == NO_SPACE) {
|
||||||
addMessage(XLAT("No room to push %the1.", c2->wall));
|
if(vmsg()) addMessage(XLAT("No room to push %the1.", c2->wall));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nextmovetype = lmMove;
|
nextmovetype = lmMove;
|
||||||
@ -579,7 +583,7 @@ bool pcmove::actual_move() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(c2->item == itHolyGrail && roundTableRadius(c2) < newRoundTableRadius()) {
|
if(c2->item == itHolyGrail && roundTableRadius(c2) < newRoundTableRadius()) {
|
||||||
addMessage(XLAT("That was not a challenge. Find a larger castle!"));
|
if(vmsg()) addMessage(XLAT("That was not a challenge. Find a larger castle!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,21 +617,21 @@ bool pcmove::boat_move() {
|
|||||||
if(havePushConflict(cwt.at, checkonly)) return false;
|
if(havePushConflict(cwt.at, checkonly)) return false;
|
||||||
|
|
||||||
if(againstWind(c2, cwt.at)) {
|
if(againstWind(c2, cwt.at)) {
|
||||||
addMessage(XLAT(airdist(c2) < 3 ? "The Air Elemental blows you away!" : "You cannot go against the wind!"));
|
if(vmsg()) addMessage(XLAT(airdist(c2) < 3 ? "The Air Elemental blows you away!" : "You cannot go against the wind!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(againstCurrent(c2, cwt.at) && !markOrb(itOrbWater)) {
|
if(againstCurrent(c2, cwt.at) && !markOrb(itOrbWater)) {
|
||||||
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
||||||
return after_escape();
|
return after_escape();
|
||||||
addMessage(XLAT("You cannot go against the current!"));
|
if(vmsg()) addMessage(XLAT("You cannot go against the current!"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cwt.at->item == itOrbYendor) {
|
if(cwt.at->item == itOrbYendor) {
|
||||||
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
if(markOrb(itOrbFish) || markOrb(itOrbAether) || gravity_state)
|
||||||
return after_escape();
|
return after_escape();
|
||||||
addMessage(XLAT("The Orb of Yendor is locked in with powerful magic."));
|
if(vmsg()) addMessage(XLAT("The Orb of Yendor is locked in with powerful magic."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,10 +686,12 @@ bool pcmove::after_escape() {
|
|||||||
|
|
||||||
if(c2->wall == waBigStatue && !c2->monst && !nonAdjacentPlayer(c2, cwt.at) && fmsMove) {
|
if(c2->wall == waBigStatue && !c2->monst && !nonAdjacentPlayer(c2, cwt.at) && fmsMove) {
|
||||||
if(!canPushStatueOn(cwt.at)) {
|
if(!canPushStatueOn(cwt.at)) {
|
||||||
|
if(vmsg()) {
|
||||||
if(isFire(cwt.at))
|
if(isFire(cwt.at))
|
||||||
addMessage(XLAT("You have to escape first!"));
|
addMessage(XLAT("You have to escape first!"));
|
||||||
else
|
else
|
||||||
addMessage(XLAT("There is not enough space!"));
|
addMessage(XLAT("There is not enough space!"));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,14 +766,14 @@ bool pcmove::after_escape() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(c2->monst == moKnight) {
|
else if(c2->monst == moKnight) {
|
||||||
camelot::knightFlavorMessage(c2);
|
if(vmsg()) camelot::knightFlavorMessage(c2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(c2->monst && (!isFriendly(c2) || c2->monst == moTameBomberbird || isMountable(c2->monst))
|
else if(c2->monst && (!isFriendly(c2) || c2->monst == moTameBomberbird || isMountable(c2->monst))
|
||||||
&& !(peace::on && !isMultitile(c2->monst) && !good_tortoise))
|
&& !(peace::on && !isMultitile(c2->monst) && !good_tortoise))
|
||||||
return attack();
|
return attack();
|
||||||
else if(!passable(c2, cwt.at, P_USEBOAT | P_ISPLAYER | P_MIRROR | P_MONSTER)) {
|
else if(!passable(c2, cwt.at, P_USEBOAT | P_ISPLAYER | P_MIRROR | P_MONSTER)) {
|
||||||
tell_why_impassable();
|
if(vmsg()) tell_why_impassable();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(fmsMove)
|
else if(fmsMove)
|
||||||
@ -841,15 +847,14 @@ bool pcmove::attack() {
|
|||||||
if(!ca) {
|
if(!ca) {
|
||||||
if(forcedmovetype == fmAttack) {
|
if(forcedmovetype == fmAttack) {
|
||||||
if(monstersnear(cwt.at,moPlayer,NULL,cwt.at)) {
|
if(monstersnear(cwt.at,moPlayer,NULL,cwt.at)) {
|
||||||
changes.rollback();
|
if(vmsg()) wouldkill("%The1 would get you!");
|
||||||
if(errormsgs && !checkonly) wouldkill("%The1 would get you!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
nextmovetype = lmSkip;
|
nextmovetype = lmSkip;
|
||||||
addMessage(XLAT("You swing your sword at %the1.", c2->monst));
|
addMessage(XLAT("You swing your sword at %the1.", c2->monst));
|
||||||
return swing();
|
return swing();
|
||||||
}
|
}
|
||||||
tell_why_cannot_attack();
|
if(vmsg()) tell_why_cannot_attack();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,9 +928,7 @@ bool pcmove::attack() {
|
|||||||
swordAttackStatic();
|
swordAttackStatic();
|
||||||
|
|
||||||
if(monstersnear(cwt.at, moPlayer, nullptr, cwt.at)) {
|
if(monstersnear(cwt.at, moPlayer, nullptr, cwt.at)) {
|
||||||
changes.rollback();
|
if(vmsg()) wouldkill("You would be killed by %the1!");
|
||||||
if(errormsgs && !checkonly)
|
|
||||||
wouldkill("You would be killed by %the1!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(checkonly) return true;
|
if(checkonly) return true;
|
||||||
@ -1031,8 +1034,7 @@ bool pcmove::perform_move_or_jump() {
|
|||||||
if(mi.t->monst == moFriendlyIvy) changes.ccell(mi.t), mi.t->monst = moNone;
|
if(mi.t->monst == moFriendlyIvy) changes.ccell(mi.t), mi.t->monst = moNone;
|
||||||
|
|
||||||
if(monstersnear(cwt.at, moPlayer, nullptr, c1)) {
|
if(monstersnear(cwt.at, moPlayer, nullptr, c1)) {
|
||||||
changes.rollback();
|
if(vmsg()) wouldkill("%The1 would kill you there!");
|
||||||
if(errormsgs && !checkonly) wouldkill("%The1 would kill you there!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,9 +1068,7 @@ bool pcmove::stay() {
|
|||||||
swordAttackStatic();
|
swordAttackStatic();
|
||||||
nextmovetype = lmSkip;
|
nextmovetype = lmSkip;
|
||||||
if(monstersnear(cwt.at, moPlayer, nullptr, cwt.at)) {
|
if(monstersnear(cwt.at, moPlayer, nullptr, cwt.at)) {
|
||||||
changes.rollback();
|
if(vmsg()) wouldkill("%The1 would get you!");
|
||||||
if(errormsgs && !checkonly)
|
|
||||||
wouldkill("%The1 would get you!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(checkonly) return true;
|
if(checkonly) return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user