[wesnoth-commits] [wesnoth/wesnoth] 259efa: MP/User Info: made state and relation stateless

Charles Dang noreply at github.com
Tue Nov 9 19:05:57 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 259efa1acb48f0d7252235cabf4eb2e5b843aad0
      https://github.com/wesnoth/wesnoth/commit/259efa1acb48f0d7252235cabf4eb2e5b843aad0
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2021-11-09 (Tue, 09 Nov 2021)

  Changed paths:
    M src/game_initialization/lobby_data.cpp
    M src/game_initialization/lobby_data.hpp
    M src/game_initialization/lobby_info.cpp
    M src/game_initialization/lobby_info.hpp
    M src/gui/dialogs/multiplayer/lobby.cpp
    M src/gui/dialogs/multiplayer/lobby.hpp
    M src/gui/dialogs/multiplayer/lobby_player_list_helper.cpp
    M src/gui/dialogs/multiplayer/lobby_player_list_helper.hpp
    M src/gui/dialogs/multiplayer/player_info.cpp
    M src/gui/dialogs/multiplayer/player_info.hpp

  Log Message:
  -----------
  MP/User Info: made state and relation stateless

Instead of storing these as state value which need to be queried, just use query functions.
This allows us to remove the state update code in the lobby and lobby_info, as well as passing
a pointer-to-coint to the Player Info dialog instead of having it manually set the relation state
itself.

This is slightly less efficient when creating the user_info objects since preferences::is_friend
and preferences::is_ignored can now be called twice, but that's negligible. I might return to a
state variable for relation at some point, but in some other guise.





More information about the Commits mailing list