[Commits] [wesnoth/wesnoth] da1c8b: rewrite MAKE_ENUM macro

GitHub noreply at github.com
Thu Jun 4 00:10:21 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: da1c8bf60e74b1d4637f3262cfaeea645122ee8f
      https://github.com/wesnoth/wesnoth/commit/da1c8bf60e74b1d4637f3262cfaeea645122ee8f
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2015-06-04 (Thu, 04 Jun 2015)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    M src/actions/attack.cpp
    M src/ai/contexts.cpp
    M src/dialogs.cpp
    M src/editor/map/map_context.cpp
    M src/game_board.cpp
    M src/game_board.hpp
    M src/game_classification.cpp
    M src/game_classification.hpp
    M src/game_config_manager.cpp
    M src/game_end_exceptions.hpp
    M src/game_initialization/configure_engine.cpp
    M src/game_initialization/connect_engine.cpp
    M src/game_initialization/create_engine.cpp
    M src/game_initialization/create_engine.hpp
    M src/game_initialization/multiplayer.cpp
    M src/game_initialization/multiplayer_configure.cpp
    M src/game_initialization/multiplayer_create.cpp
    M src/game_initialization/multiplayer_wait.cpp
    M src/game_initialization/playcampaign.cpp
    M src/game_initialization/singleplayer.cpp
    M src/game_launcher.cpp
    M src/gui/dialogs/advanced_graphics_options.cpp
    M src/gui/dialogs/advanced_graphics_options.hpp
    M src/gui/dialogs/campaign_selection.cpp
    M src/gui/dialogs/editor/editor_edit_side.cpp
    M src/gui/dialogs/game_load.cpp
    M src/image.cpp
    M src/leader_scroll_dialog.cpp
    A src/make_enum.cpp
    M src/make_enum.hpp
    M src/menu_events.cpp
    M src/mp_game_settings.cpp
    M src/mp_game_settings.hpp
    M src/playsingle_controller.cpp
    M src/playturn.cpp
    M src/replay_controller.cpp
    M src/save_index.cpp
    M src/saved_game.cpp
    M src/savegame.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_team.cpp
    M src/scripting/plugins/manager.cpp
    M src/scripting/plugins/manager.hpp
    M src/settings.cpp
    M src/settings.hpp
    M src/side_filter.cpp
    M src/team.cpp
    M src/team.hpp
    M src/terrain_filter.cpp
    M src/tests/gui/test_gui2.cpp
    M src/tests/test_make_enum.cpp
    M src/tests/test_mp_connect.cpp
    M src/tests/utils/play_scenario.cpp
    M src/unit_filter.cpp
    M src/unit_types.cpp
    M src/unit_types.hpp

  Log Message:
  -----------
  rewrite MAKE_ENUM macro

Instead of creating an enum, the MAKE_ENUM macro now creates a struct
which holds an enum and provides functions for enum <-> string
conversion.

This has multiple advantages:
1) We don't need MAKE_ENUM_STREAM_OPS anymore.
2) The generated struct is much easier to use in templates
3) We don't allow implicit to int conversions anymore.
4) The enum values are now declared inside the structs scope.


  Commit: a2b5c18d058bebf5147ed2eb13b9d1b5a631b850
      https://github.com/wesnoth/wesnoth/commit/a2b5c18d058bebf5147ed2eb13b9d1b5a631b850
  Author: gfgtdf <f492343 at rmqkr.net>
  Date:   2015-06-04 (Thu, 04 Jun 2015)

  Changed paths:
    M src/config.hpp
    M src/mp_game_settings.cpp
    M src/team.cpp
    M src/tests/test_make_enum.cpp

  Log Message:
  -----------
  add attribute_value::to_enum and attribute_value::operator=(enum)

which convert attribute_values to classes generated by MAKE_ENUM makro.


Compare: https://github.com/wesnoth/wesnoth/compare/759ab3d4cb58...a2b5c18d058b


More information about the Commits mailing list