/** * Performs post analyze actions. * * @return void */ protected function postAnalyze() { if (!$this->gameSettings->isScenario()) { $lines = explode("\n", $this->gameInfo->objectivesString); // get map if (!$this->isMgx || $this->gameSettings->mapId == Map::CUSTOM) { if (count($lines) > 2) { $this->gameSettings->map = ltrim(strstr($lines[2], ': '), ': '); if (!$this->isMgx) { $map_found = false; //TODO get map from localized map strings } } } } $this->buildTeams(); // fix: player could click age advance, but game finished before reaching specific age foreach ($this->players as $player) { if ($player->feudalTime > $this->gameInfo->playTime) { $player->feudalTime = 0; } if ($player->castleTime > $this->gameInfo->playTime) { $player->castleTime = 0; } if ($player->imperialTime > $this->gameInfo->playTime) { $player->imperialTime = 0; } } //TODO: otestovat, ci je to OK //units pole if (!empty($this->ingameChat)) { usort($this->ingameChat, array('RecAnalyst\\RecAnalyst', 'chatMessagesCompare')); } if (!empty($this->buildings)) { ksort($this->buildings); } // we sort gaia objects, so we can draw first ciffs than relics, // this ensures that relics will overlap cliffs and not vice versa usort($this->gaiaObjects, array('RecAnalyst\\RecAnalyst', 'gaiaObjectsCompare')); // UserPatch population limits if ($this->gameInfo->isUserPatch) { $this->gameSettings->popLimit = 25 * $this->gameSettings->popLimit; } }
/** * Performs post analyze actions. * * @return void */ protected function postAnalyze() { if (!$this->gameSettings->isScenario()) { $lines = explode("\n", $this->gameInfo->objectivesString); // get map if (!$this->isMgx || $this->gameSettings->mapId == Map::CUSTOM) { if (count($lines) > 2) { $this->gameSettings->map = ltrim(strstr($lines[2], ': '), ': '); if (!$this->isMgx) { $map_found = false; //TODO get map from localized map strings } } } } $this->buildTeams(); // fix: player could click age advance, but game finished before reaching specific age foreach ($this->players as $player) { if ($player->feudalTime > $this->gameInfo->playTime) { $player->feudalTime = 0; } if ($player->castleTime > $this->gameInfo->playTime) { $player->castleTime = 0; } if ($player->imperialTime > $this->gameInfo->playTime) { $player->imperialTime = 0; } } if (!empty($this->ingameChat)) { $compareTime = function ($a, $b) { return $a->time - $b->time; }; usort($this->ingameChat, $compareTime); } if (!empty($this->buildings)) { ksort($this->buildings); } // we sort gaia objects, so we can draw first ciffs than relics, // this ensures that relics will overlap cliffs and not vice versa usort($this->gaiaObjects, function ($item1, $item2) { // relics show on top of everything else if ($item1->id === Unit::RELIC && $item2->id !== Unit::RELIC) { return 1; } // cliffs show below everything else if (in_array($item1->id, RecAnalystConst::$CLIFF_UNITS) && !in_array($item2->id, RecAnalystConst::$CLIFF_UNITS)) { return -1; } if ($item2->id === Unit::RELIC && $item1->id !== Unit::RELIC) { return -1; } if (in_array($item2->id, RecAnalystConst::$CLIFF_UNITS) && !in_array($item1->id, RecAnalystConst::$CLIFF_UNITS)) { return 1; } return 0; }); // UserPatch supports pop limits of up to 1000, so that won't normally fit in a byte. // Instead it stores N so that the pop limit is 25*N. if ($this->gameInfo->isUserPatch) { $this->gameSettings->popLimit = 25 * $this->gameSettings->popLimit; } }