small fix

This commit is contained in:
kremsy 2014-02-16 00:51:30 +01:00 committed by Steffen Schröder
parent b2c2c98c78
commit fb1f12b8b4
2 changed files with 14 additions and 16 deletions

View File

@ -44,22 +44,19 @@ class Map {
public function __construct($mpMap = null) { public function __construct($mpMap = null) {
$this->startTime = time(); $this->startTime = time();
if(!$mpMap) { if (!$mpMap) {
return; return;
} }
$this->name = FORMATTER::stripDirtyCodes($mpMap->name); $this->name = FORMATTER::stripDirtyCodes($mpMap->name);
$this->uid = $mpMap->uId; $this->uid = $mpMap->uId;
$this->fileName = $mpMap->fileName; $this->fileName = $mpMap->fileName;
$this->authorLogin = $mpMap->author; $this->authorLogin = $mpMap->author;
$this->environment = $mpMap->environnement; $this->environment = $mpMap->environnement;
$this->goldTime = $mpMap->goldTime; $this->goldTime = $mpMap->goldTime;
$this->copperPrice = $mpMap->copperPrice; $this->copperPrice = $mpMap->copperPrice;
$this->mapType = $mpMap->mapType; $this->mapType = $mpMap->mapType;
$this->mapStyle = $mpMap->mapStyle; $this->mapStyle = $mpMap->mapStyle;
$this->nbCheckpoints = $mpMap->nbCheckpoints;
if(isset($mpMap->nbCheckpoints)) {
$this->nbCheckpoints = $mpMap->nbCheckpoints;
}
$this->authorNick = $this->authorLogin; $this->authorNick = $this->authorLogin;
} }
@ -71,7 +68,7 @@ class Map {
*/ */
public function updateAvailable() { public function updateAvailable() {
if($this->mx != null && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) { if ($this->mx != null && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -375,7 +375,8 @@ class MapManager implements CallbackListener {
$rpcMap = $this->maniaControl->client->getCurrentMapInfo(); $rpcMap = $this->maniaControl->client->getCurrentMapInfo();
if (array_key_exists($rpcMap->uId, $this->maps)) { if (array_key_exists($rpcMap->uId, $this->maps)) {
$this->currentMap = $this->maps[$rpcMap->uId]; $this->currentMap = $this->maps[$rpcMap->uId];
$this->currentMap->nbCheckpoints = $rpcMap->nbCheckpoints;
return true; return true;
} }
$map = $this->initializeMap($rpcMap); $map = $this->initializeMap($rpcMap);