Returns OK if the structure can load a unit. The structure must have enough space. InappropriateUnitType - the unit is not a structure. StructureNotYetBuilt - the structure has not yet been built. GarrisonFull - the unit's garrison is already full.
(&self)
| 953 | /// * StructureNotYetBuilt - the structure has not yet been built. |
| 954 | /// * GarrisonFull - the unit's garrison is already full. |
| 955 | pub(crate) fn ok_if_can_load(&self) -> Result<(), GameError> { |
| 956 | self.ok_if_structure_built()?; |
| 957 | if self.garrison.len() == self.max_capacity { |
| 958 | Err(GameError::GarrisonFull)?; |
| 959 | } |
| 960 | Ok(()) |
| 961 | } |
| 962 | |
| 963 | /// Updates the structure as if it has loaded a unit inside its garrison. |
| 964 | /// Adds the unit ID to the garrison. |
no test coverage detected