allow event and ep3 menu song to be specified in config.json

This commit is contained in:
Martin Michelsen
2022-07-13 23:36:56 -07:00
parent 37b7119ea5
commit 5f836711c7
2 changed files with 26 additions and 0 deletions
+14
View File
@@ -20,6 +20,7 @@
#include "Server.hh"
#include "ServerShell.hh"
#include "ServerState.hh"
#include "StaticGameData.hh"
#include "Text.hh"
using namespace std;
@@ -160,6 +161,19 @@ void populate_state_from_config(shared_ptr<ServerState> s,
ServerState::RunShellBehavior::ALWAYS :
ServerState::RunShellBehavior::NEVER;
} 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());
s->pre_lobby_event = event;
for (const auto& l : s->all_lobbies()) {
l->event = event;
}
} catch (const out_of_range&) { }
try {
s->ep3_menu_song = d.at("Episode3MenuSong")->as_int();
} catch (const out_of_range&) { }
}