Settings of Legacy-Modes and client-functions have sometimes different names, calls could not be executed, fixed now
This commit is contained in:
parent
67c9180f9c
commit
5956bb292d
@ -162,12 +162,27 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setGameModeSettingsArray(array $settings) {
|
public function setGameModeSettingsArray(array $settings) {
|
||||||
|
static $settingToMethodReplace = array(
|
||||||
|
'LapsNbLaps' => 'SetNbLaps',
|
||||||
|
'RoundsForcedLaps' => 'SetRoundForcedLaps',
|
||||||
|
'RoundsPointsLimit' => 'SetRoundPointsLimit',
|
||||||
|
'RoundsUseNewRules' => 'SetUseNewRulesRound',
|
||||||
|
'TeamMaxPoints' => 'SetMaxPointsTeam',
|
||||||
|
'TeamUseNewRules' => 'SetUseNewRulesTeam',
|
||||||
|
);
|
||||||
|
|
||||||
if ($this->maniaControl->getServer()->getScriptManager()->isScriptMode()) {
|
if ($this->maniaControl->getServer()->getScriptManager()->isScriptMode()) {
|
||||||
return $this->maniaControl->getClient()->setModeScriptSettings($settings);
|
return $this->maniaControl->getClient()->setModeScriptSettings($settings);
|
||||||
} else {
|
} else {
|
||||||
$success = true;
|
$success = true;
|
||||||
foreach ($settings as $key => $value) {
|
foreach ($settings as $key => $value) {
|
||||||
$success &= $this->maniaControl->getClient()->execute('Set'.$key, array($value));
|
if (array_key_exists($key, $settingToMethodReplace)) {
|
||||||
|
$key = $settingToMethodReplace[$key];
|
||||||
|
} else {
|
||||||
|
$key = 'Set'.$key;
|
||||||
|
}
|
||||||
|
|
||||||
|
$success &= $this->maniaControl->getClient()->execute($key, array($value));
|
||||||
}
|
}
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user