diff options
-rw-r--r-- | crawl-ref/source/actor.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/actor.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/arena.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-act.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/player.h | 4 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/terrain.cc | 8 |
13 files changed, 32 insertions, 26 deletions
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc index 97aa4f928d..83dcc799aa 100644 --- a/crawl-ref/source/actor.cc +++ b/crawl-ref/source/actor.cc @@ -109,3 +109,8 @@ bool actor::check_res_magic(int power) return (mrch2 < mrchance); } + +void actor::set_position(const coord_def &c) +{ + position = c; +} diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h index 13bc372f4b..b48945847d 100644 --- a/crawl-ref/source/actor.h +++ b/crawl-ref/source/actor.h @@ -19,8 +19,8 @@ public: int* summon_type = NULL) const = 0; virtual void moveto(const coord_def &c) = 0; + virtual void set_position(const coord_def &c); virtual const coord_def& pos() const { return position; } - virtual coord_def& pos() { return position; } virtual bool swimming() const = 0; virtual bool submerged() const = 0; diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index 902407591f..36da169eef 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -866,7 +866,7 @@ namespace arena viewwindow(true, false); unwind_var<coord_def> pos(you.position); // Move hero offscreen. - you.position.y = -1; + you.set_position(coord_def(-1,-1)); you.time_taken = 10; // Make sure we don't starve. you.hunger = 10999; diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 7b19cec67d..99de0ee816 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -734,7 +734,7 @@ bool _take_portal_vault_stairs( const bool down ) return (false); clear_trapping_net(); - you.position = stair_pos; + you.set_position(stair_pos); if (down) down_stairs(you.your_level); diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 0c6c0648f9..c901f06690 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -151,8 +151,8 @@ static bool _swap_monsters(monsters* mover, monsters* moved) const coord_def mover_pos = mover->pos(); const coord_def moved_pos = moved->pos(); - mover->pos() = moved_pos; - moved->pos() = mover_pos; + mover->set_position(moved_pos); + moved->set_position(mover_pos); mgrd(mover->pos()) = mover->mindex(); mgrd(moved->pos()) = moved->mindex(); @@ -3027,9 +3027,9 @@ static bool _monster_swaps_places( monsters *mon, const coord_def& delta ) // Okay, do the swap! _swim_or_move_energy(mon); - mon->pos() = n; + mon->set_position(n); mgrd(n) = monster_index(mon); - m2->pos() = c; + m2->set_position(c); const int m2i = monster_index(m2); ASSERT(m2i >= 0 && m2i < MAX_MONSTERS); mgrd(c) = m2i; @@ -3091,7 +3091,7 @@ static bool _do_move_monster(monsters *monster, const coord_def& delta) } mgrd(monster->pos()) = NON_MONSTER; - monster->pos() = f; + monster->set_position(f); mgrd(monster->pos()) = monster_index(monster); diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 6c584297b3..28f44c2c7b 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2630,7 +2630,7 @@ void monsters::moveto(const coord_def& c) if (c != pos() && in_bounds(pos())) mons_clear_trapping_net(this); - position = c; + set_position(c); } bool monsters::fumbles_attack(bool verbose) @@ -4845,7 +4845,7 @@ void monsters::apply_enchantment(const mon_enchant &me) // If you are no longer dying, you must be dead. if (decay_enchantment(me)) { - if (::see_cell(this->position)) + if (::see_cell(position)) { mprf("A nearby %s withers and dies.", this->name(DESC_PLAIN, false).c_str()); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 15c3bfd9ee..9c2b3de63f 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1143,7 +1143,7 @@ static bool _spore_goes_pop(monsters *monster, killer_type killer, // used to be, so make sure that mgrd() doesn't get cleared a second // time (causing the new monster to become floating) when // monster->reset() is called. - monster->pos().reset(); + monster->set_position(coord_def(0,0)); // Exploding kills the monster a bit earlier than normal. monster->hit_points = -16; @@ -3764,7 +3764,7 @@ int clone_mons(const monsters* orig, bool quiet, bool* obvious, monsters &mon(menv[midx]); mon = *orig; - mon.position = pos; + mon.set_position(pos); mgrd(pos) = midx; // Duplicate objects, or unequip them if they can't be duplicated. diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 43b57b5886..abd9b69748 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -7008,12 +7008,12 @@ bool player::is_fiery() const return (false); } -void player::base_moveto(const coord_def &c) +void player::set_position(const coord_def &c) { ASSERT(!crawl_state.arena); const bool real_move = (c != pos()); - position = c; + actor::set_position(c); if (real_move) { @@ -7032,13 +7032,13 @@ void player::moveto(const coord_def &c) clear_trapping_net(); crawl_view.set_player_at(c); - base_moveto(c); + set_position(c); } void player::shiftto(const coord_def &c) { crawl_view.shift_player_to(c); - base_moveto(c); + set_position(c); } void player::reset_prev_move() diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 29f4102bb1..7e8fa551b8 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -300,6 +300,8 @@ public: void init(); + // Set player position without updating view geometry. + void set_position(const coord_def &c); // Low-level move the player. Use this instead of changing pos directly. void moveto(const coord_def &c); // Move the player during an abyss shift. @@ -505,8 +507,6 @@ public: void set_gold(int amount); protected: - void base_moveto(const coord_def &c); - void _removed_beholder(); bool _possible_beholder(const monsters *mon) const; }; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index e68cdf3b7e..f0984b4607 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2628,7 +2628,7 @@ void god_speaks(god_type god, const char *mesg) fake_mon.type = MONS_PROGRAM_BUG; fake_mon.hit_points = 1; fake_mon.god = god; - fake_mon.position = you.pos(); + fake_mon.set_position(you.pos()); fake_mon.foe = MHITYOU; fake_mon.mname = "FAKE GOD MONSTER"; diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index bc2b9a6bb6..35e26beef7 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1069,7 +1069,7 @@ static void _try_monster_cast(spell_type spell, int powc, | MF_WAS_IN_VIEW | MF_HARD_RESET); mon->hit_points = you.hp; mon->hit_dice = you.experience_level; - mon->pos() = you.pos(); + mon->set_position(you.pos()); mon->target = spd.target; if (!spd.isTarget) diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index f65421e5a1..0d140664e5 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -2186,8 +2186,9 @@ static void unmarshall_monster(reader &th, monsters &m) // Avoid sign extension when loading files (Elethiomel's hang) m.speed_increment = (unsigned char) unmarshallByte(th); m.behaviour = static_cast<beh_type>(unmarshallByte(th)); - m.position.x = unmarshallByte(th); - m.position.y = unmarshallByte(th); + int x = unmarshallByte(th); + int y = unmarshallByte(th); + m.set_position(coord_def(x,y)); m.target.x = unmarshallByte(th); m.target.y = unmarshallByte(th); diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index e7f9458985..75b60c41c0 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -959,9 +959,9 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, mgrd(pos2) = m1; if (monster_at(pos1)) - menv[mgrd(pos1)].position = pos1; + menv[mgrd(pos1)].set_position(pos1); if (monster_at(pos2)) - menv[mgrd(pos2)].position = pos2; + menv[mgrd(pos2)].set_position(pos2); // Swap clouds. move_cloud(env.cgrid(pos1), temp); @@ -970,12 +970,12 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (pos1 == you.pos()) { - you.position = pos2; + you.set_position(pos2); viewwindow(true, false); } else if (pos2 == you.pos()) { - you.position = pos1; + you.set_position(pos1); viewwindow(true, false); } |