[Commits] [wesnoth/wesnoth] 396267: Game Config: added default_color_list= key

GitHub noreply at github.com
Tue Oct 11 14:14:04 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 396267c9009f4cacc0892bfed5b61074c2182686
      https://github.com/wesnoth/wesnoth/commit/396267c9009f4cacc0892bfed5b61074c2182686
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2016-10-12 (Wed, 12 Oct 2016)

  Changed paths:
    M data/game_config.cfg
    M src/game_config.cpp
    M src/game_config.hpp

  Log Message:
  -----------
  Game Config: added default_color_list= key

This key contains the color range ids of the standard colors in the default order.

Previously, classes such as the connect_engine would have to cast ints to strings and browse for the numerically id-ed
color ranges. Consequently, since there are only 9 ranges identified by that method, 9 became a hardcoded number of
colors in certain places. This key allows for greater control over order and content of the default colors.


  Commit: f37bf48562ba5994f49f9e92a00b705d13ddbe98
      https://github.com/wesnoth/wesnoth/commit/f37bf48562ba5994f49f9e92a00b705d13ddbe98
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2016-10-12 (Wed, 12 Oct 2016)

  Changed paths:
    M src/game_initialization/connect_engine.cpp
    M src/game_initialization/connect_engine.hpp

  Log Message:
  -----------
  Connect Engine: refactored handling of colors

Previously, if any [side] color= were specified at all, a new entry would be added at the beginning of the color
options list, regardless of whether it previously existed as an option or not, and the side_engine::color()
variable was set to 0. This was fine for displaying a color as a value in a comobox, but it looked awful
if one actually looked at the list. Additionally, color() could not be used to apply team coloring (either
via ~RC or ~TC) to anything, since it would always be pointing at 0!

This refactors handling to use more dynamic and sensible methods. A copy of the game_config's default color
list initially populates the color options.

* If any value of color= is already found within that selection, color() will be set to that index value.
* If a numerical value is provided instead, that will be used directly.
* If any non-default color is specified, it will be appended to the end of the color options.

This also removes the getters for pango markup for color options. This is outside the scope of this class and
should be handled by any callers.


  Commit: 0d864e07ac991a880bc8107d05521798c5d761e9
      https://github.com/wesnoth/wesnoth/commit/0d864e07ac991a880bc8107d05521798c5d761e9
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2016-10-12 (Wed, 12 Oct 2016)

  Changed paths:
    M src/gui/dialogs/multiplayer/mp_staging.cpp

  Log Message:
  -----------
  MP Staging: updated color handling to match new connect engine functionality


Compare: https://github.com/wesnoth/wesnoth/compare/066c34ae5e84...0d864e07ac99


More information about the Commits mailing list