make the bug seen by grzywacz pratically invisible...

solving it would be too tricky at this stage
This commit is contained in:
Jérémy Rosen 2008-01-07 19:30:32 +00:00
parent 65d4f759c7
commit 8315dcc51c

View file

@ -71,7 +71,6 @@ static void move_unit_between(const gamemap::location& a, const gamemap::locatio
return;
}
disp->scroll_to_tiles(a,b,game_display::ONSCREEN);
disp->place_temporary_unit(temp_unit,a);
temp_unit.set_facing(a.get_relative_dir(b));
@ -82,6 +81,7 @@ static void move_unit_between(const gamemap::location& a, const gamemap::locatio
target_time += 150;
target_time -= target_time%150;
if( target_time - animator.get_animation_time() < 100 ) target_time +=150;
disp->scroll_to_tiles(a,b,game_display::ONSCREEN);
animator.wait_until(target_time);
}
@ -107,6 +107,8 @@ bool unit_visible_on_path( const std::vector<gamemap::location>& path, const uni
void move_unit(const std::vector<gamemap::location>& path, unit& u, const std::vector<team>& teams)
{
game_display* disp = game_display::get_singleton();
int begin =0;
int end = 0;
assert(!path.empty());
assert(disp);
// One hex path (strange), nothing to do
@ -114,11 +116,20 @@ void move_unit(const std::vector<gamemap::location>& path, unit& u, const std::v
const unit_map& units = disp->get_units();
// If the unit is visible, scroll to there before hide it
bool invisible = teams[u.side()-1].is_enemy(int(disp->viewing_team()+1)) &&
u.invisible(path[0],units,teams);
if (!invisible) {
disp->scroll_to_tiles(path[0],path[1],game_display::ONSCREEN);
// find the index of first visible tile
while(begin < path.size() && teams[u.side()-1].is_enemy(int(disp->viewing_team()+1)) &&
u.invisible(path[begin],units,teams)) {
begin++;
}
// find the last visible tile
end = begin;
while(end < path.size() && !(teams[u.side()-1].is_enemy(int(disp->viewing_team()+1)) &&
u.invisible(path[end],units,teams))) {
end++;
}
if (begin != path.size()) { //found a visible tile
if(end = path.size()) end--;
disp->scroll_to_tiles(path[begin],path[end],game_display::ONSCREEN);
}
bool was_hidden = u.get_hidden();