MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / ok_if_structure

Method ok_if_structure

battlecode-engine/src/unit.rs:403–409  ·  view source on GitHub ↗

Ok if the unit is a structure. Errors otherwise. InappropriateUnitType - the unit is not a structure.

(&self)

Source from the content-addressed store, hash-verified

401 ///
402 /// * InappropriateUnitType - the unit is not a structure.
403 pub(crate) fn ok_if_structure(&self) -> Result<(), GameError> {
404 if self.unit_type.is_structure() {
405 Ok(())
406 } else {
407 Err(GameError::InappropriateUnitType)?
408 }
409 }
410
411 /// Ok if the unit is the given type. Errors otherwise.
412 ///

Callers 3

structure_is_builtMethod · 0.80
structure_garrisonMethod · 0.80

Calls 1

is_structureMethod · 0.80

Tested by

no test coverage detected