fix halo glitch
This commit is contained in:
parent
e2891ae661
commit
f5119032ab
3 changed files with 20 additions and 8 deletions
|
@ -2305,13 +2305,9 @@ void display::place_temporary_unit(unit &u, const gamemap::location& loc)
|
|||
void display::remove_temporary_unit()
|
||||
{
|
||||
|
||||
gamemap::location adjacent[6];
|
||||
get_adjacent_tiles(temp_unit_loc_, adjacent);
|
||||
invalidate(temp_unit_loc_);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
invalidate(adjacent[i]);
|
||||
}
|
||||
// remove unit after invalidating...
|
||||
// redraw with no location to get rid of haloes
|
||||
temp_unit_->redraw_unit(*this,gamemap::location());
|
||||
temp_unit_ = NULL;
|
||||
}
|
||||
void display::add_overlay(const gamemap::location& loc, const std::string& img, const std::string& halo)
|
||||
|
|
18
src/unit.cpp
18
src/unit.cpp
|
@ -1648,7 +1648,7 @@ void unit::set_facing(gamemap::location::DIRECTION dir) {
|
|||
void unit::redraw_unit(display& disp,gamemap::location hex)
|
||||
{
|
||||
const gamemap & map = disp.get_map();
|
||||
if(hidden_ || disp.fogged(hex) ||
|
||||
if(!hex.valid() || hidden_ || disp.fogged(hex) ||
|
||||
(invisible(hex,disp.get_units(),disp.get_teams()) &&
|
||||
disp.get_teams()[disp.viewing_team()].is_enemy(side())) ){
|
||||
|
||||
|
@ -3091,3 +3091,19 @@ std::string unit::image_mods() const{
|
|||
}
|
||||
return modifier.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void unit::set_hidden(bool state) {
|
||||
hidden_ = state;
|
||||
if(!state) return;
|
||||
// we need to get rid of haloes immediately to avoid display glitches
|
||||
if(unit_halo_ != halo::NO_HALO) {
|
||||
halo::remove(unit_halo_);
|
||||
unit_halo_ = halo::NO_HALO;
|
||||
}
|
||||
if(unit_anim_halo_ != halo::NO_HALO) {
|
||||
halo::remove(unit_anim_halo_);
|
||||
unit_anim_halo_ = halo::NO_HALO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ class unit
|
|||
|
||||
int upkeep() const;
|
||||
|
||||
void set_hidden(bool state) {hidden_ = state;};
|
||||
void set_hidden(bool state);
|
||||
bool get_hidden() { return hidden_; };
|
||||
bool is_flying() const { return flying_; }
|
||||
bool is_fearless() const { return is_fearless_; }
|
||||
|
|
Loading…
Add table
Reference in a new issue