Cockatrice/libcockatrice_settings/libcockatrice/settings/game_settings.cpp
DawnFire42 6ea68c3f58
[Game] Add Command Zone support with commander tax tracking
- Add CommandZone and CommandZoneLogic for commander
  - Add CommanderTaxCounter
  - Add counter active state protocol (show/hide tax counters)
  - Add "Enable Command Zone" option in game creation dialogs
  - Add context menu actions for command zone operations

Took 9 minutes

Took 11 minutes
2026-08-10 18:32:17 -04:00

186 lines
4.6 KiB
C++

#include "game_settings.h"
GameSettings::GameSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "game.ini", QString(), QString(), parent)
{
}
QString GameSettings::getGameDescription() const
{
return getValue("gameDescription", "game").toString();
}
int GameSettings::getMaxPlayers() const
{
return getValue("maxPlayers", "game", QString(), 2).toInt();
}
QString GameSettings::getGameTypes() const
{
return getValue("gameTypes", "game").toString();
}
bool GameSettings::getOnlyBuddies() const
{
return getValue("onlyBuddies", "game").toBool();
}
bool GameSettings::getOnlyRegistered() const
{
return getValue("onlyRegistered", "game").toBool();
}
bool GameSettings::getSpectatorsAllowed() const
{
return getValue("spectatorsAllowed", "game").toBool();
}
bool GameSettings::getSpectatorsNeedPassword() const
{
return getValue("spectatorsNeedPassword", "game").toBool();
}
bool GameSettings::getSpectatorsCanTalk() const
{
return getValue("spectatorsCanTalk", "game").toBool();
}
bool GameSettings::getSpectatorsCanSeeEverything() const
{
return getValue("spectatorsCanSeeEverything", "game").toBool();
}
bool GameSettings::getCreateGameAsSpectator() const
{
return getValue("createGameAsSpectator", "game").toBool();
}
int GameSettings::getDefaultStartingLifeTotal() const
{
return getValue("defaultStartingLifeTotal", "game", QString(), 20).toInt();
}
bool GameSettings::getShareDecklistsOnLoad() const
{
return getValue("shareDecklistsOnLoad", "game").toBool();
}
bool GameSettings::getRememberGameSettings() const
{
return getValue("rememberGameSettings", "game", QString(), true).toBool();
}
bool GameSettings::getEnableCommandZone() const
{
return getValue("enablecommandzone", "game").toBool();
}
bool GameSettings::getLocalGameRememberSettings() const
{
return getValue("rememberSettings", "localgameoptions").toBool();
}
int GameSettings::getLocalGameMaxPlayers() const
{
return getValue("maxPlayers", "localgameoptions", QString(), 1).toInt();
}
int GameSettings::getLocalGameStartingLifeTotal() const
{
return getValue("startingLifeTotal", "localgameoptions", QString(), 20).toInt();
}
bool GameSettings::getLocalGameEnableCommandZone() const
{
return getValue("enablecommandzone", "localgameoptions").toBool();
}
void GameSettings::setGameDescription(const QString &_gameDescription)
{
setValue(_gameDescription, "gameDescription", "game");
}
void GameSettings::setMaxPlayers(int _maxPlayers)
{
setValue(_maxPlayers, "maxPlayers", "game");
}
void GameSettings::setGameTypes(const QString &_gameTypes)
{
setValue(_gameTypes, "gameTypes", "game");
}
void GameSettings::setOnlyBuddies(bool _onlyBuddies)
{
setValue(_onlyBuddies, "onlyBuddies", "game");
}
void GameSettings::setOnlyRegistered(bool _onlyRegistered)
{
setValue(_onlyRegistered, "onlyRegistered", "game");
}
void GameSettings::setSpectatorsAllowed(bool _spectatorsAllowed)
{
setValue(_spectatorsAllowed, "spectatorsAllowed", "game");
}
void GameSettings::setSpectatorsNeedPassword(bool _spectatorsNeedPassword)
{
setValue(_spectatorsNeedPassword, "spectatorsNeedPassword", "game");
}
void GameSettings::setSpectatorsCanTalk(bool _spectatorsCanTalk)
{
setValue(_spectatorsCanTalk, "spectatorsCanTalk", "game");
}
void GameSettings::setSpectatorsCanSeeEverything(bool _spectatorsCanSeeEverything)
{
setValue(_spectatorsCanSeeEverything, "spectatorsCanSeeEverything", "game");
}
void GameSettings::setCreateGameAsSpectator(bool _createGameAsSpectator)
{
setValue(_createGameAsSpectator, "createGameAsSpectator", "game");
}
void GameSettings::setDefaultStartingLifeTotal(int _defaultStartingLifeTotal)
{
setValue(_defaultStartingLifeTotal, "defaultStartingLifeTotal", "game");
}
void GameSettings::setShareDecklistsOnLoad(bool _shareDecklistsOnLoad)
{
setValue(_shareDecklistsOnLoad, "shareDecklistsOnLoad", "game");
}
void GameSettings::setRememberGameSettings(bool _rememberGameSettings)
{
setValue(_rememberGameSettings, "rememberGameSettings", "game");
}
void GameSettings::setEnableCommandZone(bool _enableCommandZone)
{
setValue(_enableCommandZone, "enablecommandzone", "game");
}
void GameSettings::setLocalGameRememberSettings(bool value)
{
setValue(value, "rememberSettings", "localgameoptions");
}
void GameSettings::setLocalGameMaxPlayers(int value)
{
setValue(value, "maxPlayers", "localgameoptions");
}
void GameSettings::setLocalGameStartingLifeTotal(int value)
{
setValue(value, "startingLifeTotal", "localgameoptions");
}
void GameSettings::setLocalGameEnableCommandZone(bool value)
{
setValue(value, "enablecommandzone", "localgameoptions");
}