diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-06 19:12:55 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-06 19:16:20 +0100 |
commit | f626e442c7a77191a145825507610d3b1ef40ab3 (patch) | |
tree | ebdcf660d3c1dd058c19419cb5983568733d4b04 /crawl-ref/source/mon-act.cc | |
parent | 4412160c9f7d6410f7974e6daf1027716547cceb (diff) | |
download | crawl-ref-f626e442c7a77191a145825507610d3b1ef40ab3.tar.gz crawl-ref-f626e442c7a77191a145825507610d3b1ef40ab3.zip |
Add actor::set_position.
This should be used instead of setting position directly.
actor::position could be made "protected" except for the arena's
unwind_var(you.position), which is too difficult for me to fix.
The reason behind this change is that actors should get their
own LOS, whose origin should be synchronized with the actor's
position.
This change also removes the non-const "coord_def& actor::pos()" (yuk).
Diffstat (limited to 'crawl-ref/source/mon-act.cc')
-rw-r--r-- | crawl-ref/source/mon-act.cc | 10 |
1 files changed, 5 insertions, 5 deletions
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); |