summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.h
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/directn.h
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/directn.h')
-rw-r--r--crawl-ref/source/directn.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index b4f1811161..3fa688e27f 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -128,23 +128,16 @@ struct dist
{
bool isValid; // valid target chosen?
bool isTarget; // target (true), or direction (false)?
- bool isMe; // selected self (convenience: tx == you.x_pos,
- // ty == you.y_pos)
- bool isEndpoint; // Does the player want the attack to stop at (tx,ty)?
+ bool isMe; // selected self (convenience: target == you.pos())
+ bool isEndpoint; // Does the player want the attack to stop at target?
bool isCancel; // user cancelled (usually <ESC> key)
bool choseRay; // user wants a specific beam
- int tx,ty; // target x,y or logical extension of beam to map edge
- int dx,dy; // delta x and y if direction - always -1,0,1
+ coord_def target; // target x,y or logical extension of beam to map edge
+ coord_def delta; // delta x and y if direction - always -1,0,1
ray_def ray; // ray chosen if necessary
// internal use - ignore
int prev_target; // previous target
-
- // target - source (source == you.pos())
- coord_def target() const
- {
- return coord_def(tx, ty);
- }
};
void direction( dist &moves, targeting_type restricts = DIR_NONE,
@@ -156,6 +149,9 @@ void direction( dist &moves, targeting_type restricts = DIR_NONE,
bool in_los_bounds(const coord_def& p);
bool in_viewport_bounds(int x, int y);
+inline bool in_viewport_bounds(const coord_def& pos) {
+ return in_viewport_bounds(pos.x, pos.y);
+}
bool in_los(int x, int y);
bool in_los(const coord_def &pos);
bool in_vlos(int x, int y);