summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-23 12:41:31 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-23 14:27:38 +0100
commitd4b04e4f4454ecb64b51f93589278af198ce2ae6 (patch)
treed12267423825b7f7a63284b54e926e4b07960a51 /crawl-ref/source/directn.cc
parent0eaa5344bbc3b6c1d27acc08b62bfbefefb3770e (diff)
downloadcrawl-ref-d4b04e4f4454ecb64b51f93589278af198ce2ae6.tar.gz
crawl-ref-d4b04e4f4454ecb64b51f93589278af198ce2ae6.zip
Extract target mode description.
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r--crawl-ref/source/directn.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 7545738668..37b138ca70 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -974,6 +974,23 @@ static bool _blocked_ray(const coord_def &where,
return (true);
}
+std::string _targ_mode_name(targ_mode_type mode)
+{
+ switch (mode)
+ {
+ case TARG_ANY:
+ return ("any");
+ case TARG_ENEMY:
+ return ("enemies");
+ case TARG_FRIEND:
+ return ("friends");
+ case TARG_HOSTILE:
+ return ("hostiles");
+ default:
+ return ("buggy");
+ }
+}
+
void direction(dist& moves, targetting_type restricts,
targ_mode_type mode, int range, bool just_looking,
bool needs_path, bool may_target_monster,
@@ -1347,11 +1364,7 @@ void direction(dist& moves, targetting_type restricts,
case CMD_TARGET_CYCLE_TARGET_MODE:
mode = static_cast<targ_mode_type>((mode + 1) % TARG_NUM_MODES);
- mprf("targetting mode is now: %s",
- (mode == TARG_ANY) ? "any" :
- (mode == TARG_ENEMY) ? "enemies" :
- (mode == TARG_HOSTILE) ? "hostiles"
- : "friends");
+ mprf("targetting mode is now: %s", _targ_mode_name(mode).c_str());
break;
case CMD_TARGET_PREV_TARGET: