diff options
-rw-r--r-- | crawl-ref/source/travel.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/travel.h | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 079b4a877d..f7d1a5ab5b 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -2934,6 +2934,11 @@ void level_id::load(reader& inf) level_type = static_cast<level_area_type>(unmarshallShort(inf)); } +level_pos level_pos::current() +{ + return level_pos(level_id::current(), you.pos()); +} + // NOTE: see also marshall_level_pos void level_pos::save(writer& outf) const { diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 3dcf059577..dde4ce08fc 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -197,6 +197,9 @@ struct level_pos pos.x = pos.y = -1; } + // Returns the level_pos of where the player is standing. + static level_pos current(); + bool operator == ( const level_pos &lp ) const { return id == lp.id && pos == lp.pos; @@ -217,6 +220,11 @@ struct level_pos return id.depth > -1 && pos.x != -1 && pos.y != -1; } + bool is_on( const level_id _id) + { + return id == _id; + } + void clear() { id.clear(); |