26 #define ERR_ARR LOG_STREAM(err, log_arrows) 27 #define WRN_ARR LOG_STREAM(warn, log_arrows) 28 #define LOG_ARR LOG_STREAM(info, log_arrows) 29 #define DBG_ARR LOG_STREAM(debug, log_arrows) 34 , style_(STYLE_STANDARD)
57 disp->remove_arrow(*
this);
68 disp->add_arrow(*
this);
148 if (path.size() >= 2)
158 WRN_ARR <<
"arrow::update_symbols called with invalid path" << std::endl;
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." << std::endl;
288 disp->invalidate(loc);
296 disp->update_arrow(*
this);
static void invalidate_arrow_path(const arrow_path_t &path)
Invalidates every hex along the given path.
surface get_image(const image::locator &i_locator, TYPE type)
Caches and returns 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 display * get_singleton()
Returns the display object if a display object exists.
void hide()
Sets the arrow's visibility.
const arrow_path_t & get_path() const
bool contains(const pane::item &item, const std::string &tag, const text_box &text_box)
A filter testing whether a search string is used in a text.
bool path_contains(const map_location &hex) const
void render_image(int x, int y, const display::drawing_layer drawing_layer, const map_location &loc, surface image, bool hreverse=false, bool greyscale=false, fixed_t alpha=ftofxp(1.0), color_t blendto={0, 0, 0}, double blend_ratio=0, double submerged=0.0, bool vreverse=false)
Draw an image at a certain location.
virtual void draw_hex(const map_location &hex)
arrow_symbols_map_t symbols_map_
virtual void set_path(const arrow_path_t &path)
std::vector< map_location > arrow_path_t
arrow(const arrow &)=delete
static const std::string STYLE_HIGHLIGHTED
static const std::string STYLE_FOCUS
const arrow_path_t & get_previous_path() const
display::drawing_layer layer_
virtual void update_symbols()
Calculate the symbols to place along the arrow path.
static const std::string STYLE_FOCUS_INVALID
Generic locator abstracting the location of an image.
Image rescaled according to the zoom settings.
Encapsulates the map of the game.
bool tiles_adjacent(const map_location &a, const map_location &b)
Function which tells if two locations are adjacent.
virtual void reset()
invalidates and clears the present path, forgets the previous path, clears the 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...
int get_location_y(const map_location &loc) const
DIRECTION
Valid directions which can be moved in our hexagonal world.
int get_location_x(const map_location &loc) const
Functions to get the on-screen positions of hexes.
Functions to load and save images from/to disk.
static lg::log_domain log_arrows("arrows")
Standard logging facilities (interface).
EXIT_STATUS start(const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
static const std::string STYLE_STANDARD
If you add more styles, you should look at move::update_arrow_style()
void set_style(const std::string &style)
static bool valid_path(const arrow_path_t &path)
Checks that the path is not of length 0 or 1.
static std::string write_direction(DIRECTION dir)
std::string::const_iterator iterator
arrow_path_t previous_path_