------------------------------------------- CAN BUILD ADDON --------------------------------------------
| 831 | } |
| 832 | //------------------------------------------- CAN BUILD ADDON -------------------------------------------- |
| 833 | static inline bool canBuildAddon(Unit thisUnit, bool checkCommandibility = true) |
| 834 | { |
| 835 | if ( !checkCommandibility ) |
| 836 | Broodwar->setLastError(); |
| 837 | else if ( !canCommand(thisUnit) ) |
| 838 | return false; |
| 839 | |
| 840 | if ( thisUnit->isConstructing() || |
| 841 | !thisUnit->isCompleted() || |
| 842 | thisUnit->isLifted() || |
| 843 | (thisUnit->getType().isBuilding() && !thisUnit->isIdle()) ) |
| 844 | return Broodwar->setLastError(Errors::Unit_Busy); |
| 845 | if ( thisUnit->getAddon() ) |
| 846 | return Broodwar->setLastError(Errors::Incompatible_State); |
| 847 | if ( !thisUnit->getType().canBuildAddon() ) |
| 848 | return Broodwar->setLastError(Errors::Incompatible_UnitType); |
| 849 | |
| 850 | return true; |
| 851 | } |
| 852 | static inline bool canBuildAddon(Unit thisUnit, UnitType uType, bool checkCanIssueCommandType = true, bool checkCommandibility = true) |
| 853 | { |
| 854 | if ( !checkCommandibility ) |
no test coverage detected