From fb1f12b8b4d8ed7253de12b2a64f4e206301263c Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 16 Feb 2014 00:51:30 +0100 Subject: [PATCH] small fix --- application/core/Maps/Map.php | 27 ++++++++++++--------------- application/core/Maps/MapManager.php | 3 ++- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/application/core/Maps/Map.php b/application/core/Maps/Map.php index ee1b0c8c..682be850 100644 --- a/application/core/Maps/Map.php +++ b/application/core/Maps/Map.php @@ -44,22 +44,19 @@ class Map { public function __construct($mpMap = null) { $this->startTime = time(); - if(!$mpMap) { + if (!$mpMap) { return; } - $this->name = FORMATTER::stripDirtyCodes($mpMap->name); - $this->uid = $mpMap->uId; - $this->fileName = $mpMap->fileName; - $this->authorLogin = $mpMap->author; - $this->environment = $mpMap->environnement; - $this->goldTime = $mpMap->goldTime; - $this->copperPrice = $mpMap->copperPrice; - $this->mapType = $mpMap->mapType; - $this->mapStyle = $mpMap->mapStyle; - - if(isset($mpMap->nbCheckpoints)) { - $this->nbCheckpoints = $mpMap->nbCheckpoints; - } + $this->name = FORMATTER::stripDirtyCodes($mpMap->name); + $this->uid = $mpMap->uId; + $this->fileName = $mpMap->fileName; + $this->authorLogin = $mpMap->author; + $this->environment = $mpMap->environnement; + $this->goldTime = $mpMap->goldTime; + $this->copperPrice = $mpMap->copperPrice; + $this->mapType = $mpMap->mapType; + $this->mapStyle = $mpMap->mapStyle; + $this->nbCheckpoints = $mpMap->nbCheckpoints; $this->authorNick = $this->authorLogin; } @@ -71,7 +68,7 @@ class Map { */ 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; } else { return false; diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index c5bb0983..e69c1cf3 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -375,7 +375,8 @@ class MapManager implements CallbackListener { $rpcMap = $this->maniaControl->client->getCurrentMapInfo(); 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; } $map = $this->initializeMap($rpcMap);