improved error prevention

This commit is contained in:
Steffen Schröder 2014-06-30 18:48:31 +02:00
parent 8c5b7b4b14
commit 1c94e2da27

View File

@ -562,10 +562,7 @@ class MapManager implements CallbackListener {
* Restructures the Maplist
*/
public function restructureMapList() {
$currentIndex = 0;
if ($this->currentMap) {
$currentIndex = $this->getMapIndex($this->currentMap);
}
$currentIndex = $this->getMapIndex($this->getCurrentMap());
// No RestructureNeeded
if ($currentIndex < Maplist::MAX_MAPS_PER_PAGE - 1) {
@ -625,6 +622,18 @@ class MapManager implements CallbackListener {
return array_slice($this->maps, $offset, $length);
}
/**
* Get Current Map
*
* @return Map
*/
public function getCurrentMap() {
if (!$this->currentMap) {
return $this->fetchCurrentMap();
}
return $this->currentMap;
}
/**
* Handle OnInit callback
*/
@ -644,18 +653,6 @@ class MapManager implements CallbackListener {
$this->mxManager->fetchManiaExchangeMapInformation();
}
/**
* Get Current Map
*
* @return Map
*/
public function getCurrentMap() {
if (!$this->currentMap) {
return $this->fetchCurrentMap();
}
return $this->currentMap;
}
/**
* Handle Script BeginMap callback
*