Quellcode durchsuchen

Naah, revert my changes.

DJWarmonger vor 7 Jahren
Ursprung
Commit
70549197b6
2 geänderte Dateien mit 5 neuen und 8 gelöschten Zeilen
  1. 4 7
      AI/VCAI/Goals.cpp
  2. 1 1
      AI/VCAI/VCAI.cpp

+ 4 - 7
AI/VCAI/Goals.cpp

@@ -1073,16 +1073,13 @@ TSubgoal Goals::CollectRes::whatToDoToTrade()
 			auto backObj = cb->getTopObj(m->o->visitablePos()); //it'll be a hero if we have one there; otherwise marketplace
 			assert(backObj);
 			auto objid = m->o->id.getNum();
-			if (backObj->tempOwner != ai->playerID)
+			if (backObj->tempOwner != ai->playerID) //top object not owned
 			{
-				return sptr(Goals::GetObj(objid));
+				return sptr(Goals::GetObj(objid)); //just go there
 			}
-			else
+			else //either it's our town, or we have hero there
 			{
-				if (m->o->ID == Obj::TOWN) //just trade remotely using town objid
-					return sptr(setobjid(objid).setisElementar(true));
-				else //just go there
-					return sptr(Goals::GetObj(objid));
+				return sptr(setobjid(objid).setisElementar(true));
 			}
 		}
 	}

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -2158,7 +2158,7 @@ void VCAI::tryRealize(Goals::DigAtTile & g)
 
 void VCAI::tryRealize(Goals::CollectRes & g) //trade
 {
-	if(ah->freeResources()[g.resID] >= g.value) //goal is already fulfilled. Why we need this chek, anyway?
+	if(ah->freeResources()[g.resID] >= g.value) //goal is already fulfilled. Why we need this check, anyway?
 		throw goalFulfilledException(sptr(g));
 
 	if(const CGObjectInstance * obj = cb->getObj(ObjectInstanceID(g.objid), false))