MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / canTurbo

Method canTurbo

game/state/gamestate.cpp:941–970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941bool GameState::canTurbo() const
942{
943 if (!this->current_city->projectiles.empty())
944 {
945 return false;
946 }
947 for (auto &v : this->vehicles)
948 {
949 if (!v.second->isDead() && v.second->city == this->current_city &&
950 v.second->tileObject != nullptr)
951 {
952 if (v.second->type->aggressiveness > 0 &&
953 v.second->owner->isRelatedTo(this->getPlayer()) ==
954 Organisation::Relation::Hostile &&
955 !v.second->crashed)
956 {
957 return false;
958 }
959 for (auto &m : v.second->missions)
960 {
961 if (m.type == VehicleMission::MissionType::AttackBuilding ||
962 m.type == VehicleMission::MissionType::AttackVehicle)
963 {
964 return false;
965 }
966 }
967 }
968 }
969 return true;
970}
971
972/**
973 * Immediately remove all dead objects.

Callers 2

updateTurboMethod · 0.95
updateMethod · 0.80

Calls 4

getPlayerMethod · 0.95
emptyMethod · 0.80
isRelatedToMethod · 0.80
isDeadMethod · 0.45

Tested by

no test coverage detected