27 #define ERR_ARR LOG_STREAM(err, log_arrows)
28 #define WRN_ARR LOG_STREAM(warn, log_arrows)
29 #define LOG_ARR LOG_STREAM(info, log_arrows)
30 #define DBG_ARR LOG_STREAM(debug, log_arrows)
34 , style_(STYLE_STANDARD)
58 disp->remove_arrow(*
this);
70 disp->add_arrow(*
this);
149 return (
path.size() >= 2);
156 WRN_ARR <<
"arrow::update_symbols called with invalid path";
163 const std::string mods =
"~RC(FF00FF>"+
color_ +
")";
165 const std::string dirname =
"arrows/";
166 std::string prefix =
"";
167 std::string suffix =
"";
168 std::string image_filename =
"";
169 arrow_path_t::const_iterator
const arrow_start_hex =
path_.begin();
170 arrow_path_t::const_iterator
const arrow_pre_end_hex =
path_.end() - 2;
171 arrow_path_t::const_iterator
const arrow_end_hex =
path_.end() - 1;
172 bool teleport_out =
false;
175 for (hex =
path_.begin(); hex !=
path_.end(); ++hex)
181 bool pre_end =
false;
185 bool teleport_in = teleport_out;
186 teleport_out =
false;
189 if (hex == arrow_start_hex)
191 if (hex == arrow_pre_end_hex)
193 else if (hex == arrow_end_hex)
200 if (!
start && !teleport_in)
202 enter_dir = hex->get_relative_dir(*(hex-1));
205 if (!end && !teleport_out)
207 exit_dir = hex->get_relative_dir(*(hex+1));
213 prefix =
"teleport-out";
219 else if (teleport_in)
221 prefix =
"teleport-in";
233 suffix = suffix +
"_ending";
243 std::string enter, exit;
248 exit = exit +
"_ending";
252 if (enter_dir < exit_dir)
264 image_filename = dirname +
style_ +
"/" + prefix;
267 image_filename += (
"-" + suffix);
269 image_filename +=
".png";
270 assert(!image_filename.empty());
275 ERR_ARR <<
"Image " << image_filename <<
" not found.";
286 disp->invalidate(loc);
294 disp->update_arrow(*
this);
static lg::log_domain log_arrows("arrows")
Arrows destined to be drawn on the map.
std::vector< map_location > arrow_path_t
static void invalidate_arrow_path(const arrow_path_t &path)
Invalidates every hex along the given path.
static const std::string STYLE_FOCUS_INVALID
void hide()
Sets the arrow's visibility.
void set_style(const std::string &style)
arrow_path_t previous_path_
static const std::string STYLE_FOCUS
bool path_contains(const map_location &hex) const
void reset()
invalidates and clears the present path, forgets the previous path, clears the symbols map
static const std::string STYLE_STANDARD
If you add more styles, you should look at move::update_arrow_style()
static const std::string STYLE_HIGHLIGHTED
std::string style_
represents the subdirectory that holds images for this arrow style
void update_symbols()
Calculate the symbols to place along the arrow path.
const arrow_path_t & get_previous_path() const
void notify_arrow_changed()
arrow(const arrow &)=delete
const arrow_path_t & get_path() const
void set_path(const arrow_path_t &path)
arrow_symbols_map_t symbols_map_
image::locator get_image_for_loc(const map_location &hex) const
void set_color(const std::string &color)
The string color parameter is in the same format expected by the image::locator modifiers parameter.
static bool valid_path(const arrow_path_t &path)
Checks that the path is not of length 0 or 1.
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
static display * get_singleton()
Returns the display object if a display object exists.
Generic locator abstracting the location of an image.
Drawing functions, for drawing things on the screen.
bool tiles_adjacent(const map_location &a, const map_location &b)
Function which tells if two locations are adjacent.
Standard logging facilities (interface).
EXIT_STATUS start(bool clear_id, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
Functions to load and save images from/to disk.
bool exists(const image::locator &i_locator)
Returns true if the given image actually exists, without loading it.
bool contains(const Container &container, const Value &value)
Returns true iff value is found in container.
std::string::const_iterator iterator
Encapsulates the map of the game.
static std::string write_direction(direction dir)
direction
Valid directions which can be moved in our hexagonal world.