summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-03 17:06:22 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-03 17:06:22 +0000
commit2d1dc73ba81562198242670c328146d3f13695c6 (patch)
tree6526769c27f00c87d81ac2dd552c9e0bd1f7b7c0 /crawl-ref/source/menu.cc
parent20e25439cad6e0c97716e197bb2dceae731a9d24 (diff)
downloadcrawl-ref-2d1dc73ba81562198242670c328146d3f13695c6.tar.gz
crawl-ref-2d1dc73ba81562198242670c328146d3f13695c6.zip
* Allow fleeing monster to push past higher ranked monsters of the same
type. * Allow quivering of wielded missiles (stones for Sandblast etc.) and wielded weapons of returning if your throwing skill is > 0. * Add stairs/gates/shops to the 'V' command, mostly for the convenience of the easy travel feature. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9574 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc35
1 files changed, 30 insertions, 5 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 67af41fd61..d39d1080c6 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -20,7 +20,11 @@ REVISION("$Rev$");
#include "mon-util.h"
#endif
#include "player.h"
-#include "tiles.h"
+#ifdef USE_TILE
+ #include "stuff.h"
+ #include "tiles.h"
+ #include "travel.h"
+#endif
#include "tutorial.h"
#include "view.h"
#include "initfile.h"
@@ -692,10 +696,17 @@ MonsterMenuEntry::MonsterMenuEntry(const std::string &str, const monsters* mon,
quantity = 1;
}
+FeatureMenuEntry::FeatureMenuEntry(const std::string &str, const coord_def p, int hotkey) :
+ MenuEntry(str, MEL_ITEM, 1, hotkey)
+{
+ pos = p;
+ quantity = 1;
+}
+
#ifdef USE_TILE
bool MenuEntry::get_tiles(std::vector<tile_def>& tileset) const
{
- return false;
+ return (false);
}
bool MonsterMenuEntry::get_tiles(std::vector<tile_def>& tileset) const
@@ -781,6 +792,19 @@ bool MonsterMenuEntry::get_tiles(std::vector<tile_def>& tileset) const
return (true);
}
+
+bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const
+{
+ if (!in_bounds(pos))
+ return (false);
+
+ tileset.push_back(tile_def(tileidx_feature(grd(pos), pos.x, pos.y),
+ TEX_DUNGEON));
+ if (is_travelable_stair(grd(pos)) && !travel_cache.know_stair(pos))
+ tileset.push_back(tile_def(TILE_NEW_STAIR, TEX_DEFAULT));
+
+ return (true);
+}
#endif
bool Menu::is_selectable(int item) const
@@ -1505,11 +1529,12 @@ formatted_scroller::formatted_scroller(int _flags, const std::string& s) :
void formatted_scroller::add_text(const std::string& s)
{
size_t eolpos = 0;
- while ( true )
+ while (true)
{
const size_t newpos = s.find( "\n", eolpos );
- add_item_formatted_string(formatted_string::parse_string(std::string(s, eolpos, newpos-eolpos)));
- if ( newpos == std::string::npos )
+ add_item_formatted_string(formatted_string::parse_string(
+ std::string(s, eolpos, newpos-eolpos)));
+ if (newpos == std::string::npos)
break;
else
eolpos = newpos + 1;