| 182 | } |
| 183 | |
| 184 | bool Agent::isBodyStateAllowed(BodyState bodyState) const |
| 185 | { |
| 186 | static const std::list<EquipmentSlotType> armorslots = { |
| 187 | EquipmentSlotType::ArmorBody, EquipmentSlotType::ArmorHelmet, |
| 188 | EquipmentSlotType::ArmorLeftHand, EquipmentSlotType::ArmorLegs, |
| 189 | EquipmentSlotType::ArmorRightHand}; |
| 190 | |
| 191 | if (type->bodyType->allowed_body_states.find(bodyState) != |
| 192 | type->bodyType->allowed_body_states.end()) |
| 193 | { |
| 194 | return true; |
| 195 | } |
| 196 | if (bodyState == BodyState::Flying) |
| 197 | { |
| 198 | for (auto &t : armorslots) |
| 199 | { |
| 200 | auto e = getFirstItemInSlot(t); |
| 201 | if (e && e->type->provides_flight) |
| 202 | { |
| 203 | return true; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | return false; |
| 208 | } |
| 209 | |
| 210 | bool Agent::isMovementStateAllowed(MovementState movementState) const |
| 211 | { |
no test coverage detected