diff options
author | Florian Diebold <flodiebold@gmail.com> | 2011-11-08 15:04:20 +0100 |
---|---|---|
committer | Florian Diebold <flodiebold@gmail.com> | 2011-11-23 19:07:21 +0100 |
commit | b38b2bf7aa85e2dd0c90d46a4cbe36f2417ce4ec (patch) | |
tree | d114710cea5c45ba0146508ab7d414a7969a673e /crawl-ref/source/tilereg-mon.cc | |
parent | 6f45b76da0b15a4b77ed0d56a4feaa2002d3d185 (diff) | |
download | crawl-ref-b38b2bf7aa85e2dd0c90d46a4cbe36f2417ce4ec.tar.gz crawl-ref-b38b2bf7aa85e2dd0c90d46a4cbe36f2417ce4ec.zip |
Use monster_info in the Tiles monster region.
All that was needed there was the monster's position, anyway.
Diffstat (limited to 'crawl-ref/source/tilereg-mon.cc')
-rw-r--r-- | crawl-ref/source/tilereg-mon.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/crawl-ref/source/tilereg-mon.cc b/crawl-ref/source/tilereg-mon.cc index b9b05cd2cd..75f12d9568 100644 --- a/crawl-ref/source/tilereg-mon.cc +++ b/crawl-ref/source/tilereg-mon.cc @@ -6,6 +6,7 @@ #include "tilereg-mon.h" #include "cio.h" +#include "coord.h" #include "directn.h" #include "env.h" #include "libutil.h" @@ -65,11 +66,11 @@ int MonsterRegion::handle_mouse(MouseEvent &event) unsigned int item_idx = cursor_index(); - const monster* mon = get_monster(item_idx); + const monster_info* mon = get_monster(item_idx); if (!mon) return (0); - const coord_def &gc = mon->position; + const coord_def &gc = player2grid(mon->pos); tiles.place_cursor(CURSOR_MOUSE, gc); if (event.event != MouseEvent::PRESS) @@ -96,11 +97,11 @@ bool MonsterRegion::update_tip_text(std::string &tip) return (false); unsigned int item_idx = cursor_index(); - const monster* mon = get_monster(item_idx); + const monster_info* mon = get_monster(item_idx); if (!mon) return (false); - return (tile_dungeon_tip(mon->position, tip)); + return (tile_dungeon_tip(player2grid(mon->pos), tip)); } bool MonsterRegion::update_tab_tip_text(std::string &tip, bool active) @@ -120,11 +121,11 @@ bool MonsterRegion::update_alt_text(std::string &alt) return (false); } - const monster* mon = get_monster(item_idx); + const monster_info* mon = get_monster(item_idx); if (!mon) return (false); - const coord_def &gc = mon->position; + const coord_def &gc = player2grid(mon->pos); describe_info inf; if (!you.see_cell(gc)) @@ -140,7 +141,7 @@ bool MonsterRegion::update_alt_text(std::string &alt) return (true); } -const monster* MonsterRegion::get_monster(unsigned int idx) const +const monster_info* MonsterRegion::get_monster(unsigned int idx) const { if (idx >= m_items.size()) return (NULL); @@ -149,7 +150,7 @@ const monster* MonsterRegion::get_monster(unsigned int idx) const if (item.idx >= static_cast<int>(m_mon_info.size())) return (NULL); - return (m_mon_info[item.idx].mon()); + return &(m_mon_info[item.idx]); } void MonsterRegion::pack_buffers() @@ -165,10 +166,10 @@ void MonsterRegion::pack_buffers() bool cursor = (i < m_items.size()) ? (m_items[i].flag & TILEI_FLAG_CURSOR) : false; - const monster* mon = get_monster(i++); + const monster_info* mon = get_monster(i++); if (mon) { - const coord_def gc = mon->position; + const coord_def gc = player2grid(mon->pos); const coord_def ep = grid2show(gc); if (crawl_view.in_los_bounds_g(gc)) @@ -207,11 +208,11 @@ void MonsterRegion::draw_tag() if (idx == -1) return; - const monster* mon = get_monster(idx); + const monster_info* mon = get_monster(idx); if (!mon) return; - std::string desc = mon->name(DESC_A); + std::string desc = mon->proper_name(DESC_A); draw_desc(desc.c_str()); } |