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)
35 , style_(STYLE_STANDARD)
59 disp->remove_arrow(*
this);
71 disp->add_arrow(*
this);
150 return (
path.size() >= 2);
157 WRN_ARR <<
"arrow::update_symbols called with invalid path";
164 const std::string mods =
"~RC(FF00FF>"+
color_ +
")";
166 const std::string dirname =
"arrows/";
167 std::string prefix =
"";
168 std::string suffix =
"";
169 std::string image_filename =
"";
170 arrow_path_t::const_iterator
const arrow_start_hex =
path_.begin();
171 arrow_path_t::const_iterator
const arrow_pre_end_hex =
path_.end() - 2;
172 arrow_path_t::const_iterator
const arrow_end_hex =
path_.end() - 1;
173 bool teleport_out =
false;
176 for (hex =
path_.begin(); hex !=
path_.end(); ++hex)
182 bool pre_end =
false;
186 bool teleport_in = teleport_out;
187 teleport_out =
false;
190 if (hex == arrow_start_hex)
192 if (hex == arrow_pre_end_hex)
194 else if (hex == arrow_end_hex)
201 if (!
start && !teleport_in)
203 enter_dir = hex->get_relative_dir(*(hex-1));
206 if (!end && !teleport_out)
208 exit_dir = hex->get_relative_dir(*(hex+1));
214 prefix =
"teleport-out";
220 else if (teleport_in)
222 prefix =
"teleport-in";
234 suffix = suffix +
"_ending";
244 std::string enter, exit;
249 exit = exit +
"_ending";
252 assert(std::abs(enter_dir - exit_dir) > 1);
253 if (enter_dir < exit_dir)
265 image_filename = dirname +
style_ +
"/" + prefix;
268 image_filename += (
"-" + suffix);
270 image_filename +=
".png";
271 assert(!image_filename.empty());
274 if (!
image.file_exists())
276 ERR_ARR <<
"Image " << image_filename <<
" not found.";
287 disp->invalidate(loc);
295 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
virtual void draw_hex(const map_location &hex)
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
virtual void reset()
invalidates and clears the present path, forgets the previous path, clears the symbols map
display::drawing_layer layer_
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
virtual void update_symbols()
Calculate the symbols to place along the arrow path.
const arrow_path_t & get_previous_path() const
virtual void notify_arrow_changed()
arrow(const arrow &)=delete
const arrow_path_t & get_path() const
virtual void set_path(const arrow_path_t &path)
arrow_symbols_map_t symbols_map_
virtual 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.
void drawing_buffer_add(const drawing_layer layer, const map_location &loc, decltype(draw_helper::do_draw) draw_func)
Add an item to the drawing buffer.
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).
void blit(const texture &tex, const SDL_Rect &dst)
Draws a texture, or part of a texture, at the given location.
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.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
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.
DIRECTION
Valid directions which can be moved in our hexagonal world.
static std::string write_direction(DIRECTION dir)
An abstract description of a rectangle with integer coordinates.