Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef WB_HIGHLIGHT_VISITOR_HPP_
00021 #define WB_HIGHLIGHT_VISITOR_HPP_
00022
00023 #include "visitor.hpp"
00024
00025 static lg::log_domain log_whiteboard_highlight("whiteboard/highlight");
00026 #define ERR_WB_H LOG_STREAM(err, log_whiteboard_highlight)
00027 #define WRN_WB_H LOG_STREAM(warn, log_whiteboard_highlight)
00028 #define LOG_WB_H LOG_STREAM(info, log_whiteboard_highlight)
00029 #define DBG_WB_H LOG_STREAM(debug, log_whiteboard_highlight)
00030
00031 namespace wb
00032 {
00033
00034
00035
00036
00037
00038 class highlight_visitor
00039 : private visitor
00040 , private enable_visit_all<highlight_visitor>
00041 {
00042 friend class enable_visit_all<highlight_visitor>;
00043
00044 public:
00045 highlight_visitor(unit_map& unit_map, side_actions_ptr side_actions);
00046 virtual ~highlight_visitor();
00047
00048 void set_mouseover_hex(const map_location& hex);
00049 const map_location& get_mouseover_hex() const {return mouseover_hex_; }
00050
00051 void highlight();
00052 void clear();
00053
00054 action_ptr get_execute_target();
00055 action_ptr get_delete_target();
00056 action_ptr get_bump_target();
00057 unit* get_selection_target();
00058
00059
00060 weak_action_ptr get_main_highlight() { return main_highlight_; }
00061 typedef std::deque<weak_action_ptr> secondary_highlights_t;
00062
00063 secondary_highlights_t get_secondary_highlights() { return secondary_highlights_; }
00064
00065 private:
00066 virtual void visit(move_ptr move);
00067 virtual void visit(attack_ptr attack);
00068 virtual void visit(recruit_ptr recruit);
00069 virtual void visit(recall_ptr recall);
00070 virtual void visit(suppose_dead_ptr sup_d);
00071
00072
00073 bool process(size_t team_index, team&, side_actions&, side_actions::iterator);
00074
00075 void unhighlight();
00076
00077 void find_main_highlight();
00078 void find_secondary_highlights();
00079
00080 enum mode {
00081 FIND_MAIN_HIGHLIGHT,
00082 FIND_SECONDARY_HIGHLIGHTS,
00083 HIGHLIGHT_MAIN,
00084 HIGHLIGHT_SECONDARY,
00085 UNHIGHLIGHT_MAIN,
00086 UNHIGHLIGHT_SECONDARY,
00087 NONE
00088 };
00089
00090 mode mode_;
00091
00092 unit_map& unit_map_;
00093
00094 map_location mouseover_hex_;
00095 std::set<map_location> exclusive_display_hexes_;
00096 unit* owner_unit_;
00097 unit* selection_candidate_;
00098
00099 weak_action_ptr selected_action_;
00100 weak_action_ptr main_highlight_;
00101 secondary_highlights_t secondary_highlights_;
00102
00103 side_actions_ptr side_actions_;
00104 };
00105
00106 }
00107
00108 #endif