Skip to content

Commit

Permalink
fix: game crash during init when there's no config file
Browse files Browse the repository at this point in the history
somehow we can't use `std::unordered_map::emplace` here.
  • Loading branch information
Xenapte committed Feb 24, 2024
1 parent 6dd9b06 commit e3b2e40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions BallanceMMOClient/BallanceMMOClient.cpp
Expand Up @@ -250,8 +250,8 @@ void BallanceMMOClient::OnPostExitLevel() {
countdown_restart_ = false;
force_hs_calibration_ = false;
if (current_level_mode_ == bmmo::level_mode::Highscore && !spectator_mode_) {
if (!level_finished_ && !did_not_finish_)
; //send_dnf_message();
/*if (!level_finished_ && !did_not_finish_)
send_dnf_message();*/
level_finished_ = false;
compensation_lives_label_.reset();
}
Expand Down
12 changes: 6 additions & 6 deletions BallanceMMOClient/config_manager.cpp
Expand Up @@ -66,31 +66,31 @@ void config_manager::init_config() {
auto* tmp_prop = config->GetProperty("Player", "Playername");
tmp_prop->SetComment("Player name. Can only be changed once every 24 hours (countdown starting after joining a server).");
tmp_prop->SetDefaultString(bmmo::name_validator::get_random_nickname().c_str());
props_.emplace("playername", tmp_prop);
props_["playername"] = tmp_prop;
tmp_prop = config->GetProperty("Player", "SpectatorMode");
tmp_prop->SetComment("Whether to connect to the server as a spectator. Spectators are invisible to other players.");
tmp_prop->SetDefaultBoolean(false);
props_.emplace("spectator", tmp_prop);
props_["spectator"] = tmp_prop;
// Validation of player names fails at this stage of initialization
// so we had to put it at the time of post startmenu events.
load_external_config();
config->SetCategoryComment("Gameplay", "Settings for your actual gameplay experience in multiplayer.");
tmp_prop = config->GetProperty("Gameplay", "Extrapolation");
tmp_prop->SetComment("Apply quadratic extrapolation to make movement of balls look smoother at a slight cost of accuracy.");
tmp_prop->SetBoolean(true); // force extrapolation for now
props_.emplace("extrapolation", tmp_prop);
props_["extrapolation"] = tmp_prop;
tmp_prop = config->GetProperty("Gameplay", "PlayerListColor");
tmp_prop->SetComment("Text color of the player list (press Ctrl+Tab to toggle visibility) in hexadecimal RGB format. Default: FFE3A1");
tmp_prop->SetDefaultString("FFE3A1");
props_.emplace("player_list_color", tmp_prop);
props_["player_list_color"] = tmp_prop;
tmp_prop = config->GetProperty("Gameplay", "DynamicOpacity");
tmp_prop->SetComment("Whether to dynamically adjust opacities of other spirit balls based on their distances to the current camera.");
tmp_prop->SetDefaultBoolean(true);
props_.emplace("dynamic_opacity", tmp_prop);
props_["dynamic_opacity"] = tmp_prop;
tmp_prop = config->GetProperty("Gameplay", "SoundNotification");
tmp_prop->SetComment("Whether to play beep sounds in addition to chat notifications on important server events.");
tmp_prop->SetDefaultBoolean(true);
props_.emplace("sound_notification", tmp_prop);
props_["sound_notification"] = tmp_prop;
}

void config_manager::load_external_config() {
Expand Down

0 comments on commit e3b2e40

Please sign in to comment.