File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2166,10 +2166,19 @@ void AI::MoveIndependent(Ship &ship, Command &command)
21662166 {
21672167 MoveToPlanet (ship, command);
21682168 const StellarObject *targetStellar = ship.GetTargetStellar ();
2169- bool shouldLandOnTarget = !shouldStay;
2170- shouldLandOnTarget &= targetStellar->HasSprite ();
2171- shouldLandOnTarget &= targetStellar->GetPlanet () && targetStellar->GetPlanet ()->CanLand (ship);
2172- shouldLandOnTarget &= (ship.Attributes ().Get (" fuel capacity" ) || targetStellar->GetPlanet ()->IsWormhole ());
2169+ bool shouldLandOnTarget = [shouldStay, targetStellar, ship]() {
2170+ if (shouldStay)
2171+ return false ;
2172+ if (!targetStellar->HasSprite ())
2173+ return false ;
2174+ if (!targetStellar->GetPlanet ())
2175+ return false ;
2176+ if (!targetStellar->GetPlanet ()->CanLand (ship))
2177+ return false ;
2178+ if (!ship.Attributes ().Get (" fuel capacity" ) && !targetStellar->GetPlanet ()->IsWormhole ())
2179+ return false ;
2180+ return true ;
2181+ }();
21732182 if (shouldLandOnTarget)
21742183 command |= Command::LAND ;
21752184 else if (ship.Position ().Distance (ship.GetTargetStellar ()->Position ()) < 100 .)
You can’t perform that action at this time.
0 commit comments