fixed bug where AI could see potential movement of enemy units

This commit is contained in:
uid68803 2004-02-25 19:40:57 +00:00
parent d84929c619
commit 31edc93de7
3 changed files with 12 additions and 4 deletions

View file

@ -47,7 +47,7 @@ Defeat:
hitpoints=45
experience=0
side=1
gold=60
gold=100
canrecruit=1
recruit=Elvish Scout,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman
enemy=2
@ -63,7 +63,7 @@ Defeat:
canrecruit=1
recruit=Orcish Grunt,Wolf Rider,Orcish Archer,Troll Whelp
recruitment_pattern=scout,scout,fighter,fighter,archer
{GOLD 60 120 240}
{GOLD 80 160 260}
enemy=1
[/side]

View file

@ -206,10 +206,18 @@ void ai_interface::calculate_possible_moves(std::map<location,paths>& res, move_
continue;
}
//discount our own leader, and our units that have been turned to stone
if(!enemy && (un_it->second.can_recruit() || un_it->second.stone())) {
continue;
}
//we can't see where invisible enemy units might move
if(enemy &&
un_it->second.invisible(info_.map.underlying_terrain(info_.map.get_terrain(un_it->first)),
info_.state.get_time_of_day().lawful_bonus,un_it->first,info_.units,info_.teams)) {
continue;
}
//if it's an enemy unit, reset its moves while we do the calculations
const unit_movement_resetter move_resetter(un_it->second,enemy || assume_full_movement);

View file

@ -1297,6 +1297,8 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image, double alpha, Uin
SDL_BlitSurface(flag,NULL,dst,&dstrect);
}
draw_tile_adjacent(x,y,image_type,ADJACENT_TERRAIN);
typedef std::multimap<gamemap::location,std::string>::const_iterator Itor;
for(std::pair<Itor,Itor> overlays = overlays_.equal_range(loc);
@ -1311,8 +1313,6 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image, double alpha, Uin
SDL_Rect dstrect = { xpos, ypos, 0, 0 };
SDL_BlitSurface(overlay_surface,NULL,dst,&dstrect);
}
draw_tile_adjacent(x,y,image_type,ADJACENT_TERRAIN);
}
if(!is_shrouded) {