[wesnoth-commits] [wesnoth/wesnoth] 86b3e6: Loading Screen: refactor and clean up implementati...

GitHub noreply at github.com
Wed Apr 18 02:56:54 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 86b3e6959b19a24c494ac4b71b70b9820295b4e7
      https://github.com/wesnoth/wesnoth/commit/86b3e6959b19a24c494ac4b71b70b9820295b4e7
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2018-04-18 (Wed, 18 Apr 2018)

  Changed paths:
    M src/gui/dialogs/loading_screen.cpp
    M src/gui/dialogs/loading_screen.hpp

  Log Message:
  -----------
  Loading Screen: refactor and clean up implementation

This covers several things:

Instead of creating a new worker thread manually and having it set class member state flags,
I instead utilized std::future and std::async. As far as I can tell, this should avoid the
(albeit unlikely) potential race condition wherein the ls could close before loading at all
if the thread was delayed in starting.

Removed the timer interface and split it into two components:
* A drawing callback that handles the animation. This has its granularity retained at 100 ms,
  but can be easily adjusted if we want it to go faster.
* A pump monitor that runs much more frequently (every time events::run_event_loop is called,
  technically). This handles checking the state of the std::future object and will then close
  the window. This makes the loading screen a bit speedier compared to the previous iteration
  since it no longer wastes time waiting for the next timer callback to close.

The one bit I'm not 100% sure about is the check for the future object's ready state in the dtor.
Though, relatedly, I wonder if perhaps we should wait for the worker thread to complete in that
case instead of exiting....

Also shuffled a few things around, such as immediately setting enter/esc disabled in pre_show
instead of waiting for everything there to finish.

Do note there occasionally seem to be a few odd issues with the dot animation after this commit.
Will look into that. But it may be some texture cache-related issue...

This also cleans up some unused log defines and a VS 2013 conditional include.


  Commit: be4b2c246f50af78f2271937e37685d469535768
      https://github.com/wesnoth/wesnoth/commit/be4b2c246f50af78f2271937e37685d469535768
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2018-04-18 (Wed, 18 Apr 2018)

  Changed paths:
    M src/serialization/binary_or_text.cpp

  Log Message:
  -----------
  Random formatting cleanup I had sitting around


Compare: https://github.com/wesnoth/wesnoth/compare/fc88cdff3b04...be4b2c246f50


More information about the Commits mailing list