public function __construct(Empire $default = null, Unit $unit = null) { $this->map = array(); if (!is_null($default)) { $this->original_occupier = $default; if ($unit instanceof Unit && $unit->isForce()) { // Add a point to the occupier if they have a unit here. $this->inc($default); // add starting 'defenders' point } $this->winner = $default; // Set as default winner } else { $this->winner = null; } }
/** * Shortcut function, empire and unit always have to be set together, * so this function saves me from having to do it twice all the time */ public function setInitialOccupation(Empire $empire, Unit $unit) { parent::setInitialOccupier($empire); parent::setInitialUnit($unit->getUnitType()); }