mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-06-14 09:26:52 +00:00
simplified the boat logic
This commit is contained in:
parent
4d761385ac
commit
9807b1b3ba
|
@ -420,6 +420,8 @@ EX bool canPushStatueOn(cell *c, flagtype flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void moveBoat(const movei& mi) {
|
EX void moveBoat(const movei& mi) {
|
||||||
|
changes.ccell(mi.t);
|
||||||
|
changes.ccell(mi.s);
|
||||||
eWall x = mi.t->wall; mi.t->wall = mi.s->wall; mi.s->wall = x;
|
eWall x = mi.t->wall; mi.t->wall = mi.s->wall; mi.s->wall = x;
|
||||||
mi.t->mondir = mi.rev_dir_or(NODIR);
|
mi.t->mondir = mi.rev_dir_or(NODIR);
|
||||||
moveItem(mi.s, mi.t, false);
|
moveItem(mi.s, mi.t, false);
|
||||||
|
|
18
pcmove.cpp
18
pcmove.cpp
|
@ -214,6 +214,7 @@ struct pcmove {
|
||||||
bool fmsMove, fmsAttack, fmsActivate;
|
bool fmsMove, fmsAttack, fmsActivate;
|
||||||
int d;
|
int d;
|
||||||
int subdir;
|
int subdir;
|
||||||
|
/** used to tell perform_actual_move() that this is a boat move and thus we should not pick up items */
|
||||||
bool boatmove;
|
bool boatmove;
|
||||||
bool good_tortoise;
|
bool good_tortoise;
|
||||||
flagtype attackflags;
|
flagtype attackflags;
|
||||||
|
@ -844,13 +845,10 @@ bool pcmove::actual_move() {
|
||||||
return boat_move();
|
return boat_move();
|
||||||
|
|
||||||
if(!c2->monst && cwt.at->wall == waBoat && cwt.at->item != itOrbYendor && boatGoesThrough(c2) && markOrb(itOrbWater) && !nonAdjacentPlayer(c2, cwt.at) && fmsMove) {
|
if(!c2->monst && cwt.at->wall == waBoat && cwt.at->item != itOrbYendor && boatGoesThrough(c2) && markOrb(itOrbWater) && !nonAdjacentPlayer(c2, cwt.at) && fmsMove) {
|
||||||
|
if(c2->item && collectItem(c2, cwt.at)) return true;
|
||||||
if(c2->item && !cwt.at->item) moveItem(c2, cwt.at, false), boatmove = true;
|
|
||||||
placeWater(c2, cwt.at);
|
|
||||||
moveBoat(mi);
|
|
||||||
changes.ccell(c2);
|
changes.ccell(c2);
|
||||||
c2->mondir = revhint(cwt.at, d);
|
placeWater(c2, cwt.at);
|
||||||
if(c2->item) boatmove = !boatmove;
|
moveBoat(mi); boatmove = true;
|
||||||
return perform_actual_move();
|
return perform_actual_move();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,14 +1298,6 @@ bool pcmove::perform_actual_move() {
|
||||||
movecost(cwt.at, c2, 1);
|
movecost(cwt.at, c2, 1);
|
||||||
|
|
||||||
if(!boatmove && collectItem(c2, cwt.at)) return true;
|
if(!boatmove && collectItem(c2, cwt.at)) return true;
|
||||||
if(boatmove && c2->item && cwt.at->item) {
|
|
||||||
eItem it = c2->item;
|
|
||||||
c2->item = cwt.at->item;
|
|
||||||
if(collectItem(c2, cwt.at)) return true;
|
|
||||||
eItem it2 = c2->item;
|
|
||||||
c2->item = it;
|
|
||||||
cwt.at->item = it2;
|
|
||||||
}
|
|
||||||
if(doPickupItemsWithMagnetism(c2)) return true;
|
if(doPickupItemsWithMagnetism(c2)) return true;
|
||||||
|
|
||||||
if(isIcyLand(cwt.at) && cwt.at->wall == waNone && markOrb(itOrbWinter)) {
|
if(isIcyLand(cwt.at) && cwt.at->wall == waNone && markOrb(itOrbWinter)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user