fix sighted event with delay shroud during move&attack
and also only move. That solve rest of bug #7655.
This commit is contained in:
parent
3d6e594c27
commit
973d7f7d37
2 changed files with 17 additions and 10 deletions
|
@ -1805,7 +1805,6 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
const bool check_shroud = should_clear_shroud && team.auto_shroud_updates() &&
|
||||
(team.uses_shroud() || team.uses_fog());
|
||||
|
||||
//if we use shroud/fog of war, count out the units we can currently see
|
||||
std::set<gamemap::location> known_units;
|
||||
if(check_shroud) {
|
||||
for(unit_map::const_iterator u = units.begin(); u != units.end(); ++u) {
|
||||
|
@ -1841,8 +1840,9 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
}
|
||||
|
||||
//if we use fog or shroud, see if we have sighted an enemy unit, in
|
||||
//which case we should stop immediately.
|
||||
if(check_shroud) {
|
||||
//which case we should stop immediately. Cannot use check shroud,
|
||||
//because also need check if delay shroud is on.
|
||||
if(should_clear_shroud && (team.uses_shroud() || team.uses_fog())) {
|
||||
if(units.count(*step) == 0 && !map.is_village(*step)) {
|
||||
LOG_NG << "checking for units from " << (step->x+1) << "," << (step->y+1) << "\n";
|
||||
|
||||
|
@ -1852,10 +1852,16 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
//we have to swap out any unit that is already in the hex, so we can put our
|
||||
//unit there, then we'll swap back at the end.
|
||||
const temporary_unit_placer unit_placer(units,*step,ui->second);
|
||||
|
||||
should_clear_stack |= clear_shroud_unit(map,status,gamedata,units,*step,teams,
|
||||
ui->second.side()-1,&known_units,&seen_units);
|
||||
|
||||
if( team.auto_shroud_updates())
|
||||
{
|
||||
should_clear_stack |= clear_shroud_unit(map,status,gamedata,units,*step,teams,
|
||||
ui->second.side()-1,&known_units,&seen_units);
|
||||
}
|
||||
else
|
||||
{
|
||||
clear_shroud_unit(map,status,gamedata,units,*step,teams,
|
||||
ui->second.side()-1,&known_units,&seen_units);
|
||||
}
|
||||
if(should_clear_stack) {
|
||||
disp->invalidate_all();
|
||||
}
|
||||
|
|
|
@ -1062,7 +1062,7 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
|
|||
//if shroud or fog is active, rememember nits a and after attack check if someone isn`t seen
|
||||
std::set<gamemap::location> known_units;
|
||||
|
||||
if (check_shroud){
|
||||
if (teams_[team_num_-1].uses_shroud() || teams_[team_num_-1].uses_fog()){
|
||||
for(unit_map::const_iterator u = units_.begin(); u != units_.end(); ++u) {
|
||||
if(teams_[team_num_-1].fogged(u->first.x,u->first.y) == false) {
|
||||
known_units.insert(u->first);
|
||||
|
@ -1080,8 +1080,9 @@ void mouse_handler::left_click(const SDL_MouseButtonEvent& event, const bool bro
|
|||
}
|
||||
else //attack == true
|
||||
{
|
||||
if (check_shroud){
|
||||
if (clear_shroud(*gui_, status_, map_, gameinfo_, units_, teams_, team_num_ - 1)){
|
||||
if (teams_[team_num_-1].uses_shroud() || teams_[team_num_-1].uses_fog()){
|
||||
//check if some new part of map discovered or is active delay shroud updates, which need special care
|
||||
if (clear_shroud(*gui_, status_, map_, gameinfo_, units_, teams_, team_num_ - 1)||!teams_[team_num_-1].auto_shroud_updates()){
|
||||
clear_undo_stack();
|
||||
//some new part of map discovered
|
||||
for(unit_map::const_iterator u = units_.begin(); u != units_.end(); ++u) {
|
||||
|
|
Loading…
Add table
Reference in a new issue