* Sets the craft to the maximum distance * required to fire a weapon. */
| 1235 | * required to fire a weapon. |
| 1236 | */ |
| 1237 | void DogfightState::maximumDistance() |
| 1238 | { |
| 1239 | int min = 1000; |
| 1240 | for (std::vector<CraftWeapon*>::iterator i = _craft->getWeapons()->begin(); i < _craft->getWeapons()->end(); ++i) |
| 1241 | { |
| 1242 | if (*i == 0) |
| 1243 | continue; |
| 1244 | if ((*i)->getRules()->getRange() < min && (*i)->getAmmo() > 0) |
| 1245 | { |
| 1246 | min = (*i)->getRules()->getRange(); |
| 1247 | } |
| 1248 | } |
| 1249 | if (min == 1000) |
| 1250 | { |
| 1251 | _targetDist = STANDOFF_DIST; |
| 1252 | } |
| 1253 | else |
| 1254 | { |
| 1255 | _targetDist = min * 8; |
| 1256 | } |
| 1257 | } |
| 1258 | |
| 1259 | /** |
| 1260 | * Updates the status text and restarts |
nothing calls this directly
no test coverage detected