* Sets the craft to the minimum distance * required to fire a weapon. */
| 1209 | * required to fire a weapon. |
| 1210 | */ |
| 1211 | void DogfightState::minimumDistance() |
| 1212 | { |
| 1213 | int max = 0; |
| 1214 | for (std::vector<CraftWeapon*>::iterator i = _craft->getWeapons()->begin(); i < _craft->getWeapons()->end(); ++i) |
| 1215 | { |
| 1216 | if (*i == 0) |
| 1217 | continue; |
| 1218 | if ((*i)->getRules()->getRange() > max && (*i)->getAmmo() > 0) |
| 1219 | { |
| 1220 | max = (*i)->getRules()->getRange(); |
| 1221 | } |
| 1222 | } |
| 1223 | if (max == 0) |
| 1224 | { |
| 1225 | _targetDist = STANDOFF_DIST; |
| 1226 | } |
| 1227 | else |
| 1228 | { |
| 1229 | _targetDist = max * 8; |
| 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | /** |
| 1234 | * Sets the craft to the maximum distance |
nothing calls this directly
no test coverage detected