resolved warning

This commit is contained in:
Steffen Schröder 2014-05-15 14:42:01 +02:00
parent 62d8feeb47
commit 987254970c

View File

@ -277,7 +277,6 @@ class MapManager implements CallbackListener {
private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) { private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) {
// Check if map is already on the server // Check if map is already on the server
if ($this->getMapByUid($mapInfo->uid)) { if ($this->getMapByUid($mapInfo->uid)) {
// Download error
$this->maniaControl->chat->sendError('Map is already on the server!', $login); $this->maniaControl->chat->sendError('Map is already on the server!', $login);
return; return;
} }
@ -323,7 +322,6 @@ class MapManager implements CallbackListener {
try { try {
$this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName); $this->maniaControl->client->checkMapForCurrentServerParams($relativeMapFileName);
} catch (InvalidMapException $e) { } catch (InvalidMapException $e) {
trigger_error("Couldn't check if map is valid ('{$relativeMapFileName}'). " . $e->getMessage());
$this->maniaControl->chat->sendError('Wrong MapType or not validated!', $login); $this->maniaControl->chat->sendError('Wrong MapType or not validated!', $login);
return; return;
} }
@ -336,10 +334,13 @@ class MapManager implements CallbackListener {
$this->maniaControl->mapManager->mxManager->updateMapObjectsWithManiaExchangeIds(array($mapInfo)); $this->maniaControl->mapManager->mxManager->updateMapObjectsWithManiaExchangeIds(array($mapInfo));
// Update last updated time // Update last updated time
$map = $this->maps[$mapInfo->uid]; $map = $this->getMapByUid($mapInfo->uid);
/** if (!$map) {
* @var Map $map // TODO: improve this - error reports about not existing maps
*/ $this->maniaControl->errorHandler->triggerDebugNotice('Map not in List after Insert!');
$this->maniaControl->chat->sendError('Server Error!', $login);
return;
}
$map->lastUpdate = time(); $map->lastUpdate = time();
$player = $this->maniaControl->playerManager->getPlayer($login); $player = $this->maniaControl->playerManager->getPlayer($login);
@ -365,10 +366,10 @@ class MapManager implements CallbackListener {
* @return Map * @return Map
*/ */
public function getMapByUid($uid) { public function getMapByUid($uid) {
if (!isset($this->maps[$uid])) { if (isset($this->maps[$uid])) {
return null; return $this->maps[$uid];
} }
return $this->maps[$uid]; return null;
} }
/** /**
@ -386,7 +387,8 @@ class MapManager implements CallbackListener {
if (array_key_exists($rpcMap->uId, $this->maps)) { if (array_key_exists($rpcMap->uId, $this->maps)) {
// Map already exists, only update index // Map already exists, only update index
$tempList[$rpcMap->uId] = $this->maps[$rpcMap->uId]; $tempList[$rpcMap->uId] = $this->maps[$rpcMap->uId];
} else { // Insert Map Object } else {
// Insert Map Object
$map = $this->initializeMap($rpcMap); $map = $this->initializeMap($rpcMap);
$tempList[$map->uid] = $map; $tempList[$map->uid] = $map;
} }