improved error prevention
This commit is contained in:
		| @@ -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 | ||||
| 	 * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user