summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 10:53:06 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-30 10:53:06 +0000
commit262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f (patch)
tree681a9cbb6c22669c6e8b7ab749228a3cd691a903 /crawl-ref/source/player.cc
parent51d8f1fc9cc8ed4280b9c53b135ccb0521e84889 (diff)
downloadcrawl-ref-262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f.tar.gz
crawl-ref-262b8e18ed8cb58afb40a816ac0fdedfe3a7db5f.zip
Massive overhaul to move towards coord_def().
This might have introduced some bugs: I now get intermittent crashes on startup (this might have to do with the changes to special_room.) Sorry about that - committing before I need to do any more big conflict resolutions. Fixes coming later. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6732 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc31
1 files changed, 8 insertions, 23 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 3b5e0d7d7d..668adb2e5a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -326,7 +326,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift,
const dungeon_feature_type type =
trap_category( env.trap[id].type );
grd(you.pos()) = type;
- set_envmap_obj(you.x_pos, you.y_pos, type);
+ set_envmap_obj(you.pos(), type);
}
// It's not easy to blink onto a trap without setting it off.
@@ -5547,12 +5547,9 @@ void player::init()
prev_targ = MHITNOT;
pet_target = MHITNOT;
- prev_grd_targ = coord_def(0, 0);
-
- x_pos = 0;
- y_pos = 0;
-
- prev_move = coord_def(0,0);
+ prev_grd_targ.reset();
+ position.reset();
+ prev_move.reset();
running.clear();
travel_x = 0;
@@ -5608,8 +5605,7 @@ void player::init()
inv[i].colour = 0;
set_ident_flags( inv[i], ISFLAG_IDENT_MASK );
- inv[i].x = -1;
- inv[i].y = -1;
+ inv[i].pos.set(-1, -1);
inv[i].link = i;
}
@@ -5677,11 +5673,6 @@ player::~player()
delete m_quiver;
}
-coord_def player::pos() const
-{
- return coord_def(x_pos, y_pos);
-}
-
bool player::is_levitating() const
{
return (duration[DUR_LEVITATION]);
@@ -5690,7 +5681,7 @@ bool player::is_levitating() const
bool player::in_water() const
{
return (!airborne() && !beogh_water_walk()
- && grid_is_water(grd[you.x_pos][you.y_pos]));
+ && grid_is_water(grd(you.pos())));
}
bool player::can_swim() const
@@ -6702,16 +6693,10 @@ bool player::is_icy() const
return (attribute[ATTR_TRANSFORMATION] == TRAN_ICE_BEAST);
}
-void player::moveto(int x, int y)
-{
- moveto(coord_def(x, y));
-}
-
void player::moveto(const coord_def &c)
{
const bool real_move = (c != pos());
- x_pos = c.x;
- y_pos = c.y;
+ position = c;
crawl_view.set_player_at(c);
if (real_move)
@@ -7011,7 +6996,7 @@ bool player::do_shaft()
// the player isn't standing over a shaft.
if (trap_type_at_xy(this->pos()) != TRAP_SHAFT)
{
- switch(grd[x_pos][y_pos])
+ switch (grd(you.pos()))
{
case DNGN_FLOOR:
case DNGN_OPEN_DOOR: