[Widelands-dev] [Merge] lp:~widelands-dev/widelands/per-level-soldier-anims into lp:widelands

2019-04-12 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4713. State: failed. Details: 
https://travis-ci.org/widelands/widelands/builds/519271269.
Appveyor build 4499. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_per_level_soldier_anims-4499.
-- 
https://code.launchpad.net/~widelands-dev/widelands/per-level-soldier-anims/+merge/354929
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/per-level-soldier-anims into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/cleanup-soundhandler into lp:widelands

2019-04-12 Thread Klaus Halfmann
Review: Approve reiew, compile, testplay

I played some internet game with this brnahc and it was ok, felt a bit slow, 
though.

Completed the review, code is fine, please check some nits:
 * some functions should be inlined.
 * Once this is in r21 I would like to do a performace review
 * Mabye we could make more of this run in a seperate thread / cpu?

This can go in in r21 anytime now.



Diff comments:

> 
> === modified file 'src/sound/sound_handler.cc'
> --- src/sound/sound_handler.cc2019-02-23 11:00:49 +
> +++ src/sound/sound_handler.cc2019-04-09 04:52:18 +
> @@ -199,476 +176,461 @@
>   fx_lock_ = nullptr;
>   }
>  
> - songs_.clear();
> - fxs_.clear();
> -
>   Mix_Quit();
>   SDL_QuitSubSystem(SDL_INIT_AUDIO);
>  }
>  
> -/** Read the main config file, load background music and systemwide sound fx
> - *
> +/// Prints an error and disables and shuts down the sound system.
> +void SoundHandler::initialization_error(const char* const msg, bool 
> quit_sdl) {
> + log("WARNING: Failed to initialize sound system: %s\n", msg);
> + SoundHandler::disable_backend();
> + if (quit_sdl) {
> + SDL_QuitSubSystem(SDL_INIT_AUDIO);
> + }
> + return;
> +}
> +
> +/**
> + * Load the sound options from g_options. If an option is not available, use 
> the defaults set by the constructor.
>   */
>  void SoundHandler::read_config() {
> - Section& s = g_options.pull_section("global");
> -
> - if (nosound_) {
> - set_disable_music(true);
> - set_disable_fx(true);
> - } else {
> - set_disable_music(s.get_bool("disable_music", false));
> - set_disable_fx(s.get_bool("disable_fx", false));
> - music_volume_ = s.get_int("music_volume", kDefaultMusicVolume);
> - fx_volume_ = s.get_int("fx_volume", kDefaultFxVolume);
> - }
> -
> - random_order_ = s.get_bool("sound_random_order", true);
> -
> - register_song("music", "intro");
> - register_song("music", "menu");
> - register_song("music", "ingame");
> -}
> -
> -/** Load systemwide sound fx into memory.
> - * \note This loads only systemwide fx. Worker/building fx will be loaded by
> - * their respective conf-file parsers
> - */
> -void SoundHandler::load_system_sounds() {
> - load_fx_if_needed("sound", "click", "click");
> - load_fx_if_needed("sound", "create_construction_site", 
> "create_construction_site");
> - load_fx_if_needed("sound", "message", "message");
> - load_fx_if_needed("sound/military", "under_attack", 
> "military/under_attack");
> - load_fx_if_needed("sound/military", "site_occupied", 
> "military/site_occupied");
> - load_fx_if_needed("sound", "lobby_chat", "lobby_chat");
> - load_fx_if_needed("sound", "lobby_freshmen", "lobby_freshmen");
> -}
> -
> -/**
> - * Returns 'true' if the playing of sounds is disabled due to sound driver 
> problems.
> - */
> -bool SoundHandler::is_backend_disabled() const {
> - return is_backend_disabled_;
> -}
> -
> -/** Load a sound effect. One sound effect can consist of several audio files
> + // TODO(GunChleoc): Compatibility code to avoid getting bug reports 
> about unread sections. Remove after Build 21.
> + if (g_options.get_section("sound") == nullptr) {
> + Section& global = g_options.pull_section("global");
> +
> + for (auto& option : sound_options_) {
> + switch (option.first) {
> + case SoundType::kMusic:
> + option.second.volume = 
> global.get_int("music_volume", option.second.volume);
> + option.second.enabled = 
> !global.get_bool("disable_music", !option.second.enabled);
> + break;
> + case SoundType::kChat:
> + option.second.volume = 
> global.get_int("fx_volume", option.second.volume);
> + option.second.enabled = 
> global.get_bool("sound_at_message", option.second.enabled);
> + break;
> + default:
> + option.second.volume = 
> global.get_int("fx_volume", option.second.volume);
> + option.second.enabled = 
> !global.get_bool("disable_fx", !option.second.enabled);
> + break;
> + }
> + }
> + save_config();
> + }
> +
> + // This is the code that we want to keep
> + Section& sound = g_options.pull_section("sound");
> + for (auto& option : sound_options_) {
> + option.second.volume = sound.get_int(("volume_" + 
> option.second.name).c_str(), option.second.volume);
> + option.second.enabled = sound.get_bool(("enable_" + 
> option.second.name).c_str(), option.second.enabled);
> + }
> +}
> +
> +/// Save the current sound options to g_options
> +void SoundHandle