Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PluginSettings class to deprecate other class
- Loading branch information
Showing
2 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// | ||
// Created by Vladimir Jimenez on 8/4/15. | ||
// Copyright (c) 2015 BZFlag. All rights reserved. | ||
// | ||
|
||
#include "PluginSettings.h" | ||
|
||
void PluginSettings::loadConfig (char const *filePath) | ||
{ | ||
loadConfigurationFile(filePath); | ||
} | ||
|
||
std::string PluginSettings::getSpawnCommandPerm (void) | ||
{ | ||
return root.getChild("spawn_command_perm").getString(); | ||
} | ||
|
||
std::string PluginSettings::getMatchReportURL (void) | ||
{ | ||
return root.getChild("match_report_url").getString(); | ||
} | ||
|
||
std::string PluginSettings::getShowHiddenPerm (void) | ||
{ | ||
return root.getChild("show_hidden_perm").getString(); | ||
} | ||
|
||
std::string PluginSettings::getMapChangePath (void) | ||
{ | ||
return root.getChild("mapchange_path").getString(); | ||
} | ||
|
||
std::string PluginSettings::getTeamNameURL (void) | ||
{ | ||
return root.getChild("team_name_url").getString(); | ||
} | ||
|
||
std::string PluginSettings::getLeagueGroup (void) | ||
{ | ||
return root.getChild("league_group").getString(); | ||
} | ||
|
||
std::string PluginSettings::getMottoFormat (void) | ||
{ | ||
return root.getChild("motto_format").getString(); | ||
} | ||
|
||
bool PluginSettings::areOfficialMatchesDisabled (void) | ||
{ | ||
return root.getChild("disable_official_matches").getBool(); | ||
} | ||
|
||
bool PluginSettings::isInterPluginCheckEnabled (void) | ||
{ | ||
return root.getChild("interplugin_api_check").getBool(); | ||
} | ||
|
||
bool PluginSettings::areFunMatchesDisabled (void) | ||
{ | ||
return root.getChild("disable_fun_matches").getBool(); | ||
} | ||
|
||
bool PluginSettings::isPcProtectionEnabled (void) | ||
{ | ||
return root.getChild("pc_protection_enabled").getBool(); | ||
} | ||
|
||
bool PluginSettings::ignoreTimeSanityCheck (void) | ||
{ | ||
return root.getChild("ignore_time_checks").getBool(); | ||
} | ||
|
||
bool PluginSettings::isInGameDebugEnabled (void) | ||
{ | ||
return root.getChild("in_game_debug_enabled").getBool(); | ||
} | ||
|
||
bool PluginSettings::isMatchReportEnabled (void) | ||
{ | ||
return root.getChild("match_report_enabled").getBool(); | ||
} | ||
|
||
bool PluginSettings::isMottoFetchEnabled (void) | ||
{ | ||
return root.getChild("motto_fetch_enabled").getBool(); | ||
} | ||
|
||
bool PluginSettings::isRotationalLeague (void) | ||
{ | ||
return root.getChild("rotational_league").getBool(); | ||
} | ||
|
||
int PluginSettings::getDefaultTimeLimit (void) | ||
{ | ||
return root.getChild("default_time_limit").getInt(); | ||
} | ||
|
||
int PluginSettings::getVerboseLevel (void) | ||
{ | ||
return root.getChild("verbose_level").getInt(); | ||
} | ||
|
||
int PluginSettings::getDebugLevel (void) | ||
{ | ||
return root.getChild("debug_level").getInt(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// Created by Vladimir Jimenez on 8/4/15. | ||
// Copyright (c) 2015 BZFlag. All rights reserved. | ||
// | ||
|
||
|
||
#ifndef __PluginSettings_H_ | ||
#define __PluginSettings_H_ | ||
|
||
#include "bz_JsonConfig.h" | ||
|
||
class PluginSettings : public bz_JsonConfig | ||
{ | ||
public: | ||
enum GameMode { | ||
OFFICIAL, | ||
FM, | ||
IDLE, | ||
LAST_GAMEMODE | ||
}; | ||
|
||
void loadConfig (const char* filePath); | ||
|
||
std::vector<std::string> getGuestMessagingMessage (GameMode mode); | ||
std::vector<std::string> getGuestSpawningMessage (GameMode mode); | ||
|
||
std::string getSpawnCommandPerm (void); | ||
std::string getMatchReportURL (void); | ||
std::string getShowHiddenPerm (void); | ||
std::string getMapChangePath (void); | ||
std::string getTeamNameURL (void); | ||
std::string getLeagueGroup (void); | ||
std::string getMottoFormat (void); | ||
|
||
bool areOfficialMatchesDisabled (void); | ||
bool isInterPluginCheckEnabled (void); | ||
bool isGuestMessagingEnable (GameMode mode); | ||
bool areFunMatchesDisabled (void); | ||
bool isGuestSpawningEnable (GameMode mode); | ||
bool isPcProtectionEnabled (void); | ||
bool isSpawnMessageEnabled (void); | ||
bool ignoreTimeSanityCheck (void); | ||
bool isInGameDebugEnabled (void); | ||
bool isMatchReportEnabled (void); | ||
bool isTalkMessageEnabled (void); | ||
bool isMottoFetchEnabled (void); | ||
bool isAllowLimitedChat (void); | ||
bool isRotationalLeague (void); | ||
|
||
int getDefaultTimeLimit (void); | ||
int getVerboseLevel (void); | ||
int getDebugLevel (void); | ||
}; | ||
|
||
#endif |