* Checks the condition of all the craft's systems * to define its new status (eg. when arriving at base). */
| 654 | * to define its new status (eg. when arriving at base). |
| 655 | */ |
| 656 | void Craft::checkup() |
| 657 | { |
| 658 | int available = 0, full = 0; |
| 659 | for (std::vector<CraftWeapon*>::iterator i = _weapons.begin(); i != _weapons.end(); ++i) |
| 660 | { |
| 661 | if ((*i) == 0) |
| 662 | continue; |
| 663 | available++; |
| 664 | if ((*i)->getAmmo() >= (*i)->getRules()->getAmmoMax()) |
| 665 | { |
| 666 | full++; |
| 667 | } |
| 668 | else |
| 669 | { |
| 670 | (*i)->setRearming(true); |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | if (_damage > 0) |
| 675 | { |
| 676 | _status = "STR_REPAIRS"; |
| 677 | } |
| 678 | else if (available != full) |
| 679 | { |
| 680 | _status = "STR_REARMING"; |
| 681 | } |
| 682 | else |
| 683 | { |
| 684 | _status = "STR_REFUELLING"; |
| 685 | } |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * Returns if a certain target is detected by the craft's |
no test coverage detected