فهرست منبع

VCAI Explore goal: add monolith's exploration support

Explore will also suggest AI to re-enter bidirectional teleporter in case of one of it's exits is not visible for some reason.

Also now AI won't try to visit teleporters in case if it's know that it's channel is impassable. E.g if map have several entrance monoliths of with same same SubID that don't have exit then AI will only try to visit one of them and later of he'll know that all other monoliths of this subtype is blocked because they all using same channel.
ArseniyShestakov 10 سال پیش
والد
کامیت
9ece636cf8
1فایلهای تغییر یافته به همراه33 افزوده شده و 1 حذف شده
  1. 33 1
      AI/VCAI/Goals.cpp

+ 33 - 1
AI/VCAI/Goals.cpp

@@ -591,8 +591,40 @@ TGoalVec Explore::getAllPossibleSubgoals()
 				case Obj::REDWOOD_OBSERVATORY:
 				case Obj::PILLAR_OF_FIRE:
 				case Obj::CARTOGRAPHER:
-				case Obj::SUBTERRANEAN_GATE: //TODO: check ai->knownSubterraneanGates
 					objs.push_back (obj);
+					break;
+				case Obj::MONOLITH_ONE_WAY_ENTRANCE:
+				case Obj::MONOLITH_TWO_WAY:
+				case Obj::SUBTERRANEAN_GATE:
+					auto tObj = dynamic_cast<const CGTeleport *>(obj);
+					if(tObj)
+					{
+						assert(ai->knownTeleportChannels.find(tObj->channel) != ai->knownTeleportChannels.end());
+						if(TeleportChannel::IMPASSABLE != ai->knownTeleportChannels[tObj->channel]->passability)
+							objs.push_back (obj);
+					}
+			}
+		}
+		else
+		{
+			switch (obj->ID.num)
+			{
+				case Obj::MONOLITH_TWO_WAY:
+				case Obj::SUBTERRANEAN_GATE:
+				{
+					auto tObj = dynamic_cast<const CGTeleport *>(obj);
+					if(TeleportChannel::IMPASSABLE == ai->knownTeleportChannels[tObj->channel]->passability)
+						break;
+
+					for(auto exit : ai->knownTeleportChannels[tObj->channel]->exits)
+					{
+						if(!cb->getObj(exit))
+						{ // Always attempt to visit two-way teleports if one of channel exits is not visible
+							objs.push_back(obj);
+							break;
+						}
+					}
+				}
 			}
 		}
 	}