changed direct public access of maniacontrol properties to using getter methods

This commit is contained in:
Steffen Schröder
2014-08-03 01:34:18 +02:00
parent e560919096
commit 4d3dc92ad5
64 changed files with 2337 additions and 2055 deletions

View File

@ -81,10 +81,10 @@ class ManiaExchangeManager {
$maps = array($maps);
} else {
// Fetch Information for whole MapList
$maps = $this->maniaControl->mapManager->getMaps();
$maps = $this->maniaControl->getMapManager()->getMaps();
}
$mysqli = $this->maniaControl->database->mysqli;
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
$mapIdString = '';
// Fetch mx ids
@ -100,7 +100,7 @@ class ManiaExchangeManager {
foreach ($maps as $map) {
if (!$map) {
// TODO: remove after resolving of error report about "non-object"
$this->maniaControl->errorHandler->triggerDebugNotice('Non-Object-Map', $map, $maps);
$this->maniaControl->getErrorHandler()->triggerDebugNotice('Non-Object-Map', $map, $maps);
continue;
}
/** @var Map $map */
@ -153,13 +153,13 @@ class ManiaExchangeManager {
*/
public function fetchMaplistByMixedUidIdString($string) {
// Get Title Prefix
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
// compile search URL
$url = "http://api.mania-exchange.com/{$titlePrefix}/maps/?ids={$string}";
$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) {
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) {
if ($error) {
trigger_error("Error: '{$error}' for Url '{$url}'");
return;
@ -194,7 +194,7 @@ class ManiaExchangeManager {
* @param array $mxMapInfos
*/
public function updateMapObjectsWithManiaExchangeIds(array $mxMapInfos) {
$mysqli = $this->maniaControl->database->mysqli;
$mysqli = $this->maniaControl->getDatabase()->getMysqli();
// Save map data
$saveMapQuery = "UPDATE `" . MapManager::TABLE_MAPS . "`
SET `mxid` = ?
@ -220,7 +220,7 @@ class ManiaExchangeManager {
} else {
$uid = $mxMapInfo->uid;
}
$map = $this->maniaControl->mapManager->getMapByUid($uid);
$map = $this->maniaControl->getMapManager()->getMapByUid($uid);
if ($map) {
// TODO: how does it come that $map can be empty here? we got an error report for that
/** @var Map $map */
@ -247,13 +247,13 @@ class ManiaExchangeManager {
*/
public function fetchMapInfo($mapId, callable $function) {
// Get Title Prefix
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
// compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $mapId;
$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix, $url) {
$mxMapInfo = null;
if ($error) {
trigger_error($error);
@ -294,8 +294,8 @@ class ManiaExchangeManager {
// TODO: remove $env because it's not really used?
// Get Title Id
$titleId = $this->maniaControl->server->titleId;
$titlePrefix = $this->maniaControl->mapManager->getCurrentMap()
$titleId = $this->maniaControl->getServer()->titleId;
$titlePrefix = $this->maniaControl->getMapManager()->getCurrentMap()
->getGame();
// compile search URL
@ -322,13 +322,13 @@ class ManiaExchangeManager {
// Get MapTypes
try {
$scriptInfos = $this->maniaControl->client->getModeScriptInfo();
$scriptInfos = $this->maniaControl->getClient()->getModeScriptInfo();
$mapTypes = $scriptInfos->compatibleMapTypes;
$url .= '&mtype=' . $mapTypes;
} catch (GameModeException $e) {
}
$this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
$this->maniaControl->getFileReader()->loadFile($url, function ($mapInfo, $error) use (&$function, $titlePrefix) {
if ($error) {
trigger_error($error);
return;