made it so AI will not move or attack with their leader if it is turned to stone

This commit is contained in:
Dave White 2004-03-24 00:00:36 +00:00
parent 1cedfe0cd3
commit 373a4dc938
2 changed files with 7 additions and 3 deletions

View file

@ -766,7 +766,7 @@ void ai::do_recruitment()
void ai::move_leader_to_keep(const move_map& enemy_dstsrc)
{
const unit_map::iterator leader = find_leader(units_,team_num_);
if(leader == units_.end())
if(leader == units_.end() || leader->second.stone())
return;
//find where the leader can move
@ -791,7 +791,7 @@ void ai::leader_attack()
{
std::cerr << "leader attack analysis...\n";
const unit_map::iterator leader = find_leader(units_,team_num_);
if(leader == units_.end())
if(leader == units_.end() || leader->second.stone())
return;
gamemap::location choice;
@ -831,7 +831,7 @@ void ai::move_leader_after_recruit(const move_map& enemy_dstsrc)
leader_attack();
const unit_map::iterator leader = find_leader(units_,team_num_);
if(leader == units_.end())
if(leader == units_.end() || leader->second.stone())
return;
const paths leader_paths(map_,state_,gameinfo_,units_,leader->first,teams_,false,false);

View file

@ -180,6 +180,10 @@ LEVEL_RESULT play_level(game_data& gameinfo, config& game_config,
std::cerr << "initializing side '" << (**ui)["side"] << "' at " << start_pos.x << "," << start_pos.y << "\n";
}
if(map.empty()) {
throw gamestatus::load_game_failed("Map not found");
}
if(!start_pos.valid() && new_unit.side() == 1) {
throw gamestatus::load_game_failed("No starting position for side 1");
}