Browse Source

Compile fix for g++.

Frank Zago 16 năm trước cách đây
mục cha
commit
69217ff217
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      AI/GeniusAI/CGeniusAI.cpp

+ 6 - 4
AI/GeniusAI/CGeniusAI.cpp

@@ -365,8 +365,10 @@ void CGeniusAI::addHeroObjectives(CGeniusAI::HypotheticalGameState::HeroModel &h
 					std::set<HeroObjective>::iterator found = currentHeroObjectives.find(ho);
 					std::set<HeroObjective>::iterator found = currentHeroObjectives.find(ho);
 					if(found==currentHeroObjectives.end())
 					if(found==currentHeroObjectives.end())
 						currentHeroObjectives.insert(ho);
 						currentHeroObjectives.insert(ho);
-					else
-						found->whoCanAchieve.push_back(&h);
+					else {
+						HeroObjective *objective = (HeroObjective *)&(*found);
+						objective->whoCanAchieve.push_back(&h);
+					}
 				}
 				}
 
 
 				// find the most interesting object that is eventually reachable, and set that position to the ultimate goal position
 				// find the most interesting object that is eventually reachable, and set that position to the ultimate goal position
@@ -723,9 +725,9 @@ void CGeniusAI::fillObjectiveQueue(HypotheticalGameState & hgs)
 	for(std::vector <CGeniusAI::HypotheticalGameState::TownModel>::iterator i = hgs.townModels.begin(); i != hgs.townModels.end(); i++)
 	for(std::vector <CGeniusAI::HypotheticalGameState::TownModel>::iterator i = hgs.townModels.begin(); i != hgs.townModels.end(); i++)
 		addTownObjectives(*i,hgs);
 		addTownObjectives(*i,hgs);
 	for(std::set<CGeniusAI::HeroObjective>::iterator i = currentHeroObjectives.begin(); i != currentHeroObjectives.end(); i++)
 	for(std::set<CGeniusAI::HeroObjective>::iterator i = currentHeroObjectives.begin(); i != currentHeroObjectives.end(); i++)
-		objectiveQueue.push_back(AIObjectivePtrCont(&(*i)));
+		objectiveQueue.push_back(AIObjectivePtrCont((CGeniusAI::HeroObjective *)&(*i)));
 	for(std::set<CGeniusAI::TownObjective>::iterator i = currentTownObjectives.begin(); i != currentTownObjectives.end(); i++)
 	for(std::set<CGeniusAI::TownObjective>::iterator i = currentTownObjectives.begin(); i != currentTownObjectives.end(); i++)
-		objectiveQueue.push_back(AIObjectivePtrCont(&(*i)));
+		objectiveQueue.push_back(AIObjectivePtrCont((CGeniusAI::TownObjective *)&(*i)));
 }
 }
 CGeniusAI::AIObjective * CGeniusAI::getBestObjective()
 CGeniusAI::AIObjective * CGeniusAI::getBestObjective()
 {
 {