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)
32 #define SCREEN (static_cast<display*>(resources::screen))
61 SCREEN->remove_arrow(*
this);
150 if (path.size() >= 2)
160 WRN_ARR <<
"arrow::update_symbols called with invalid path" << std::endl;
173 arrow_path_t::const_iterator
const arrow_start_hex =
path_.begin();
174 arrow_path_t::const_iterator
const arrow_pre_end_hex =
path_.end() - 2;
175 arrow_path_t::const_iterator
const arrow_end_hex =
path_.end() - 1;
176 bool teleport_out =
false;
179 for (hex =
path_.begin(); hex !=
path_.end(); ++hex)
185 bool pre_end =
false;
189 bool teleport_in = teleport_out;
190 teleport_out =
false;
193 if (hex == arrow_start_hex)
195 if (hex == arrow_pre_end_hex)
197 else if (hex == arrow_end_hex)
204 if (!start && !teleport_in)
206 enter_dir = hex->get_relative_dir(*(hex-1));
209 if (!end && !teleport_out)
211 exit_dir = hex->get_relative_dir(*(hex+1));
217 prefix =
"teleport-out";
223 else if (teleport_in)
225 prefix =
"teleport-in";
237 suffix = suffix +
"_ending";
252 exit = exit +
"_ending";
255 assert(abs(enter_dir - exit_dir) > 1);
256 if (enter_dir < exit_dir)
268 image_filename = dirname +
style_ +
"/" + prefix;
271 image_filename += (
"-" + suffix);
273 image_filename +=
".png";
274 assert(image_filename !=
"");
279 ERR_ARR <<
"Image " << image_filename <<
" not found." << std::endl;
300 SCREEN->update_arrow(*
this);
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
std::string style_
represents the subdirectory that holds images for this arrow style
virtual void notify_arrow_changed()
Arrows destined to be drawn on the map.
static std::string const STYLE_FOCUS
void hide()
Sets the arrow's visibility.
arrow_path_t const & get_path() const
bool file_exists() const
Tests whether the file the locater points at exists.
GLenum GLsizei GLenum GLenum const GLvoid * image
arrow_symbols_map_t symbols_map_
static void invalidate_arrow_path(arrow_path_t const &path)
Invalidates every hex along the given path.
static std::string const STYLE_FOCUS_INVALID
std::vector< map_location > arrow_path_t
bool contains(const tpane::titem &item, const std::string &tag, const ttext_box &text_box)
A filter testing whether a search string is used in a text.
GLsizei const char ** path
bool tiles_adjacent(const map_location &a, const map_location &b)
Function which tells if two locations are adjacent.
display::tdrawing_layer layer_
bool path_contains(map_location const &hex) const
virtual void update_symbols()
Calculate the symbols to place along the arrow path.
static bool valid_path(arrow_path_t const &path)
Checks that the path is not of length 0 or 1.
static std::string const STYLE_STANDARD
If you add more styles, you should look at move::update_arrow_style()
static std::string const STYLE_HIGHLIGHTED
arrow_path_t const & get_previous_path() const
Encapsulates the map of the game.
virtual void reset()
invalidates and clears the present path, forgets the previous path, clears the symbols map ...
DIRECTION
Valid directions which can be moved in our hexagonal world.
virtual void set_path(arrow_path_t const &path)
virtual void set_color(std::string const &color)
The string color parameter is in the same format expected by the image::locator modifiers parameter...
virtual void draw_hex(map_location const &hex)
this module manages the cache of images.
static lg::log_domain log_arrows("arrows")
Standard logging facilities (interface).
void set_style(std::string const &style)
static std::string write_direction(DIRECTION dir)
GLsizei const GLcharARB ** string
arrow_path_t previous_path_