add default cheat mode behavior flag
This commit is contained in:
@@ -29,6 +29,7 @@ ServerState::ServerState(const char* config_filename, bool is_replay)
|
||||
catch_handler_exceptions(true),
|
||||
ep3_behavior_flags(0),
|
||||
run_shell_behavior(RunShellBehavior::DEFAULT),
|
||||
cheat_mode_behavior(CheatModeBehavior::OFF_BY_DEFAULT),
|
||||
ep3_card_auction_points(0),
|
||||
ep3_card_auction_min_size(0),
|
||||
ep3_card_auction_max_size(0),
|
||||
@@ -744,6 +745,20 @@ void ServerState::parse_config(shared_ptr<const JSONObject> config_json) {
|
||||
} catch (const out_of_range&) {
|
||||
}
|
||||
|
||||
try {
|
||||
const string& behavior = d.at("CheatModeBehavior")->as_string();
|
||||
if (behavior == "Off") {
|
||||
this->cheat_mode_behavior = CheatModeBehavior::OFF;
|
||||
} else if (behavior == "OffByDefault") {
|
||||
this->cheat_mode_behavior = CheatModeBehavior::OFF_BY_DEFAULT;
|
||||
} else if (behavior == "OnByDefault") {
|
||||
this->cheat_mode_behavior = CheatModeBehavior::ON_BY_DEFAULT;
|
||||
} else {
|
||||
throw runtime_error("invalid value for CheatModeBehavior");
|
||||
}
|
||||
} catch (const out_of_range&) {
|
||||
}
|
||||
|
||||
try {
|
||||
auto v = d.at("LobbyEvent");
|
||||
uint8_t event = v->is_int() ? v->as_int() : event_for_name(v->as_string());
|
||||
|
||||
Reference in New Issue
Block a user