1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

VCAI Explore goal: fix switch formatting

This commit is contained in:
ArseniyShestakov 2015-03-09 01:25:52 +03:00
parent 606013c535
commit 8d901ad4d0

View File

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