28 #define ERR_ARR LOG_STREAM(err, log_arrows)
29 #define WRN_ARR LOG_STREAM(warn, log_arrows)
30 #define LOG_ARR LOG_STREAM(info, log_arrows)
31 #define DBG_ARR LOG_STREAM(debug, log_arrows)
36 , style_(STYLE_STANDARD)
60 disp->remove_arrow(*
this);
72 disp->add_arrow(*
this);
151 return (
path.size() >= 2);
158 WRN_ARR <<
"arrow::update_symbols called with invalid path";
165 const std::string mods =
"~RC(FF00FF>"+
color_ +
")";
167 const std::string dirname =
"arrows/";
168 std::string prefix =
"";
169 std::string suffix =
"";
170 std::string image_filename =
"";
171 arrow_path_t::const_iterator
const arrow_start_hex =
path_.begin();
172 arrow_path_t::const_iterator
const arrow_pre_end_hex =
path_.end() - 2;
173 arrow_path_t::const_iterator
const arrow_end_hex =
path_.end() - 1;
174 bool teleport_out =
false;
177 for (hex =
path_.begin(); hex !=
path_.end(); ++hex)
183 bool pre_end =
false;
187 bool teleport_in = teleport_out;
188 teleport_out =
false;
191 if (hex == arrow_start_hex)
193 if (hex == arrow_pre_end_hex)
195 else if (hex == arrow_end_hex)
202 if (!
start && !teleport_in)
204 enter_dir = hex->get_relative_dir(*(hex-1));
207 if (!end && !teleport_out)
209 exit_dir = hex->get_relative_dir(*(hex+1));
215 prefix =
"teleport-out";
221 else if (teleport_in)
223 prefix =
"teleport-in";
235 suffix = suffix +
"_ending";
245 std::string enter, exit;
250 exit = exit +
"_ending";
253 assert(std::abs(enter_dir - exit_dir) > 1);
254 if (enter_dir < exit_dir)
266 image_filename = dirname +
style_ +
"/" + prefix;
269 image_filename += (
"-" + suffix);
271 image_filename +=
".png";
272 assert(!image_filename.empty());
275 if (!
image.file_exists())
277 ERR_ARR <<
"Image " << image_filename <<
" not found.";
288 disp->invalidate(loc);
296 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.