summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/directn.h
diff options
context:
space:
mode:
authorHaran Pilpel <haranp@users.sourceforge.net>2010-01-27 23:11:36 +0200
committerHaran Pilpel <haranp@users.sourceforge.net>2010-01-27 23:12:23 +0200
commit6dcca1f3722e91433d671434e66993498af86401 (patch)
treec763fa046a1db208bb14764ccfd5a8b09d804727 /crawl-ref/source/directn.h
parent3051ff277d27eba6b918aeadf0cca0dc3448adc5 (diff)
downloadcrawl-ref-6dcca1f3722e91433d671434e66993498af86401.tar.gz
crawl-ref-6dcca1f3722e91433d671434e66993498af86401.zip
Add a direction_chooser_args struct which wraps the gazillion options
to direction(). Could still be cleaner.
Diffstat (limited to 'crawl-ref/source/directn.h')
-rw-r--r--crawl-ref/source/directn.h49
1 files changed, 29 insertions, 20 deletions
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index 49cf9e3097..4648fa65d4 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -66,22 +66,37 @@ public:
ray_def ray; // ray chosen if necessary
};
+struct direction_chooser_args
+{
+ targetting_type restricts;
+ targ_mode_type mode;
+ int range;
+ bool just_looking;
+ bool needs_path;
+ bool may_target_monster;
+ bool may_target_self;
+ const char *target_prefix;
+ std::string top_prompt;
+ targetting_behaviour *behaviour;
+ bool cancel_at_self;
+
+ direction_chooser_args() :
+ restricts(DIR_NONE),
+ mode(TARG_ANY),
+ range(-1),
+ just_looking(false),
+ needs_path(true),
+ may_target_monster(true),
+ may_target_self(false),
+ target_prefix(NULL),
+ behaviour(NULL),
+ cancel_at_self(false) {}
+};
+
class direction_chooser
{
public:
- // FIXME: wrap all these parameters in a struct.
- direction_chooser(dist& moves_,
- targetting_type restricts_,
- targ_mode_type mode_,
- int range_,
- bool just_looking_,
- bool needs_path_,
- bool may_target_monster_,
- bool may_target_self_,
- const char *target_prefix_,
- const std::string& top_prompt_,
- targetting_behaviour *mod_,
- bool cancel_at_self_);
+ direction_chooser(dist& moves, const direction_chooser_args& args);
bool choose_direction();
private:
@@ -227,13 +242,7 @@ private:
};
-void direction(dist &moves, targetting_type restricts = DIR_NONE,
- targ_mode_type mode = TARG_ANY, int range = -1,
- bool just_looking = false, bool needs_path = true,
- bool may_target_monster = true, bool may_target_self = false,
- const char *target_prefix = NULL,
- const char *top_prompt = NULL,
- targetting_behaviour *mod = NULL, bool cancel_at_self = false);
+void direction(dist &moves, const direction_chooser_args& args);
bool in_los_bounds(const coord_def& p);
bool in_viewport_bounds(int x, int y);