minor map manager improvement

This commit is contained in:
Steffen Schröder 2014-02-19 16:53:09 +01:00
parent 911305a68c
commit e9d3445076

View File

@ -409,6 +409,9 @@ class MapManager implements CallbackListener {
* @return Map currentMap * @return Map currentMap
*/ */
public function getCurrentMap() { public function getCurrentMap() {
if (!$this->currentMap) {
return $this->fetchCurrentMap();
}
return $this->currentMap; return $this->currentMap;
} }
@ -446,8 +449,10 @@ class MapManager implements CallbackListener {
// Map already exists, only update index // Map already exists, only update index
$this->currentMap = $this->maps[$callback[1][0]["UId"]]; $this->currentMap = $this->maps[$callback[1][0]["UId"]];
} else { } else {
$rpcMap = \Maniaplanet\DedicatedServer\Structures\Map::fromArray($callback[1][0]);
$this->currentMap = $this->initializeMap($rpcMap);
// TODO: can this ever happen? // TODO: can this ever happen?
$this->fetchCurrentMap(); $this->maniaControl->errorHandler->triggerDebugNotice("new map wasn't fetched yet! ".$callback[1][0]["UId"]);
} }
// Restructure MapList if id is over 15 // Restructure MapList if id is over 15