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&) { }
}
+12
View File
@@ -186,6 +186,18 @@
// BB users.
"WelcomeMessage": "",
// Default lobby event. If set, this sets the holiday event in all lobbies at
// server start time, as well as the pre-lobby holiday event. The event can be
// changed in each lobby independently with the $event command, or in all
// lobbies with the $allevent command. When a game is created, it inherits the
// holiday event from the lobby from which it was created.
// The value for this field can be a string like "xmas" (the values have the
// same meanings as the $event command), or an integer.
// "LobbyEvent": "xmas",
// Episode 3 menu song. If set, Episode 3 clients will hear this song when
// they are at the newserv main menu. If set, this value must be an integer.
// "Episode3MenuSong": 0,
// By default, the server keeps track of items in all games, even for versions
// other than Blue Burst. This enables use of the $what command, as well as
// protection against item duplication cheats (the cheater is disconnected