Some improvements to invisibility
This commit is contained in:
parent
e2b170d078
commit
515a287fb4
3 changed files with 11 additions and 2 deletions
|
@ -580,7 +580,7 @@ void ai::do_move()
|
|||
const unit_map::iterator enemy = units_.find(adj[n]);
|
||||
if(enemy != units_.end() &&
|
||||
current_team().is_enemy(enemy->second.side()) &&
|
||||
!enemy->second.invisible(map_[enemy->first.x][enemy->first.y],
|
||||
!enemy->second.invisible(map_.underlying_terrain(map_[enemy->first.x][enemy->first.y]),
|
||||
state_.get_time_of_day().lawful_bonus,enemy->first,
|
||||
units_,teams_)) {
|
||||
target = adj[n];
|
||||
|
|
|
@ -586,7 +586,7 @@ void display::draw_sidebar()
|
|||
//if unit is not fogged and not an invisible enemy
|
||||
if(i != units_.end() && !fogged(i->first.x,i->first.y) &&
|
||||
(!teams_[viewing_team()].is_enemy(i->second.side()) ||
|
||||
!i->second.invisible(map_[i->first.x][i->first.y],
|
||||
!i->second.invisible(map_.underlying_terrain(map_[i->first.x][i->first.y]),
|
||||
status_.get_time_of_day().lawful_bonus,
|
||||
i->first,units_,teams_))) {
|
||||
for(size_t r = reports::UNIT_REPORTS_BEGIN; r != reports::UNIT_REPORTS_END; ++r) {
|
||||
|
|
|
@ -435,6 +435,15 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
|||
current_paths_.routes.find(hex);
|
||||
unit_map::iterator enemy = units_.find(hex);
|
||||
|
||||
//deselect the unit if it's an invisible enemy
|
||||
if(enemy != units_.end()){
|
||||
if(current_team.is_enemy(enemy->second.side()) &&
|
||||
enemy->second.invisible(map_.underlying_terrain(map_[enemy->first.x][enemy->first.y]),
|
||||
status_.get_time_of_day().lawful_bonus,enemy->first,units_,teams_)) {
|
||||
enemy = units_.end();
|
||||
}
|
||||
}
|
||||
|
||||
//see if we're trying to attack an enemy
|
||||
if(route != current_paths_.routes.end() && enemy != units_.end() &&
|
||||
hex != selected_hex_ && !browse_ &&
|
||||
|
|
Loading…
Add table
Reference in a new issue