Display waypoint with an image...
...(placeholder: the white dot "waypoint" from story map)
This commit is contained in:
parent
385b0b93f9
commit
7b15bb5386
5 changed files with 22 additions and 11 deletions
BIN
images/misc/waypoint.png
Normal file
BIN
images/misc/waypoint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2 KiB |
|
@ -633,12 +633,18 @@ void game_display::draw_movement_info(const map_location& loc)
|
|||
image::get_image("misc/capture.png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
if (w->second.pass_here) {
|
||||
drawing_buffer_add(LAYER_MOVE_INFO, loc, tblit(xpos, ypos,
|
||||
image::get_image("misc/waypoint.png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
//we display turn info only if different from a simple last "1"
|
||||
if (w->second.turns > 1 || (w->second.turns == 1 && loc != route_.steps.back())) {
|
||||
std::stringstream turns_text;
|
||||
turns_text << w->second.turns;
|
||||
draw_text_in_hex(loc, LAYER_MOVE_INFO, turns_text.str(), 17, font::NORMAL_COLOUR, 0.5,0.8);
|
||||
}
|
||||
|
||||
// The hex is full now, so skip the "show enemy moves"
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -327,7 +327,10 @@ void mouse_handler::add_waypoint(const map_location& loc) {
|
|||
waypoints_.pop_back();
|
||||
} else {
|
||||
waypoints_.push_back(loc);
|
||||
}
|
||||
}
|
||||
// we need to update the route, simulate a mouse move for the moment
|
||||
// (browse is supposed false here, 0,0 are dummy values)
|
||||
mouse_motion(0,0, false, true);
|
||||
}
|
||||
|
||||
marked_route mouse_handler::get_route(unit_map::const_iterator un, map_location go_to, team &team)
|
||||
|
|
|
@ -397,6 +397,11 @@ marked_route mark_route(const plain_route &rt,
|
|||
assert(last_step || map.on_board(*(i+1)));
|
||||
const int move_cost = last_step ? 0 : u.movement_cost(map[*(i+1)]);
|
||||
bool capture = false;
|
||||
bool pass_here = false;
|
||||
if (w != waypoints.end() && *i == *w) {
|
||||
w++;
|
||||
pass_here = true;
|
||||
}
|
||||
|
||||
if (last_step || zoc || move_cost > movement) {
|
||||
// check if we stop an a village and so maybe capture it
|
||||
|
@ -410,7 +415,7 @@ marked_route mark_route(const plain_route &rt,
|
|||
|
||||
bool invisible = u.invisible(*i,units,teams,false);
|
||||
|
||||
res.waypoints[*i] = marked_route::waypoint(turns, zoc, capture, invisible);
|
||||
res.waypoints[*i] = marked_route::waypoint(turns, pass_here, zoc, capture, invisible);
|
||||
|
||||
if (last_step) break; // finished and we used dummy move_cost
|
||||
|
||||
|
@ -418,13 +423,9 @@ marked_route mark_route(const plain_route &rt,
|
|||
if(move_cost > movement) {
|
||||
return res; //we can't reach destination
|
||||
}
|
||||
}
|
||||
if (w < waypoints.end() && *i == *w) {
|
||||
w++;
|
||||
if(res.waypoints.count(*i)==0) {
|
||||
bool invisible = u.invisible(*i,units,teams,false);
|
||||
res.waypoints[*i] = marked_route::waypoint(0, zoc, false, invisible);
|
||||
}
|
||||
} else if (pass_here) {
|
||||
bool invisible = u.invisible(*i,units,teams,false);
|
||||
res.waypoints[*i] = marked_route::waypoint(0, pass_here, zoc, false, invisible);
|
||||
}
|
||||
|
||||
zoc = enemy_zoc(map,units,teams, *(i+1), viewing_team,u.side())
|
||||
|
|
|
@ -118,11 +118,12 @@ struct marked_route
|
|||
|
||||
struct waypoint
|
||||
{
|
||||
waypoint(int turns_number = 0, bool in_zoc = false,
|
||||
waypoint(int turns_number = 0, bool pass = false, bool in_zoc = false,
|
||||
bool do_capture = false, bool is_invisible = false)
|
||||
: turns(turns_number), zoc(in_zoc),
|
||||
: turns(turns_number), pass_here(pass), zoc(in_zoc),
|
||||
capture(do_capture), invisible(is_invisible) {}
|
||||
int turns;
|
||||
bool pass_here;
|
||||
bool zoc;
|
||||
bool capture;
|
||||
bool invisible;
|
||||
|
|
Loading…
Add table
Reference in a new issue