From d4b04e4f4454ecb64b51f93589278af198ce2ae6 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Mon, 23 Nov 2009 12:41:31 +0100 Subject: Extract target mode description. --- crawl-ref/source/directn.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/directn.cc') 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((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: -- cgit v1.2.3-54-g00ecf