Merge lp:~widelands-dev/widelands/bug-1343297_2 into lp:widelands
- bug-1343297_2
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7176 |
Proposed branch: | lp:~widelands-dev/widelands/bug-1343297_2 |
Merge into: | lp:widelands |
Diff against target: |
53800 lines (+9283/-9239) 573 files modified
cmake/codecheck/rules/camel_case_for_classes (+42/-0) cmake/codecheck/rules/do_not_use_typedef (+24/-0) src/ai/ai_help_structs.h (+1/-1) src/ai/computer_player.cc (+13/-13) src/ai/computer_player.h (+9/-11) src/ai/defaultai.cc (+23/-23) src/ai/defaultai.h (+12/-12) src/base/exceptions.cc (+6/-6) src/base/md5.cc (+4/-4) src/base/md5.h (+11/-11) src/base/warning.h (+3/-3) src/base/wexception.h (+5/-5) src/economy/cmd_call_economy_balance.cc (+10/-10) src/economy/cmd_call_economy_balance.h (+9/-9) src/economy/economy.cc (+40/-43) src/economy/economy.h (+28/-28) src/economy/economy_data_packet.cc (+17/-17) src/economy/economy_data_packet.h (+2/-2) src/economy/flag.cc (+13/-13) src/economy/flag.h (+22/-22) src/economy/fleet.cc (+18/-18) src/economy/fleet.h (+12/-12) src/economy/idleworkersupply.cc (+1/-1) src/economy/idleworkersupply.h (+1/-1) src/economy/portdock.cc (+13/-13) src/economy/portdock.h (+9/-9) src/economy/request.cc (+14/-14) src/economy/request.h (+13/-13) src/economy/road.cc (+18/-18) src/economy/road.h (+16/-16) src/economy/route.cc (+7/-7) src/economy/route.h (+6/-6) src/economy/routeastar.h (+1/-1) src/economy/router.h (+1/-1) src/economy/routing_node.h (+4/-4) src/economy/shippingitem.cc (+7/-7) src/economy/shippingitem.h (+7/-7) src/economy/supply.h (+1/-1) src/economy/supply_list.h (+1/-1) src/economy/test/test_road.cc (+3/-3) src/economy/test/test_routing.cc (+8/-8) src/economy/transfer.cc (+4/-4) src/economy/transfer.h (+4/-4) src/economy/ware_instance.cc (+14/-14) src/economy/ware_instance.h (+14/-14) src/economy/warehousesupply.h (+9/-9) src/economy/wares_queue.cc (+10/-10) src/economy/wares_queue.h (+13/-13) src/editor/editorinteractive.cc (+73/-73) src/editor/editorinteractive.h (+36/-36) src/editor/map_generator.cc (+13/-13) src/editor/map_generator.h (+7/-7) src/editor/tools/editor_action_args.h (+9/-9) src/editor/tools/editor_decrease_height_tool.cc (+10/-10) src/editor/tools/editor_decrease_height_tool.h (+7/-7) src/editor/tools/editor_decrease_resources_tool.cc (+10/-10) src/editor/tools/editor_decrease_resources_tool.h (+13/-13) src/editor/tools/editor_delete_bob_tool.cc (+11/-11) src/editor/tools/editor_delete_bob_tool.h (+9/-9) src/editor/tools/editor_delete_immovable_tool.cc (+11/-11) src/editor/tools/editor_delete_immovable_tool.h (+9/-9) src/editor/tools/editor_draw_tool.cc (+17/-17) src/editor/tools/editor_draw_tool.h (+10/-10) src/editor/tools/editor_history.cc (+20/-20) src/editor/tools/editor_history.h (+11/-11) src/editor/tools/editor_increase_height_tool.cc (+10/-10) src/editor/tools/editor_increase_height_tool.h (+16/-16) src/editor/tools/editor_increase_resources_tool.cc (+12/-12) src/editor/tools/editor_increase_resources_tool.h (+18/-18) src/editor/tools/editor_info_tool.cc (+7/-7) src/editor/tools/editor_info_tool.h (+5/-5) src/editor/tools/editor_make_infrastructure_tool.cc (+5/-5) src/editor/tools/editor_make_infrastructure_tool.h (+10/-10) src/editor/tools/editor_noise_height_tool.cc (+10/-10) src/editor/tools/editor_noise_height_tool.h (+13/-13) src/editor/tools/editor_place_bob_tool.cc (+12/-12) src/editor/tools/editor_place_bob_tool.h (+10/-10) src/editor/tools/editor_place_immovable_tool.cc (+12/-12) src/editor/tools/editor_place_immovable_tool.h (+10/-10) src/editor/tools/editor_set_height_tool.cc (+10/-10) src/editor/tools/editor_set_height_tool.h (+10/-10) src/editor/tools/editor_set_origin_tool.cc (+10/-10) src/editor/tools/editor_set_origin_tool.h (+9/-9) src/editor/tools/editor_set_port_space_tool.cc (+28/-28) src/editor/tools/editor_set_port_space_tool.h (+16/-16) src/editor/tools/editor_set_resources_tool.cc (+10/-10) src/editor/tools/editor_set_resources_tool.h (+13/-13) src/editor/tools/editor_set_starting_pos_tool.cc (+10/-10) src/editor/tools/editor_set_starting_pos_tool.h (+6/-6) src/editor/tools/editor_set_terrain_tool.cc (+12/-12) src/editor/tools/editor_set_terrain_tool.h (+9/-9) src/editor/tools/editor_tool.h (+23/-23) src/editor/tools/editor_tool_action.h (+16/-16) src/editor/ui_menus/categorized_item_selection_menu.h (+1/-1) src/editor/ui_menus/editor_main_menu.cc (+34/-34) src/editor/ui_menus/editor_main_menu.h (+4/-4) src/editor/ui_menus/editor_main_menu_load_map.cc (+22/-22) src/editor/ui_menus/editor_main_menu_load_map.h (+6/-6) src/editor/ui_menus/editor_main_menu_map_options.cc (+12/-12) src/editor/ui_menus/editor_main_menu_map_options.h (+6/-6) src/editor/ui_menus/editor_main_menu_new_map.cc (+11/-11) src/editor/ui_menus/editor_main_menu_new_map.h (+3/-3) src/editor/ui_menus/editor_main_menu_random_map.cc (+44/-44) src/editor/ui_menus/editor_main_menu_random_map.h (+6/-6) src/editor/ui_menus/editor_main_menu_save_map.cc (+31/-31) src/editor/ui_menus/editor_main_menu_save_map.h (+7/-7) src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc (+5/-5) src/editor/ui_menus/editor_main_menu_save_map_make_directory.h (+2/-2) src/editor/ui_menus/editor_player_menu.cc (+49/-49) src/editor/ui_menus/editor_player_menu.h (+5/-5) src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc (+23/-23) src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h (+4/-4) src/editor/ui_menus/editor_tool_change_height_options_menu.cc (+13/-13) src/editor/ui_menus/editor_tool_change_height_options_menu.h (+8/-8) src/editor/ui_menus/editor_tool_change_resources_options_menu.cc (+19/-19) src/editor/ui_menus/editor_tool_change_resources_options_menu.h (+8/-8) src/editor/ui_menus/editor_tool_menu.cc (+16/-16) src/editor/ui_menus/editor_tool_menu.h (+2/-2) src/editor/ui_menus/editor_tool_noise_height_options_menu.cc (+19/-19) src/editor/ui_menus/editor_tool_noise_height_options_menu.h (+7/-7) src/editor/ui_menus/editor_tool_options_menu.cc (+5/-5) src/editor/ui_menus/editor_tool_options_menu.h (+4/-4) src/editor/ui_menus/editor_tool_place_bob_options_menu.cc (+6/-6) src/editor/ui_menus/editor_tool_place_bob_options_menu.h (+7/-7) src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc (+6/-6) src/editor/ui_menus/editor_tool_place_immovable_options_menu.h (+6/-6) src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc (+5/-5) src/editor/ui_menus/editor_tool_set_terrain_options_menu.h (+7/-7) src/editor/ui_menus/editor_toolsize_menu.cc (+9/-9) src/editor/ui_menus/editor_toolsize_menu.h (+4/-4) src/game_io/CMakeLists.txt (+14/-14) src/game_io/game_class_packet.cc (+9/-9) src/game_io/game_class_packet.h (+6/-6) src/game_io/game_cmd_queue_packet.cc (+14/-14) src/game_io/game_cmd_queue_packet.h (+6/-6) src/game_io/game_data_packet.h (+6/-6) src/game_io/game_interactive_player_packet.cc (+18/-18) src/game_io/game_interactive_player_packet.h (+6/-6) src/game_io/game_loader.cc (+25/-25) src/game_io/game_loader.h (+5/-5) src/game_io/game_map_packet.cc (+11/-11) src/game_io/game_map_packet.h (+17/-17) src/game_io/game_player_economies_packet.cc (+15/-15) src/game_io/game_player_economies_packet.h (+6/-6) src/game_io/game_player_info_packet.cc (+10/-10) src/game_io/game_player_info_packet.h (+6/-6) src/game_io/game_preload_packet.cc (+10/-10) src/game_io/game_preload_packet.h (+6/-6) src/game_io/game_saver.cc (+18/-18) src/game_io/game_saver.h (+2/-2) src/graphic/animation.cc (+0/-1) src/graphic/font.cc (+1/-1) src/graphic/font_handler.cc (+16/-16) src/graphic/font_handler.h (+4/-4) src/graphic/font_handler1.cc (+6/-6) src/graphic/font_handler1.h (+7/-7) src/graphic/image_cache.h (+1/-1) src/graphic/image_io.h (+2/-2) src/graphic/render/gamerenderer.cc (+17/-17) src/graphic/render/gamerenderer.h (+4/-4) src/graphic/render/gamerenderer_gl.cc (+36/-36) src/graphic/render/gamerenderer_gl.h (+8/-8) src/graphic/render/gamerenderer_sdl.cc (+5/-5) src/graphic/render/minimaprenderer.cc (+7/-7) src/graphic/render/minimaprenderer.h (+3/-3) src/graphic/rendertarget.cc (+2/-2) src/graphic/richtext.cc (+5/-5) src/graphic/surface_cache.cc (+2/-2) src/graphic/text/font_io.cc (+1/-1) src/graphic/text/rt_errors.h (+1/-1) src/graphic/text/rt_errors_impl.h (+2/-2) src/graphic/text/rt_parse.cc (+4/-4) src/graphic/text/rt_parse.h (+3/-3) src/graphic/text/rt_render.cc (+5/-4) src/graphic/text/rt_render.h (+1/-1) src/graphic/text/sdl_ttf_font.cc (+6/-6) src/graphic/text/sdl_ttf_font.h (+3/-3) src/graphic/text/textstream.cc (+6/-6) src/graphic/text_parser.cc (+16/-16) src/graphic/text_parser.h (+12/-12) src/io/fileread.cc (+5/-5) src/io/fileread.h (+2/-2) src/io/filesystem/disk_filesystem.cc (+5/-5) src/io/filesystem/filesystem.cc (+8/-8) src/io/filesystem/filesystem.h (+1/-1) src/io/filesystem/filesystem_exceptions.h (+14/-14) src/io/filesystem/layered_filesystem.cc (+5/-5) src/io/filesystem/zip_exceptions.h (+4/-4) src/io/filesystem/zip_filesystem.cc (+19/-19) src/io/filewrite.h (+1/-1) src/io/streamread.cc (+1/-1) src/io/streamread.h (+3/-3) src/logic/CMakeLists.txt (+1/-1) src/logic/battle.cc (+16/-16) src/logic/battle.h (+4/-4) src/logic/bill_of_materials.h (+5/-5) src/logic/bob.cc (+24/-24) src/logic/bob.h (+19/-19) src/logic/buildcost.cc (+7/-7) src/logic/buildcost.h (+5/-5) src/logic/building.cc (+30/-30) src/logic/building.h (+36/-36) src/logic/campaign_visibility.cc (+5/-5) src/logic/campaign_visibility.h (+1/-1) src/logic/carrier.cc (+3/-3) src/logic/carrier.h (+4/-4) src/logic/checkstep.h (+2/-2) src/logic/cmd_calculate_statistics.cc (+9/-9) src/logic/cmd_calculate_statistics.h (+5/-5) src/logic/cmd_expire_message.cc (+1/-1) src/logic/cmd_expire_message.h (+5/-5) src/logic/cmd_incorporate.cc (+9/-9) src/logic/cmd_incorporate.h (+5/-5) src/logic/cmd_luacoroutine.cc (+8/-8) src/logic/cmd_luacoroutine.h (+6/-6) src/logic/cmd_luascript.cc (+9/-9) src/logic/cmd_luascript.h (+5/-5) src/logic/cmd_queue.cc (+17/-17) src/logic/cmd_queue.h (+12/-12) src/logic/constructionsite.cc (+21/-21) src/logic/constructionsite.h (+11/-11) src/logic/cookie_priority_queue.h (+84/-84) src/logic/critter.cc (+7/-7) src/logic/critter.h (+5/-5) src/logic/critter_program.h (+3/-3) src/logic/description_maintainer.h (+1/-1) src/logic/dismantlesite.cc (+15/-15) src/logic/dismantlesite.h (+8/-8) src/logic/editor_game_base.cc (+81/-81) src/logic/editor_game_base.h (+48/-48) src/logic/expedition_bootstrap.cc (+14/-14) src/logic/expedition_bootstrap.h (+9/-9) src/logic/field.h (+24/-24) src/logic/game.cc (+65/-65) src/logic/game.h (+26/-26) src/logic/game_data_error.cc (+1/-1) src/logic/game_data_error.h (+3/-3) src/logic/game_settings.h (+2/-2) src/logic/immovable.cc (+81/-81) src/logic/immovable.h (+26/-26) src/logic/immovable_program.h (+1/-1) src/logic/instances.cc (+41/-41) src/logic/instances.h (+64/-64) src/logic/map.cc (+32/-32) src/logic/map.h (+44/-44) src/logic/map_info.cc (+4/-3) src/logic/mapdifferenceregion.cc (+1/-1) src/logic/mapdifferenceregion.h (+6/-6) src/logic/mapfringeregion.h (+7/-7) src/logic/maphollowregion.h (+5/-5) src/logic/mapregion.h (+10/-10) src/logic/maptriangleregion.h (+8/-8) src/logic/message_id.h (+11/-11) src/logic/message_queue.h (+23/-31) src/logic/militarysite.cc (+19/-19) src/logic/militarysite.h (+10/-10) src/logic/parse_map_object_types.h (+2/-2) src/logic/partially_finished_building.cc (+14/-14) src/logic/partially_finished_building.h (+10/-10) src/logic/path.cc (+5/-5) src/logic/path.h (+9/-9) src/logic/pathfield.h (+4/-4) src/logic/player.cc (+63/-63) src/logic/player.h (+61/-61) src/logic/player_area.h (+5/-5) src/logic/playercommand.cc (+385/-385) src/logic/playercommand.h (+223/-223) src/logic/playersmanager.cc (+7/-7) src/logic/playersmanager.h (+9/-9) src/logic/production_program.cc (+147/-148) src/logic/production_program.h (+41/-41) src/logic/productionsite.cc (+42/-42) src/logic/productionsite.h (+33/-33) src/logic/program_result.h (+2/-2) src/logic/queue_cmd_factory.cc (+34/-34) src/logic/queue_cmd_factory.h (+1/-1) src/logic/replay.cc (+15/-15) src/logic/replay.h (+2/-2) src/logic/replay_game_controller.cc (+3/-3) src/logic/replay_game_controller.h (+2/-2) src/logic/requirements.cc (+19/-19) src/logic/requirements.h (+22/-22) src/logic/save_handler.cc (+2/-2) src/logic/ship.cc (+19/-19) src/logic/ship.h (+12/-12) src/logic/single_player_game_controller.cc (+3/-3) src/logic/single_player_game_controller.h (+3/-3) src/logic/single_player_game_settings_provider.cc (+6/-6) src/logic/soldier.cc (+30/-30) src/logic/soldier.h (+14/-14) src/logic/soldier_counts.h (+1/-1) src/logic/soldiercontrol.h (+2/-2) src/logic/terrain_affinity.cc (+4/-4) src/logic/training_attribute.h (+4/-4) src/logic/trainingsite.cc (+19/-19) src/logic/trainingsite.h (+24/-24) src/logic/tribe.cc (+45/-45) src/logic/tribe.h (+30/-30) src/logic/tribe_basic_info.h (+2/-2) src/logic/ware_descr.cc (+1/-1) src/logic/ware_descr.h (+4/-4) src/logic/warehouse.cc (+77/-77) src/logic/warehouse.h (+43/-43) src/logic/warelist.cc (+8/-8) src/logic/warelist.h (+8/-9) src/logic/widelands.h (+24/-25) src/logic/widelands_geometry.cc (+1/-1) src/logic/widelands_geometry.h (+34/-39) src/logic/widelands_geometry_io.cc (+9/-9) src/logic/widelands_geometry_io.h (+19/-19) src/logic/workarea_info.h (+1/-1) src/logic/worker.cc (+35/-35) src/logic/worker.h (+19/-19) src/logic/worker_descr.cc (+8/-8) src/logic/worker_descr.h (+10/-11) src/logic/worker_program.cc (+2/-2) src/logic/worker_program.h (+5/-5) src/logic/world/editor_category.cc (+1/-1) src/logic/world/map_gen.cc (+21/-21) src/logic/world/map_gen.h (+4/-4) src/logic/world/resource_description.cc (+1/-1) src/logic/world/terrain_description.cc (+8/-8) src/logic/world/terrain_description.h (+1/-1) src/logic/world/world.cc (+3/-3) src/logic/world/world.h (+3/-3) src/main.cc (+2/-2) src/map_io/CMakeLists.txt (+59/-59) src/map_io/map_allowed_building_types_packet.cc (+21/-21) src/map_io/map_allowed_building_types_packet.h (+8/-8) src/map_io/map_allowed_worker_types_packet.cc (+15/-15) src/map_io/map_allowed_worker_types_packet.h (+5/-5) src/map_io/map_bob_packet.cc (+16/-16) src/map_io/map_bob_packet.h (+10/-10) src/map_io/map_building_packet.cc (+31/-31) src/map_io/map_building_packet.h (+7/-7) src/map_io/map_buildingdata_packet.cc (+151/-151) src/map_io/map_buildingdata_packet.h (+24/-24) src/map_io/map_data_packet.h (+10/-10) src/map_io/map_elemental_packet.cc (+9/-9) src/map_io/map_elemental_packet.h (+8/-8) src/map_io/map_exploration_packet.cc (+18/-18) src/map_io/map_exploration_packet.h (+8/-8) src/map_io/map_extradata_packet.cc (+9/-9) src/map_io/map_extradata_packet.h (+6/-6) src/map_io/map_flag_packet.cc (+22/-22) src/map_io/map_flag_packet.h (+8/-8) src/map_io/map_flagdata_packet.cc (+29/-29) src/map_io/map_flagdata_packet.h (+8/-8) src/map_io/map_heights_packet.cc (+12/-12) src/map_io/map_heights_packet.h (+8/-8) src/map_io/map_loader.h (+5/-5) src/map_io/map_message_saver.h (+10/-10) src/map_io/map_node_ownership_packet.cc (+13/-13) src/map_io/map_node_ownership_packet.h (+8/-8) src/map_io/map_object_loader.cc (+7/-7) src/map_io/map_object_loader.h (+10/-10) src/map_io/map_object_packet.cc (+9/-9) src/map_io/map_object_packet.h (+10/-10) src/map_io/map_object_saver.cc (+14/-14) src/map_io/map_object_saver.h (+9/-9) src/map_io/map_objective_packet.cc (+12/-12) src/map_io/map_objective_packet.h (+8/-8) src/map_io/map_player_names_and_tribes_packet.cc (+14/-14) src/map_io/map_player_names_and_tribes_packet.h (+8/-8) src/map_io/map_player_position_packet.cc (+12/-12) src/map_io/map_player_position_packet.h (+8/-8) src/map_io/map_players_messages_packet.cc (+24/-24) src/map_io/map_players_messages_packet.h (+8/-8) src/map_io/map_players_view_packet.cc (+105/-105) src/map_io/map_players_view_packet.h (+6/-6) src/map_io/map_port_spaces_packet.cc (+7/-7) src/map_io/map_port_spaces_packet.h (+8/-8) src/map_io/map_resources_packet.cc (+8/-8) src/map_io/map_resources_packet.h (+7/-7) src/map_io/map_road_packet.cc (+13/-13) src/map_io/map_road_packet.h (+8/-8) src/map_io/map_roaddata_packet.cc (+38/-38) src/map_io/map_roaddata_packet.h (+5/-5) src/map_io/map_saver.cc (+60/-59) src/map_io/map_saver.h (+11/-11) src/map_io/map_scripting_packet.cc (+7/-7) src/map_io/map_scripting_packet.h (+5/-5) src/map_io/map_terrain_packet.cc (+21/-21) src/map_io/map_terrain_packet.h (+7/-7) src/map_io/map_version_packet.cc (+9/-9) src/map_io/map_version_packet.h (+5/-5) src/map_io/s2map.cc (+40/-40) src/map_io/s2map.h (+5/-5) src/map_io/widelands_map_loader.cc (+60/-60) src/map_io/widelands_map_loader.h (+8/-8) src/network/internet_gaming.cc (+19/-19) src/network/internet_gaming.h (+6/-6) src/network/netclient.cc (+9/-9) src/network/nethost.cc (+35/-35) src/network/nethost.h (+1/-1) src/network/network.cc (+2/-2) src/network/network.h (+2/-2) src/network/network_lan_promotion.cc (+22/-22) src/network/network_lan_promotion.h (+15/-15) src/network/network_system.h (+2/-2) src/profile/profile.cc (+1/-1) src/profile/profile.h (+4/-4) src/scripting/c_utils.cc (+8/-8) src/scripting/c_utils.h (+5/-5) src/scripting/factory.cc (+4/-4) src/scripting/factory.h (+3/-3) src/scripting/lua_bases.cc (+76/-76) src/scripting/lua_bases.h (+17/-17) src/scripting/lua_coroutine.cc (+3/-3) src/scripting/lua_editor.cc (+5/-5) src/scripting/lua_editor.h (+7/-7) src/scripting/lua_errors.h (+1/-1) src/scripting/lua_game.cc (+151/-151) src/scripting/lua_game.h (+26/-26) src/scripting/lua_map.cc (+643/-643) src/scripting/lua_map.h (+207/-207) src/scripting/lua_path.h (+1/-1) src/scripting/lua_root.cc (+51/-51) src/scripting/lua_root.h (+14/-14) src/scripting/lua_ui.cc (+116/-116) src/scripting/lua_ui.h (+32/-32) src/scripting/luna_impl.h (+2/-2) src/scripting/persistence.cc (+2/-2) src/scripting/persistence.h (+5/-5) src/scripting/scripting.cc (+5/-5) src/scripting/scripting.h (+6/-6) src/scripting/test/test_luna.cc (+53/-53) src/sound/fxset.h (+2/-2) src/sound/songset.cc (+4/-4) src/sound/sound_handler.cc (+48/-48) src/sound/sound_handler.h (+16/-16) src/ui_basic/helpwindow.cc (+2/-2) src/ui_basic/helpwindow.h (+2/-2) src/ui_basic/icongrid.cc (+7/-7) src/ui_basic/icongrid.h (+2/-2) src/ui_basic/listselect.cc (+9/-9) src/ui_basic/listselect.h (+5/-5) src/ui_basic/messagebox.cc (+4/-4) src/ui_basic/messagebox.h (+2/-2) src/ui_basic/multilineeditbox.cc (+25/-25) src/ui_basic/multilineeditbox.h (+3/-3) src/ui_basic/multilinetextarea.cc (+12/-12) src/ui_basic/multilinetextarea.h (+3/-3) src/ui_basic/panel.cc (+1/-1) src/ui_basic/progressbar.cc (+4/-4) src/ui_basic/progressbar.h (+2/-2) src/ui_basic/progresswindow.h (+1/-1) src/ui_basic/table.cc (+21/-21) src/ui_basic/table.h (+40/-40) src/ui_basic/tabpanel.cc (+16/-16) src/ui_basic/tabpanel.h (+10/-10) src/ui_basic/textarea.h (+1/-1) src/ui_fsmenu/base.cc (+13/-13) src/ui_fsmenu/base.h (+3/-3) src/ui_fsmenu/campaign_select.cc (+26/-26) src/ui_fsmenu/campaign_select.h (+7/-7) src/ui_fsmenu/editor.cc (+5/-5) src/ui_fsmenu/editor.h (+2/-2) src/ui_fsmenu/editor_mapselect.cc (+22/-22) src/ui_fsmenu/editor_mapselect.h (+4/-4) src/ui_fsmenu/fileview.cc (+7/-7) src/ui_fsmenu/fileview.h (+5/-5) src/ui_fsmenu/internet_lobby.cc (+32/-32) src/ui_fsmenu/internet_lobby.h (+6/-6) src/ui_fsmenu/intro.cc (+5/-5) src/ui_fsmenu/intro.h (+2/-2) src/ui_fsmenu/launch_mpg.cc (+31/-31) src/ui_fsmenu/launch_mpg.h (+4/-4) src/ui_fsmenu/launch_spg.cc (+24/-24) src/ui_fsmenu/launch_spg.h (+3/-3) src/ui_fsmenu/loadgame.cc (+24/-24) src/ui_fsmenu/loadgame.h (+5/-5) src/ui_fsmenu/loadreplay.cc (+24/-24) src/ui_fsmenu/loadreplay.h (+2/-2) src/ui_fsmenu/main.cc (+11/-11) src/ui_fsmenu/main.h (+2/-2) src/ui_fsmenu/mapselect.cc (+33/-33) src/ui_fsmenu/mapselect.h (+4/-4) src/ui_fsmenu/multiplayer.cc (+8/-8) src/ui_fsmenu/multiplayer.h (+2/-2) src/ui_fsmenu/netsetup_lan.cc (+40/-40) src/ui_fsmenu/netsetup_lan.h (+12/-12) src/ui_fsmenu/options.cc (+34/-34) src/ui_fsmenu/options.h (+15/-15) src/ui_fsmenu/singleplayer.cc (+6/-6) src/ui_fsmenu/singleplayer.h (+2/-2) src/wlapplication.cc (+84/-84) src/wlapplication.h (+3/-3) src/wui/actionconfirm.cc (+34/-34) src/wui/actionconfirm.h (+7/-7) src/wui/building_statistics_menu.cc (+63/-63) src/wui/building_statistics_menu.h (+12/-12) src/wui/building_ui.cc (+3/-3) src/wui/buildingwindow.cc (+37/-37) src/wui/buildingwindow.h (+12/-12) src/wui/constructionsitewindow.cc (+14/-14) src/wui/debugconsole.cc (+1/-1) src/wui/debugconsole.h (+1/-1) src/wui/dismantlesitewindow.cc (+15/-15) src/wui/encyclopedia_window.cc (+14/-14) src/wui/encyclopedia_window.h (+9/-9) src/wui/fieldaction.cc (+53/-53) src/wui/fieldaction.h (+3/-3) src/wui/game_debug_ui.cc (+27/-27) src/wui/game_debug_ui.h (+3/-3) src/wui/game_main_menu.cc (+6/-6) src/wui/game_main_menu.h (+4/-4) src/wui/game_main_menu_save_game.cc (+34/-34) src/wui/game_main_menu_save_game.h (+5/-5) src/wui/game_message_menu.cc (+25/-25) src/wui/game_message_menu.h (+6/-6) src/wui/game_objectives_menu.cc (+3/-3) src/wui/game_objectives_menu.h (+5/-5) src/wui/game_options_menu.cc (+3/-3) src/wui/game_options_menu.h (+4/-4) src/wui/game_options_sound_menu.cc (+1/-1) src/wui/game_options_sound_menu.h (+1/-1) src/wui/game_summary.cc (+7/-7) src/wui/game_summary.h (+3/-3) src/wui/gamechatpanel.cc (+1/-1) src/wui/gamechatpanel.h (+1/-1) src/wui/general_statistics_menu.cc (+17/-17) src/wui/general_statistics_menu.h (+8/-8) src/wui/interactive_base.cc (+58/-58) src/wui/interactive_base.h (+19/-19) src/wui/interactive_gamebase.cc (+9/-9) src/wui/interactive_gamebase.h (+8/-8) src/wui/interactive_player.cc (+33/-33) src/wui/interactive_player.h (+10/-10) src/wui/interactive_spectator.cc (+26/-26) src/wui/interactive_spectator.h (+6/-6) src/wui/itemwaresdisplay.cc (+2/-2) src/wui/itemwaresdisplay.h (+2/-2) src/wui/login_box.cc (+1/-1) src/wui/login_box.h (+1/-1) src/wui/mapview.cc (+15/-15) src/wui/mapview.h (+8/-8) src/wui/mapviewpixelfunctions.cc (+2/-2) src/wui/mapviewpixelfunctions.h (+1/-1) src/wui/militarysitewindow.cc (+10/-10) src/wui/minimap.cc (+2/-2) src/wui/minimap.h (+4/-4) src/wui/overlay_manager.cc (+25/-25) src/wui/overlay_manager.h (+21/-23) src/wui/plot_area.cc (+16/-16) src/wui/plot_area.h (+9/-9) src/wui/portdockwaresdisplay.cc (+3/-3) src/wui/portdockwaresdisplay.h (+1/-1) src/wui/productionsitewindow.cc (+12/-12) src/wui/productionsitewindow.h (+3/-3) src/wui/quicknavigation.cc (+1/-1) src/wui/quicknavigation.h (+5/-5) src/wui/shipwindow.cc (+9/-9) src/wui/soldiercapacitycontrol.cc (+4/-4) src/wui/soldiercapacitycontrol.h (+2/-2) src/wui/soldierlist.cc (+11/-11) src/wui/soldierlist.h (+2/-2) src/wui/stock_menu.cc (+7/-7) src/wui/stock_menu.h (+4/-4) src/wui/story_message_box.cc (+6/-6) src/wui/story_message_box.h (+2/-2) src/wui/trainingsitewindow.cc (+10/-10) src/wui/transport_draw.cc (+2/-2) src/wui/transport_ui.cc (+49/-49) src/wui/ware_statistics_menu.cc (+26/-26) src/wui/ware_statistics_menu.h (+17/-17) src/wui/warehousewindow.cc (+17/-17) src/wui/waresdisplay.cc (+31/-31) src/wui/waresdisplay.h (+33/-33) src/wui/waresqueuedisplay.cc (+1/-1) src/wui/waresqueuedisplay.h (+4/-4) src/wui/watchwindow.cc (+13/-13) src/wui/watchwindow.h (+2/-2) |
To merge this branch: | bzr merge lp:~widelands-dev/widelands/bug-1343297_2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
SirVer | Approve | ||
GunChleoc | Needs Resubmitting | ||
Review via email: mp+234183@code.launchpad.net |
Commit message
Description of the change
Converted remaining enums, classes and structs to CamelCase, and a bunch od typedefs.
The codecheck rule has a NOCOM comment in it, because I'm not sure what we want to do with the remaining typedefs.
I would also like to see classes like FCoords and TCoords renamed, because I have no idea what F and T mean here.
GunChleoc (gunchleoc) wrote : | # |
2 questions then:
what does the _t in TypeAndLevel_t mean? We also have some _s stuff in the typedefs.
I also have trouble with a rule for everything - a simple check for underscore won't do, because of the uint16_t in definitions like std::pair<uint16_t, uint16_t>. Also, some typedefs are multiline with brackets.
If we wish to move to 'using' anyway, maybe just skip the rule and clean them up?
SirVer (sirver) wrote : | # |
> what does the _t in TypeAndLevel_t mean? We also have some _s stuff in the typedefs.
The _t mymics standard naming conventions from C++: uint8_t (_t stands for type). I think it unwise to use this for user defined types as for me it symbolizes a standard type. _s I have no idea what it should stand for and I think we should use it.
> If we wish to move to 'using' anyway, maybe just skip the rule and clean them up?
Just add a simple rule that check that typedef is never used then?
GunChleoc (gunchleoc) wrote : | # |
Sounds good to me: I'll switch everything to "using", which will make for an easier code check rule afterwards
GunChleoc (gunchleoc) wrote : | # |
All done.
Codecheck still coughs up 2 tyxpedefs in src/network/
SirVer (sirver) wrote : | # |
Convert those to using too, but keep the names (that is a compatibility fix for windows).
SirVer (sirver) : | # |
GunChleoc (gunchleoc) wrote : | # |
Done. I also added an exception to the CamelCase codecheck rule to avoid the false positives.
SirVer (sirver) wrote : | # |
One nit. Please fix and merge.
Preview Diff
1 | === added file 'cmake/codecheck/rules/camel_case_for_classes' |
2 | --- cmake/codecheck/rules/camel_case_for_classes 1970-01-01 00:00:00 +0000 |
3 | +++ cmake/codecheck/rules/camel_case_for_classes 2014-09-18 15:54:00 +0000 |
4 | @@ -0,0 +1,42 @@ |
5 | +#!/usr/bin/python |
6 | + |
7 | +import re |
8 | + |
9 | +strip_comments_and_strings = True |
10 | + |
11 | +def evaluate_matches(lines, fn): |
12 | + errors = [] |
13 | + |
14 | + for lineno, line in enumerate(lines): |
15 | + |
16 | + # Exception for Microsoft fix in src/network/network_system.h |
17 | + if line.count("in_port_t = uint16_t") or line.count("in_addr_t = uint32_t"): |
18 | + continue |
19 | + |
20 | + if re.match("(^\s*((class|struct)\s+((\S+_)|([a-z]\S+)).*{)|((enum)\s+((\S+_)|(([abd-z])|(c(?!lass))\S+)).*{)|((using)\s+((\S+_)|([a-z]\S+)).*=).*$)", line): |
21 | + |
22 | + errors.append((fn, lineno+1, "Use CapitalLetterWithCamelCase when naming an enum class, struct, or \"using\".")) |
23 | + |
24 | + return errors |
25 | +# /end evaluate_matches |
26 | + |
27 | +forbidden = [ |
28 | + "class my_class", |
29 | + "class myClass", |
30 | + "struct my_struct", |
31 | + "struct myStruct", |
32 | + "using my_typedef", |
33 | + "using myTypedef", |
34 | + "enum class my_enum", |
35 | + "enum class myEnum" |
36 | + "enum my_enum", |
37 | + "enum myEnum" |
38 | +] |
39 | + |
40 | +allowed = [ |
41 | + "class MyClass", |
42 | + "struct MyStruct", |
43 | + "using MyTypedef", |
44 | + "enum class MyEnum", |
45 | + "enum MyEnum" |
46 | +] |
47 | |
48 | === added file 'cmake/codecheck/rules/do_not_use_typedef' |
49 | --- cmake/codecheck/rules/do_not_use_typedef 1970-01-01 00:00:00 +0000 |
50 | +++ cmake/codecheck/rules/do_not_use_typedef 2014-09-18 15:54:00 +0000 |
51 | @@ -0,0 +1,24 @@ |
52 | +#!/usr/bin/python |
53 | + |
54 | +import re |
55 | + |
56 | +strip_comments_and_strings = True |
57 | + |
58 | +def evaluate_matches(lines, fn): |
59 | + errors = [] |
60 | + |
61 | + for lineno, line in enumerate(lines): |
62 | + |
63 | + if line.count("typedef"): |
64 | + errors.append((fn, lineno+1, "Do not use \"typedef\". Use \"using\" instead.")) |
65 | + |
66 | + return errors |
67 | +# /end evaluate_matches |
68 | + |
69 | +forbidden = [ |
70 | + "typedef uint8_t MyType" |
71 | +] |
72 | + |
73 | +allowed = [ |
74 | + "using MyType = uint8_t" |
75 | +] |
76 | |
77 | === modified file 'src/ai/ai_help_structs.h' |
78 | --- src/ai/ai_help_structs.h 2014-07-28 16:59:54 +0000 |
79 | +++ src/ai/ai_help_structs.h 2014-09-18 15:54:00 +0000 |
80 | @@ -283,7 +283,7 @@ |
81 | |
82 | struct BuildingObserver { |
83 | char const* name; |
84 | - Widelands::Building_Index id; |
85 | + Widelands::BuildingIndex id; |
86 | Widelands::BuildingDescr const* desc; |
87 | |
88 | enum { |
89 | |
90 | === modified file 'src/ai/computer_player.cc' |
91 | --- src/ai/computer_player.cc 2014-07-23 20:12:17 +0000 |
92 | +++ src/ai/computer_player.cc 2014-09-18 15:54:00 +0000 |
93 | @@ -21,24 +21,24 @@ |
94 | |
95 | #include "ai/defaultai.h" |
96 | |
97 | -Computer_Player::Computer_Player |
98 | - (Widelands::Game & g, Widelands::Player_Number const pid) |
99 | +ComputerPlayer::ComputerPlayer |
100 | + (Widelands::Game & g, Widelands::PlayerNumber const pid) |
101 | : m_game(g), m_player_number(pid) |
102 | { |
103 | } |
104 | |
105 | -Computer_Player::~Computer_Player() {} |
106 | +ComputerPlayer::~ComputerPlayer() {} |
107 | |
108 | -struct EmptyAI : Computer_Player { |
109 | - EmptyAI(Widelands::Game & g, const Widelands::Player_Number pid) |
110 | - : Computer_Player(g, pid) {} |
111 | +struct EmptyAI : ComputerPlayer { |
112 | + EmptyAI(Widelands::Game & g, const Widelands::PlayerNumber pid) |
113 | + : ComputerPlayer(g, pid) {} |
114 | |
115 | void think() override {} |
116 | |
117 | struct EmptyAIImpl : Implementation { |
118 | EmptyAIImpl() {name = _("None");} |
119 | - Computer_Player * instantiate |
120 | - (Widelands::Game & g, Widelands::Player_Number const pid) const override |
121 | + ComputerPlayer * instantiate |
122 | + (Widelands::Game & g, Widelands::PlayerNumber const pid) const override |
123 | { |
124 | return new EmptyAI(g, pid); |
125 | } |
126 | @@ -49,10 +49,10 @@ |
127 | |
128 | EmptyAI::EmptyAIImpl EmptyAI::implementation; |
129 | |
130 | -const Computer_Player::ImplementationVector & |
131 | -Computer_Player::getImplementations() |
132 | +const ComputerPlayer::ImplementationVector & |
133 | +ComputerPlayer::getImplementations() |
134 | { |
135 | - static std::vector<Computer_Player::Implementation const *> impls; |
136 | + static std::vector<ComputerPlayer::Implementation const *> impls; |
137 | |
138 | if (impls.empty()) { |
139 | impls.push_back(&DefaultAI::aggressiveImpl); |
140 | @@ -64,12 +64,12 @@ |
141 | return impls; |
142 | } |
143 | |
144 | -const Computer_Player::Implementation * Computer_Player::getImplementation |
145 | +const ComputerPlayer::Implementation * ComputerPlayer::getImplementation |
146 | (const std::string & name) |
147 | { |
148 | const ImplementationVector & vec = getImplementations(); |
149 | |
150 | - for (const Computer_Player::Implementation* implementation : vec) { |
151 | + for (const ComputerPlayer::Implementation* implementation : vec) { |
152 | if (implementation->name == name) { |
153 | return implementation; |
154 | } |
155 | |
156 | === modified file 'src/ai/computer_player.h' |
157 | --- src/ai/computer_player.h 2014-07-16 08:23:42 +0000 |
158 | +++ src/ai/computer_player.h 2014-09-18 15:54:00 +0000 |
159 | @@ -36,14 +36,14 @@ |
160 | * Instances of actual AI implementation can be created via the |
161 | * \ref Implementation interface. |
162 | */ |
163 | -struct Computer_Player { |
164 | - Computer_Player(Widelands::Game &, const Widelands::Player_Number); |
165 | - virtual ~Computer_Player(); |
166 | +struct ComputerPlayer { |
167 | + ComputerPlayer(Widelands::Game &, const Widelands::PlayerNumber); |
168 | + virtual ~ComputerPlayer(); |
169 | |
170 | virtual void think () = 0; |
171 | |
172 | Widelands::Game & game() const {return m_game;} |
173 | - Widelands::Player_Number player_number() {return m_player_number;} |
174 | + Widelands::PlayerNumber player_number() {return m_player_number;} |
175 | |
176 | /** |
177 | * Interface to a concrete implementation, used to instantiate AIs. |
178 | @@ -53,12 +53,10 @@ |
179 | struct Implementation { |
180 | std::string name; |
181 | virtual ~Implementation() {} |
182 | - virtual Computer_Player * instantiate |
183 | - (Widelands::Game &, Widelands::Player_Number) const = 0; |
184 | + virtual ComputerPlayer * instantiate |
185 | + (Widelands::Game &, Widelands::PlayerNumber) const = 0; |
186 | }; |
187 | - typedef |
188 | - std::vector<Computer_Player::Implementation const *> |
189 | - ImplementationVector; |
190 | + using ImplementationVector = std::vector<ComputerPlayer::Implementation const *>; |
191 | |
192 | /** |
193 | * Get a list of available AI implementations. |
194 | @@ -72,9 +70,9 @@ |
195 | |
196 | private: |
197 | Widelands::Game & m_game; |
198 | - Widelands::Player_Number const m_player_number; |
199 | + Widelands::PlayerNumber const m_player_number; |
200 | |
201 | - DISALLOW_COPY_AND_ASSIGN(Computer_Player); |
202 | + DISALLOW_COPY_AND_ASSIGN(ComputerPlayer); |
203 | }; |
204 | |
205 | #endif // end of include guard: WL_AI_COMPUTER_PLAYER_H |
206 | |
207 | === modified file 'src/ai/defaultai.cc' |
208 | --- src/ai/defaultai.cc 2014-08-26 19:40:13 +0000 |
209 | +++ src/ai/defaultai.cc 2014-09-18 15:54:00 +0000 |
210 | @@ -62,8 +62,8 @@ |
211 | DefaultAI::DefensiveImpl DefaultAI::defensiveImpl; |
212 | |
213 | /// Constructor of DefaultAI |
214 | -DefaultAI::DefaultAI(Game& ggame, Player_Number const pid, uint8_t const t) |
215 | - : Computer_Player(ggame, pid), |
216 | +DefaultAI::DefaultAI(Game& ggame, PlayerNumber const pid, uint8_t const t) |
217 | + : ComputerPlayer(ggame, pid), |
218 | type_(t), |
219 | m_buildable_changed(true), |
220 | m_mineable_changed(true), |
221 | @@ -232,20 +232,20 @@ |
222 | player_ = game().get_player(player_number()); |
223 | tribe_ = &player_->tribe(); |
224 | log("ComputerPlayer(%d): initializing (%u)\n", player_number(), type_); |
225 | - Ware_Index const nr_wares = tribe_->get_nrwares(); |
226 | + WareIndex const nr_wares = tribe_->get_nrwares(); |
227 | wares.resize(nr_wares); |
228 | |
229 | - for (Ware_Index i = 0; i < nr_wares; ++i) { |
230 | + for (WareIndex i = 0; i < nr_wares; ++i) { |
231 | wares.at(i).producers_ = 0; |
232 | wares.at(i).consumers_ = 0; |
233 | wares.at(i).preciousness_ = tribe_->get_ware_descr(i)->preciousness(); |
234 | } |
235 | |
236 | // collect information about the different buildings our tribe can construct |
237 | - Building_Index const nr_buildings = tribe_->get_nrbuildings(); |
238 | + BuildingIndex const nr_buildings = tribe_->get_nrbuildings(); |
239 | const World& world = game().world(); |
240 | |
241 | - for (Building_Index i = 0; i < nr_buildings; ++i) { |
242 | + for (BuildingIndex i = 0; i < nr_buildings; ++i) { |
243 | const BuildingDescr& bld = *tribe_->get_building_descr(i); |
244 | const std::string& building_name = bld.name(); |
245 | const BuildingHints& bh = bld.hints(); |
246 | @@ -299,7 +299,7 @@ |
247 | for (const WareAmount& temp_input : prod.inputs()) { |
248 | bo.inputs_.push_back(temp_input.first); |
249 | } |
250 | - for (const Ware_Index& temp_output : prod.output_ware_types()) { |
251 | + for (const WareIndex& temp_output : prod.output_ware_types()) { |
252 | bo.outputs_.push_back(temp_output); |
253 | } |
254 | |
255 | @@ -354,8 +354,8 @@ |
256 | Map& map = game().map(); |
257 | std::set<OPtr<PlayerImmovable>> found_immovables; |
258 | |
259 | - for (Y_Coordinate y = 0; y < map.get_height(); ++y) { |
260 | - for (X_Coordinate x = 0; x < map.get_width(); ++x) { |
261 | + for (int16_t y = 0; y < map.get_height(); ++y) { |
262 | + for (int16_t x = 0; x < map.get_width(); ++x) { |
263 | FCoords f = map.get_fcoords(Coords(x, y)); |
264 | |
265 | if (f.field->get_owned_by() != player_number()) |
266 | @@ -483,7 +483,7 @@ |
267 | Map& map = game().map(); |
268 | FindNodeUnowned find_unowned(player_, game()); |
269 | FindNodeUnownedMineable find_unowned_mines_pots(player_, game()); |
270 | - Player_Number const pn = player_->player_number(); |
271 | + PlayerNumber const pn = player_->player_number(); |
272 | const World& world = game().world(); |
273 | field.unowned_land_nearby_ = |
274 | map.find_fields(Area<FCoords>(field.coords, range), nullptr, find_unowned); |
275 | @@ -841,7 +841,7 @@ |
276 | military_boost = 200; |
277 | } |
278 | |
279 | - // Building_Index proposed_building = INVALID_INDEX; // I need BuildingObserver not index |
280 | + // BuildingIndex proposed_building = INVALID_INDEX; // I need BuildingObserver not index |
281 | BuildingObserver* best_building = nullptr; |
282 | int32_t proposed_priority = 0; |
283 | Coords proposed_coords; |
284 | @@ -925,7 +925,7 @@ |
285 | continue; |
286 | |
287 | for (uint32_t m = 0; m < bo.outputs_.size(); ++m) { |
288 | - Ware_Index wt(static_cast<size_t>(bo.outputs_.at(m))); |
289 | + WareIndex wt(static_cast<size_t>(bo.outputs_.at(m))); |
290 | |
291 | if (observer->economy.needs_ware(wt)) { |
292 | output_is_needed = true; |
293 | @@ -1557,7 +1557,7 @@ |
294 | const Map& map = game().map(); |
295 | CoordPath cp(map, path); |
296 | // try to split after two steps |
297 | - CoordPath::Step_Vector::size_type i = cp.get_nsteps() - 1, j = 1; |
298 | + CoordPath::StepVector::size_type i = cp.get_nsteps() - 1, j = 1; |
299 | |
300 | for (; i >= j; --i, ++j) { |
301 | { |
302 | @@ -1813,8 +1813,8 @@ |
303 | } |
304 | |
305 | // Get max radius of recursive workarea |
306 | - Workarea_Info::size_type radius = 0; |
307 | - const Workarea_Info& workarea_info = site.bo->desc->m_workarea_info; |
308 | + WorkareaInfo::size_type radius = 0; |
309 | + const WorkareaInfo& workarea_info = site.bo->desc->m_workarea_info; |
310 | for (const std::pair<uint32_t, std::set<std::string> > & temp_info : workarea_info) { |
311 | if (radius < temp_info.first) { |
312 | radius = temp_info.first; |
313 | @@ -2012,8 +2012,8 @@ |
314 | |
315 | // Check whether building is enhanceable and if wares of the enhanced |
316 | // buildings are needed. If yes consider an upgrade. |
317 | - const Building_Index enhancement = site.site->descr().enhancement(); |
318 | - Building_Index enbld = INVALID_INDEX; // to get rid of this |
319 | + const BuildingIndex enhancement = site.site->descr().enhancement(); |
320 | + BuildingIndex enbld = INVALID_INDEX; // to get rid of this |
321 | BuildingObserver* bestbld = nullptr; |
322 | |
323 | // Only enhance buildings that are allowed (scenario mode) |
324 | @@ -2118,8 +2118,8 @@ |
325 | } |
326 | |
327 | // Check whether building is enhanceable. If yes consider an upgrade. |
328 | - const Building_Index enhancement = site.site->descr().enhancement(); |
329 | - Building_Index enbld = INVALID_INDEX; |
330 | + const BuildingIndex enhancement = site.site->descr().enhancement(); |
331 | + BuildingIndex enbld = INVALID_INDEX; |
332 | BuildingObserver* bestbld = nullptr; |
333 | bool changed = false; |
334 | // Only enhance buildings that are allowed (scenario mode) |
335 | @@ -2163,7 +2163,7 @@ |
336 | // this count ware as hints |
337 | uint32_t DefaultAI::get_stocklevel_by_hint(size_t hintoutput) { |
338 | uint32_t count = 0; |
339 | - Ware_Index wt(hintoutput); |
340 | + WareIndex wt(hintoutput); |
341 | for (EconomyObserver* observer : economies) { |
342 | // Don't check if the economy has no warehouse. |
343 | if (observer->economy.warehouses().empty()) |
344 | @@ -2186,7 +2186,7 @@ |
345 | continue; |
346 | |
347 | for (uint32_t m = 0; m < bo.outputs_.size(); ++m) { |
348 | - Ware_Index wt(static_cast<size_t>(bo.outputs_.at(m))); |
349 | + WareIndex wt(static_cast<size_t>(bo.outputs_.at(m))); |
350 | count += observer->economy.stock_ware(wt); |
351 | } |
352 | } |
353 | @@ -2603,7 +2603,7 @@ |
354 | // counting players in game |
355 | uint32_t plr_in_game = 0; |
356 | std::vector<bool> player_attackable; |
357 | - Player_Number const nr_players = game().map().get_nrplayers(); |
358 | + PlayerNumber const nr_players = game().map().get_nrplayers(); |
359 | player_attackable.resize(nr_players); |
360 | bool any_attackable = false; |
361 | bool any_attacked = false; |
362 | @@ -2619,7 +2619,7 @@ |
363 | iterate_players_existing_novar(p, nr_players, game())++ plr_in_game; |
364 | |
365 | // receiving games statistics and parsing it (reading latest entry) |
366 | - const Game::General_Stats_vector& genstats = game().get_general_statistics(); |
367 | + const Game::GeneralStatsVector& genstats = game().get_general_statistics(); |
368 | for (uint8_t j = 1; j <= plr_in_game; ++j) { |
369 | if (pn == j) { |
370 | player_attackable[j - 1] = false; |
371 | |
372 | === modified file 'src/ai/defaultai.h' |
373 | --- src/ai/defaultai.h 2014-07-26 10:43:23 +0000 |
374 | +++ src/ai/defaultai.h 2014-09-18 15:54:00 +0000 |
375 | @@ -65,8 +65,8 @@ |
376 | // - handling of trainingsites (if supply line is broken - send some soldiers |
377 | // out, to have some more forces. Reincrease the number of soldiers that |
378 | // should be trained if inputs_ get filled again.). |
379 | -struct DefaultAI : Computer_Player { |
380 | - DefaultAI(Widelands::Game&, const Widelands::Player_Number, uint8_t); |
381 | +struct DefaultAI : ComputerPlayer { |
382 | + DefaultAI(Widelands::Game&, const Widelands::PlayerNumber, uint8_t); |
383 | ~DefaultAI(); |
384 | void think() override; |
385 | |
386 | @@ -77,32 +77,32 @@ |
387 | }; |
388 | |
389 | /// Implementation for Aggressive |
390 | - struct AggressiveImpl : public Computer_Player::Implementation { |
391 | + struct AggressiveImpl : public ComputerPlayer::Implementation { |
392 | AggressiveImpl() { |
393 | name = _("Aggressive"); |
394 | } |
395 | - Computer_Player* instantiate(Widelands::Game& game, |
396 | - Widelands::Player_Number const p) const override { |
397 | + ComputerPlayer* instantiate(Widelands::Game& game, |
398 | + Widelands::PlayerNumber const p) const override { |
399 | return new DefaultAI(game, p, AGGRESSIVE); |
400 | } |
401 | }; |
402 | |
403 | - struct NormalImpl : public Computer_Player::Implementation { |
404 | + struct NormalImpl : public ComputerPlayer::Implementation { |
405 | NormalImpl() { |
406 | name = _("Normal"); |
407 | } |
408 | - Computer_Player* instantiate(Widelands::Game& game, |
409 | - Widelands::Player_Number const p) const override { |
410 | + ComputerPlayer* instantiate(Widelands::Game& game, |
411 | + Widelands::PlayerNumber const p) const override { |
412 | return new DefaultAI(game, p, NORMAL); |
413 | } |
414 | }; |
415 | |
416 | - struct DefensiveImpl : public Computer_Player::Implementation { |
417 | + struct DefensiveImpl : public ComputerPlayer::Implementation { |
418 | DefensiveImpl() { |
419 | name = _("Defensive"); |
420 | } |
421 | - Computer_Player* instantiate(Widelands::Game& game, |
422 | - Widelands::Player_Number const p) const override { |
423 | + ComputerPlayer* instantiate(Widelands::Game& game, |
424 | + Widelands::PlayerNumber const p) const override { |
425 | return new DefaultAI(game, p, DEFENSIVE); |
426 | } |
427 | }; |
428 | @@ -165,7 +165,7 @@ |
429 | bool m_mineable_changed; |
430 | |
431 | Widelands::Player* player_; |
432 | - Widelands::Tribe_Descr const* tribe_; |
433 | + Widelands::TribeDescr const* tribe_; |
434 | |
435 | std::vector<BuildingObserver> buildings_; |
436 | uint32_t num_constructionsites_; |
437 | |
438 | === modified file 'src/base/exceptions.cc' |
439 | --- src/base/exceptions.cc 2014-06-23 20:17:05 +0000 |
440 | +++ src/base/exceptions.cc 2014-09-18 15:54:00 +0000 |
441 | @@ -25,10 +25,10 @@ |
442 | #include <sstream> |
443 | |
444 | /* |
445 | - * class _wexception implementation |
446 | + * class WException implementation |
447 | */ |
448 | #undef wexception |
449 | -_wexception::_wexception |
450 | +WException::WException |
451 | (char const * const file, uint32_t const line, char const * const fmt, ...) |
452 | { |
453 | char buffer[512]; |
454 | @@ -43,7 +43,7 @@ |
455 | m_what = ost.str(); |
456 | } |
457 | |
458 | -char const * _wexception::what() const noexcept { |
459 | +char const * WException::what() const noexcept { |
460 | return m_what.c_str(); |
461 | } |
462 | |
463 | @@ -51,7 +51,7 @@ |
464 | /* |
465 | * class warning implementation |
466 | */ |
467 | -warning::warning(char const * const et, char const * const em, ...) : |
468 | +WLWarning::WLWarning(char const * const et, char const * const em, ...) : |
469 | m_title(et) |
470 | { |
471 | char buffer[512]; |
472 | @@ -64,11 +64,11 @@ |
473 | m_what = buffer; |
474 | } |
475 | |
476 | -char const * warning::title() const |
477 | +char const * WLWarning::title() const |
478 | { |
479 | return m_title.c_str(); |
480 | } |
481 | |
482 | -char const * warning::what() const noexcept { |
483 | +char const * WLWarning::what() const noexcept { |
484 | return m_what.c_str(); |
485 | } |
486 | |
487 | === modified file 'src/base/md5.cc' |
488 | --- src/base/md5.cc 2014-07-03 19:26:30 +0000 |
489 | +++ src/base/md5.cc 2014-09-18 15:54:00 +0000 |
490 | @@ -32,7 +32,7 @@ |
491 | /** |
492 | * Create a hex string out of the MD5 checksum. |
493 | */ |
494 | -string md5_checksum::str() const |
495 | +string Md5Checksum::str() const |
496 | { |
497 | string s; |
498 | |
499 | @@ -60,7 +60,7 @@ |
500 | |
501 | IMPORTANT: On some systems it is required that RESBUF is correctly |
502 | aligned for a 32 bits value. */ |
503 | -void * md5_finish_ctx (md5_ctx * const ctx, void * const resbuf) |
504 | +void * md5_finish_ctx (Md5Ctx * const ctx, void * const resbuf) |
505 | { |
506 | /* Take yet unprocessed bytes into account. */ |
507 | uint32_t bytes = ctx->buflen; |
508 | @@ -95,7 +95,7 @@ |
509 | |
510 | /* Processes some bytes in the internal buffer */ |
511 | void md5_process_bytes |
512 | - (void const * buffer, uint32_t len, struct md5_ctx * const ctx) |
513 | + (void const * buffer, uint32_t len, struct Md5Ctx * const ctx) |
514 | { |
515 | /* When we already have some bits in our internal buffer concatenate |
516 | both inputs first. */ |
517 | @@ -151,7 +151,7 @@ |
518 | It is assumed that LEN % 64 == 0. */ |
519 | |
520 | void md5_process_block |
521 | - (void const * const buffer, uint32_t const len, md5_ctx * const ctx) |
522 | + (void const * const buffer, uint32_t const len, Md5Ctx * const ctx) |
523 | { |
524 | uint32_t correct_words[16]; |
525 | uint32_t const * words = static_cast<uint32_t const *>(buffer); |
526 | |
527 | === modified file 'src/base/md5.h' |
528 | --- src/base/md5.h 2014-07-20 07:47:15 +0000 |
529 | +++ src/base/md5.h 2014-09-18 15:54:00 +0000 |
530 | @@ -29,7 +29,7 @@ |
531 | #include <stdint.h> |
532 | |
533 | /* Structure to save state of computation between the single steps. */ |
534 | -struct md5_ctx { |
535 | +struct Md5Ctx { |
536 | uint32_t A; |
537 | uint32_t B; |
538 | uint32_t C; |
539 | @@ -43,24 +43,24 @@ |
540 | /** |
541 | * One MD5 checksum is simply an array of 16 bytes. |
542 | */ |
543 | -struct md5_checksum { |
544 | +struct Md5Checksum { |
545 | uint8_t data[16]; |
546 | |
547 | std::string str() const; |
548 | |
549 | - bool operator== (const md5_checksum & o) const { |
550 | + bool operator== (const Md5Checksum & o) const { |
551 | return memcmp(data, o.data, sizeof(data)) == 0; |
552 | } |
553 | |
554 | - bool operator!= (const md5_checksum & o) const {return !(*this == o);} |
555 | + bool operator!= (const Md5Checksum & o) const {return !(*this == o);} |
556 | }; |
557 | |
558 | // Note that the implementation of MD5Checksum is basically just |
559 | // a wrapper around these functions, which have been taken basically |
560 | // verbatim (with some whitespace changes) from the GNU tools; see below. |
561 | -void * md5_finish_ctx (md5_ctx *, void * resbuf); |
562 | -void md5_process_bytes (void const * buffer, uint32_t len, md5_ctx *); |
563 | -void md5_process_block (void const * buffer, uint32_t len, md5_ctx *); |
564 | +void * md5_finish_ctx (Md5Ctx *, void * resbuf); |
565 | +void md5_process_bytes (void const * buffer, uint32_t len, Md5Ctx *); |
566 | +void md5_process_block (void const * buffer, uint32_t len, Md5Ctx *); |
567 | |
568 | /** |
569 | * This class is responsible for creating a streaming md5 checksum. |
570 | @@ -110,18 +110,18 @@ |
571 | /// before this function. |
572 | /// |
573 | /// \return a pointer to an array of 16 bytes containing the checksum. |
574 | - const md5_checksum & GetChecksum() const { |
575 | + const Md5Checksum & GetChecksum() const { |
576 | assert(!can_handle_data); |
577 | return sum; |
578 | } |
579 | |
580 | private: |
581 | bool can_handle_data; |
582 | - md5_checksum sum; |
583 | - md5_ctx ctx; |
584 | + Md5Checksum sum; |
585 | + Md5Ctx ctx; |
586 | }; |
587 | |
588 | class _DummyMD5Base {}; |
589 | -typedef MD5Checksum<_DummyMD5Base> SimpleMD5Checksum; |
590 | +using SimpleMD5Checksum = MD5Checksum<_DummyMD5Base>; |
591 | |
592 | #endif // end of include guard: WL_BASE_MD5_H |
593 | |
594 | === modified file 'src/base/warning.h' |
595 | --- src/base/warning.h 2014-07-26 10:43:23 +0000 |
596 | +++ src/base/warning.h 2014-09-18 15:54:00 +0000 |
597 | @@ -38,8 +38,8 @@ |
598 | |
599 | /// Similar exception type as wexception, but without the debug output. |
600 | /// Intended for normal warnings like "map could not be found". |
601 | -struct warning : public std::exception { |
602 | - explicit warning (char const * title, char const * message, ...) |
603 | +struct WLWarning : public std::exception { |
604 | + explicit WLWarning (char const * title, char const * message, ...) |
605 | PRINTF_FORMAT(3, 4); |
606 | |
607 | /// The target of the returned pointer remains valid during the lifetime of |
608 | @@ -48,7 +48,7 @@ |
609 | const char * what() const noexcept override; |
610 | |
611 | protected: |
612 | - warning() {} |
613 | + WLWarning() {} |
614 | std::string m_what; |
615 | std::string m_title; |
616 | }; |
617 | |
618 | === modified file 'src/base/wexception.h' |
619 | --- src/base/wexception.h 2014-07-26 10:43:23 +0000 |
620 | +++ src/base/wexception.h 2014-09-18 15:54:00 +0000 |
621 | @@ -41,23 +41,23 @@ |
622 | * Stupid, simple exception class. It has the nice bonus that you can give it |
623 | * sprintf()-style format strings |
624 | */ |
625 | -struct _wexception : public std::exception { |
626 | - explicit _wexception |
627 | +struct WException : public std::exception { |
628 | + explicit WException |
629 | (const char * file, uint32_t line, const char * fmt, ...) |
630 | PRINTF_FORMAT(4, 5); |
631 | |
632 | /** |
633 | * The target of the returned pointer remains valid during the lifetime of |
634 | - * the _wexception object. |
635 | + * the WException object. |
636 | */ |
637 | const char * what() const noexcept override; |
638 | |
639 | protected: |
640 | - _wexception() {} |
641 | + WException() {} |
642 | std::string m_what; |
643 | }; |
644 | |
645 | -#define wexception(...) _wexception(__FILE__, __LINE__, __VA_ARGS__) |
646 | +#define wexception(...) WException(__FILE__, __LINE__, __VA_ARGS__) |
647 | |
648 | |
649 | #endif // end of include guard: WL_BASE_WEXCEPTION_H |
650 | |
651 | === modified file 'src/economy/cmd_call_economy_balance.cc' |
652 | --- src/economy/cmd_call_economy_balance.cc 2014-07-28 14:17:07 +0000 |
653 | +++ src/economy/cmd_call_economy_balance.cc 2014-09-18 15:54:00 +0000 |
654 | @@ -25,12 +25,12 @@ |
655 | #include "io/filewrite.h" |
656 | #include "logic/game.h" |
657 | #include "logic/player.h" |
658 | -#include "map_io/widelands_map_map_object_loader.h" |
659 | -#include "map_io/widelands_map_map_object_saver.h" |
660 | +#include "map_io/map_object_loader.h" |
661 | +#include "map_io/map_object_saver.h" |
662 | |
663 | namespace Widelands { |
664 | |
665 | -Cmd_Call_Economy_Balance::Cmd_Call_Economy_Balance |
666 | +CmdCallEconomyBalance::CmdCallEconomyBalance |
667 | (int32_t const starttime, Economy * const economy, uint32_t const timerid) |
668 | : GameLogicCommand(starttime) |
669 | { |
670 | @@ -42,7 +42,7 @@ |
671 | * Called by Cmd_Queue as requested by start_request_timer(). |
672 | * Call economy functions to balance supply and request. |
673 | */ |
674 | -void Cmd_Call_Economy_Balance::execute(Game & game) |
675 | +void CmdCallEconomyBalance::execute(Game & game) |
676 | { |
677 | if (Flag * const flag = m_flag.get(game)) |
678 | flag->get_economy()->balance(m_timerid); |
679 | @@ -53,8 +53,8 @@ |
680 | /** |
681 | * Read and write |
682 | */ |
683 | -void Cmd_Call_Economy_Balance::Read |
684 | - (FileRead & fr, Editor_Game_Base & egbase, MapMapObjectLoader & mol) |
685 | +void CmdCallEconomyBalance::Read |
686 | + (FileRead & fr, EditorGameBase & egbase, MapObjectLoader & mol) |
687 | { |
688 | try { |
689 | uint16_t const packet_version = fr.Unsigned16(); |
690 | @@ -84,14 +84,14 @@ |
691 | else |
692 | m_timerid = 0; |
693 | } else |
694 | - throw game_data_error |
695 | + throw GameDataError |
696 | ("unknown/unhandled version %u", packet_version); |
697 | - } catch (const _wexception & e) { |
698 | + } catch (const WException & e) { |
699 | throw wexception("call economy balance: %s", e.what()); |
700 | } |
701 | } |
702 | -void Cmd_Call_Economy_Balance::Write |
703 | - (FileWrite & fw, Editor_Game_Base & egbase, MapMapObjectSaver & mos) |
704 | +void CmdCallEconomyBalance::Write |
705 | + (FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos) |
706 | { |
707 | fw.Unsigned16(CURRENT_CMD_CALL_ECONOMY_VERSION); |
708 | |
709 | |
710 | === modified file 'src/economy/cmd_call_economy_balance.h' |
711 | --- src/economy/cmd_call_economy_balance.h 2014-07-28 14:17:07 +0000 |
712 | +++ src/economy/cmd_call_economy_balance.h 2014-09-18 15:54:00 +0000 |
713 | @@ -27,20 +27,20 @@ |
714 | namespace Widelands { |
715 | class Economy; |
716 | class Game; |
717 | -class MapMapObjectLoader; |
718 | - |
719 | - |
720 | -struct Cmd_Call_Economy_Balance : public GameLogicCommand { |
721 | - Cmd_Call_Economy_Balance () : GameLogicCommand(0), m_timerid(0) {} ///< for load and save |
722 | - |
723 | - Cmd_Call_Economy_Balance (int32_t starttime, Economy *, uint32_t timerid); |
724 | +class MapObjectLoader; |
725 | + |
726 | + |
727 | +struct CmdCallEconomyBalance : public GameLogicCommand { |
728 | + CmdCallEconomyBalance () : GameLogicCommand(0), m_timerid(0) {} ///< for load and save |
729 | + |
730 | + CmdCallEconomyBalance (int32_t starttime, Economy *, uint32_t timerid); |
731 | |
732 | void execute (Game &) override; |
733 | |
734 | uint8_t id() const override {return QUEUE_CMD_CALL_ECONOMY_BALANCE;} |
735 | |
736 | - void Write(FileWrite &, Editor_Game_Base &, MapMapObjectSaver &) override; |
737 | - void Read (FileRead &, Editor_Game_Base &, MapMapObjectLoader &) override; |
738 | + void Write(FileWrite &, EditorGameBase &, MapObjectSaver &) override; |
739 | + void Read (FileRead &, EditorGameBase &, MapObjectLoader &) override; |
740 | |
741 | private: |
742 | OPtr<Flag> m_flag; |
743 | |
744 | === modified file 'src/economy/economy.cc' |
745 | --- src/economy/economy.cc 2014-07-28 16:59:54 +0000 |
746 | +++ src/economy/economy.cc 2014-09-18 15:54:00 +0000 |
747 | @@ -44,25 +44,25 @@ |
748 | m_owner(player), |
749 | m_request_timerid(0) |
750 | { |
751 | - const Tribe_Descr & tribe = player.tribe(); |
752 | - Ware_Index const nr_wares = tribe.get_nrwares(); |
753 | - Ware_Index const nr_workers = tribe.get_nrworkers(); |
754 | + const TribeDescr & tribe = player.tribe(); |
755 | + WareIndex const nr_wares = tribe.get_nrwares(); |
756 | + WareIndex const nr_workers = tribe.get_nrworkers(); |
757 | m_wares.set_nrwares(nr_wares); |
758 | m_workers.set_nrwares(nr_workers); |
759 | |
760 | player.add_economy(*this); |
761 | |
762 | - m_ware_target_quantities = new Target_Quantity[nr_wares]; |
763 | - for (Ware_Index i = 0; i < nr_wares; ++i) { |
764 | - Target_Quantity tq; |
765 | + m_ware_target_quantities = new TargetQuantity[nr_wares]; |
766 | + for (WareIndex i = 0; i < nr_wares; ++i) { |
767 | + TargetQuantity tq; |
768 | tq.permanent = |
769 | tribe.get_ware_descr(i)->default_target_quantity(); |
770 | tq.last_modified = 0; |
771 | m_ware_target_quantities[i] = tq; |
772 | } |
773 | - m_worker_target_quantities = new Target_Quantity[nr_workers]; |
774 | - for (Ware_Index i = 0; i < nr_workers; ++i) { |
775 | - Target_Quantity tq; |
776 | + m_worker_target_quantities = new TargetQuantity[nr_workers]; |
777 | + for (WareIndex i = 0; i < nr_workers; ++i) { |
778 | + TargetQuantity tq; |
779 | tq.permanent = |
780 | tribe.get_worker_descr(i)->default_target_quantity(); |
781 | tq.last_modified = 0; |
782 | @@ -139,7 +139,7 @@ |
783 | |
784 | void Economy::_check_splits() |
785 | { |
786 | - Editor_Game_Base & egbase = owner().egbase(); |
787 | + EditorGameBase & egbase = owner().egbase(); |
788 | Map & map = egbase.map(); |
789 | |
790 | while (m_split_checks.size()) { |
791 | @@ -320,29 +320,29 @@ |
792 | } |
793 | |
794 | /** |
795 | - * Set the target quantities for the given Ware_Index to the |
796 | + * Set the target quantities for the given WareIndex to the |
797 | * numbers given in permanent. Also update the last |
798 | * modification time. |
799 | * |
800 | * This is called from Cmd_ResetTargetQuantity and Cmd_SetTargetQuantity |
801 | */ |
802 | void Economy::set_ware_target_quantity |
803 | - (Ware_Index const ware_type, |
804 | + (WareIndex const ware_type, |
805 | uint32_t const permanent, |
806 | Time const mod_time) |
807 | { |
808 | - Target_Quantity & tq = m_ware_target_quantities[ware_type]; |
809 | + TargetQuantity & tq = m_ware_target_quantities[ware_type]; |
810 | tq.permanent = permanent; |
811 | tq.last_modified = mod_time; |
812 | } |
813 | |
814 | |
815 | void Economy::set_worker_target_quantity |
816 | - (Ware_Index const ware_type, |
817 | + (WareIndex const ware_type, |
818 | uint32_t const permanent, |
819 | Time const mod_time) |
820 | { |
821 | - Target_Quantity & tq = m_worker_target_quantities[ware_type]; |
822 | + TargetQuantity & tq = m_worker_target_quantities[ware_type]; |
823 | tq.permanent = permanent; |
824 | tq.last_modified = mod_time; |
825 | } |
826 | @@ -354,7 +354,7 @@ |
827 | * This is also called when a ware is added to the economy through trade or |
828 | * a merger. |
829 | */ |
830 | -void Economy::add_wares(Ware_Index const id, uint32_t const count) |
831 | +void Economy::add_wares(WareIndex const id, uint32_t const count) |
832 | { |
833 | //log("%p: add(%i, %i)\n", this, id, count); |
834 | |
835 | @@ -363,7 +363,7 @@ |
836 | |
837 | // TODO(unknown): add to global player inventory? |
838 | } |
839 | -void Economy::add_workers(Ware_Index const id, uint32_t const count) |
840 | +void Economy::add_workers(WareIndex const id, uint32_t const count) |
841 | { |
842 | //log("%p: add(%i, %i)\n", this, id, count); |
843 | |
844 | @@ -379,7 +379,7 @@ |
845 | * This is also called when a ware is removed from the economy through trade or |
846 | * a split of the Economy. |
847 | */ |
848 | -void Economy::remove_wares(Ware_Index const id, uint32_t const count) |
849 | +void Economy::remove_wares(WareIndex const id, uint32_t const count) |
850 | { |
851 | assert(id < m_owner.tribe().get_nrwares()); |
852 | //log("%p: remove(%i, %i) from %i\n", this, id, count, m_wares.stock(id)); |
853 | @@ -394,7 +394,7 @@ |
854 | * This is also called when a worker is removed from the economy through |
855 | * a split of the Economy. |
856 | */ |
857 | -void Economy::remove_workers(Ware_Index const id, uint32_t const count) |
858 | +void Economy::remove_workers(WareIndex const id, uint32_t const count) |
859 | { |
860 | //log("%p: remove(%i, %i) from %i\n", this, id, count, m_workers.stock(id)); |
861 | |
862 | @@ -499,7 +499,7 @@ |
863 | } |
864 | |
865 | |
866 | -bool Economy::needs_ware(Ware_Index const ware_type) const { |
867 | +bool Economy::needs_ware(WareIndex const ware_type) const { |
868 | uint32_t const t = ware_target_quantity(ware_type).permanent; |
869 | uint32_t quantity = 0; |
870 | for (const Warehouse * wh : m_warehouses) { |
871 | @@ -511,7 +511,7 @@ |
872 | } |
873 | |
874 | |
875 | -bool Economy::needs_worker(Ware_Index const worker_type) const { |
876 | +bool Economy::needs_worker(WareIndex const worker_type) const { |
877 | uint32_t const t = worker_target_quantity(worker_type).permanent; |
878 | uint32_t quantity = 0; |
879 | for (const Warehouse * wh : m_warehouses) { |
880 | @@ -531,17 +531,17 @@ |
881 | */ |
882 | void Economy::_merge(Economy & e) |
883 | { |
884 | - for (Ware_Index i = m_owner.tribe().get_nrwares(); i;) { |
885 | + for (WareIndex i = m_owner.tribe().get_nrwares(); i;) { |
886 | --i; |
887 | - Target_Quantity other_tq = e.m_ware_target_quantities[i]; |
888 | - Target_Quantity & this_tq = m_ware_target_quantities[i]; |
889 | + TargetQuantity other_tq = e.m_ware_target_quantities[i]; |
890 | + TargetQuantity & this_tq = m_ware_target_quantities[i]; |
891 | if (this_tq.last_modified < other_tq.last_modified) |
892 | this_tq = other_tq; |
893 | } |
894 | - for (Ware_Index i = m_owner.tribe().get_nrworkers(); i;) { |
895 | + for (WareIndex i = m_owner.tribe().get_nrworkers(); i;) { |
896 | --i; |
897 | - Target_Quantity other_tq = e.m_worker_target_quantities[i]; |
898 | - Target_Quantity & this_tq = m_worker_target_quantities[i]; |
899 | + TargetQuantity other_tq = e.m_worker_target_quantities[i]; |
900 | + TargetQuantity & this_tq = m_worker_target_quantities[i]; |
901 | if (this_tq.last_modified < other_tq.last_modified) |
902 | this_tq = other_tq; |
903 | } |
904 | @@ -584,11 +584,11 @@ |
905 | |
906 | Economy & e = *new Economy(m_owner); |
907 | |
908 | - for (Ware_Index i = m_owner.tribe().get_nrwares (); i;) { |
909 | + for (WareIndex i = m_owner.tribe().get_nrwares (); i;) { |
910 | --i; |
911 | e.m_ware_target_quantities[i] = m_ware_target_quantities[i]; |
912 | } |
913 | - for (Ware_Index i = m_owner.tribe().get_nrworkers(); i;) { |
914 | + for (WareIndex i = m_owner.tribe().get_nrworkers(); i;) { |
915 | --i; |
916 | e.m_worker_target_quantities[i] = m_worker_target_quantities[i]; |
917 | } |
918 | @@ -613,7 +613,7 @@ |
919 | { |
920 | if (upcast(Game, game, &m_owner.egbase())) |
921 | game->cmdqueue().enqueue |
922 | - (new Cmd_Call_Economy_Balance |
923 | + (new CmdCallEconomyBalance |
924 | (game->get_gametime() + delta, this, m_request_timerid)); |
925 | } |
926 | |
927 | @@ -694,12 +694,9 @@ |
928 | }; |
929 | }; |
930 | |
931 | -typedef |
932 | - std::priority_queue |
933 | - <RequestSupplyPair, |
934 | +using RSPairQueue = std::priority_queue<RequestSupplyPair, |
935 | std::vector<RequestSupplyPair>, |
936 | - RequestSupplyPair::Compare> |
937 | - RSPairQueue; |
938 | + RequestSupplyPair::Compare>; |
939 | |
940 | struct RSPairStruct { |
941 | RSPairQueue queue; |
942 | @@ -807,12 +804,12 @@ |
943 | * Check whether there is a supply for the given request. If the request is a |
944 | * worker request without supply, attempt to create a new worker in a warehouse. |
945 | */ |
946 | -void Economy::_create_requested_worker(Game & game, Ware_Index index) |
947 | +void Economy::_create_requested_worker(Game & game, WareIndex index) |
948 | { |
949 | unsigned demand = 0; |
950 | |
951 | bool soldier_level_check; |
952 | - const Tribe_Descr & tribe = owner().tribe(); |
953 | + const TribeDescr & tribe = owner().tribe(); |
954 | const WorkerDescr & w_desc = *tribe.get_worker_descr(index); |
955 | |
956 | // Make a dummy soldier, which should never be assigned to any economy |
957 | @@ -935,9 +932,9 @@ |
958 | if (!warehouses().size()) |
959 | return; |
960 | |
961 | - const Tribe_Descr & tribe = owner().tribe(); |
962 | + const TribeDescr & tribe = owner().tribe(); |
963 | for |
964 | - (Ware_Index index = 0; |
965 | + (WareIndex index = 0; |
966 | index < tribe.get_nrworkers(); ++index) |
967 | { |
968 | if (!owner().is_worker_type_allowed(index)) |
969 | @@ -954,7 +951,7 @@ |
970 | */ |
971 | static bool accept_warehouse_if_policy |
972 | (Warehouse & wh, WareWorker type, |
973 | - Ware_Index ware, Warehouse::StockPolicy policy) |
974 | + WareIndex ware, Warehouse::StockPolicy policy) |
975 | { |
976 | return wh.get_stock_policy(type, ware) == policy; |
977 | } |
978 | @@ -968,7 +965,7 @@ |
979 | if (!warehouses().size()) |
980 | return; |
981 | |
982 | - typedef std::vector<std::pair<Supply *, Warehouse *> > Assignments; |
983 | + using Assignments = std::vector<std::pair<Supply *, Warehouse *>>; |
984 | Assignments assignments; |
985 | |
986 | for (uint32_t idx = 0; idx < m_supplies.get_nrsupplies(); ++idx) { |
987 | @@ -977,7 +974,7 @@ |
988 | continue; |
989 | |
990 | WareWorker type; |
991 | - Ware_Index ware; |
992 | + WareIndex ware; |
993 | supply.get_ware_type(type, ware); |
994 | |
995 | bool haveprefer = false; |
996 | @@ -1041,7 +1038,7 @@ |
997 | return; |
998 | ++m_request_timerid; |
999 | |
1000 | - Game & game = ref_cast<Game, Editor_Game_Base>(owner().egbase()); |
1001 | + Game & game = ref_cast<Game, EditorGameBase>(owner().egbase()); |
1002 | |
1003 | _check_splits(); |
1004 | |
1005 | |
1006 | === modified file 'src/economy/economy.h' |
1007 | --- src/economy/economy.h 2014-07-14 19:44:28 +0000 |
1008 | +++ src/economy/economy.h 2014-09-18 15:54:00 +0000 |
1009 | @@ -87,7 +87,7 @@ |
1010 | /// The last_modified time is used to determine which setting to use when |
1011 | /// economies are merged. The setting that was modified most recently will |
1012 | /// be used for the merged economy. |
1013 | - struct Target_Quantity { |
1014 | + struct TargetQuantity { |
1015 | uint32_t permanent; |
1016 | Time last_modified; |
1017 | }; |
1018 | @@ -106,7 +106,7 @@ |
1019 | WareWorker type, |
1020 | int32_t cost_cutoff = -1); |
1021 | |
1022 | - typedef boost::function<bool (Warehouse &)> WarehouseAcceptFn; |
1023 | + using WarehouseAcceptFn = boost::function<bool (Warehouse &)>; |
1024 | Warehouse * find_closest_warehouse |
1025 | (Flag & start, WareWorker type = wwWORKER, Route * route = nullptr, |
1026 | uint32_t cost_cutoff = 0, |
1027 | @@ -120,14 +120,14 @@ |
1028 | // (i.e. an Expedition ship). |
1029 | Flag* get_arbitrary_flag(); |
1030 | |
1031 | - void set_ware_target_quantity (Ware_Index, uint32_t, Time); |
1032 | - void set_worker_target_quantity(Ware_Index, uint32_t, Time); |
1033 | - |
1034 | - void add_wares (Ware_Index, uint32_t count = 1); |
1035 | - void remove_wares (Ware_Index, uint32_t count = 1); |
1036 | - |
1037 | - void add_workers(Ware_Index, uint32_t count = 1); |
1038 | - void remove_workers(Ware_Index, uint32_t count = 1); |
1039 | + void set_ware_target_quantity (WareIndex, uint32_t, Time); |
1040 | + void set_worker_target_quantity(WareIndex, uint32_t, Time); |
1041 | + |
1042 | + void add_wares (WareIndex, uint32_t count = 1); |
1043 | + void remove_wares (WareIndex, uint32_t count = 1); |
1044 | + |
1045 | + void add_workers(WareIndex, uint32_t count = 1); |
1046 | + void remove_workers(WareIndex, uint32_t count = 1); |
1047 | |
1048 | void add_warehouse(Warehouse &); |
1049 | void remove_warehouse(Warehouse &); |
1050 | @@ -140,33 +140,33 @@ |
1051 | void remove_supply(Supply &); |
1052 | |
1053 | /// information about this economy |
1054 | - WareList::count_type stock_ware (Ware_Index const i) { |
1055 | + WareList::WareCount stock_ware (WareIndex const i) { |
1056 | return m_wares .stock(i); |
1057 | } |
1058 | - WareList::count_type stock_worker(Ware_Index const i) { |
1059 | + WareList::WareCount stock_worker(WareIndex const i) { |
1060 | return m_workers.stock(i); |
1061 | } |
1062 | |
1063 | /// Whether the economy needs more of this ware type. |
1064 | /// Productionsites may ask this before they produce, to avoid depleting a |
1065 | /// ware type by overproducing another from it. |
1066 | - bool needs_ware(Ware_Index) const; |
1067 | + bool needs_ware(WareIndex) const; |
1068 | |
1069 | /// Whether the economy needs more of this worker type. |
1070 | /// Productionsites may ask this before they produce, to avoid depleting a |
1071 | /// ware type by overproducing a worker type from it. |
1072 | - bool needs_worker(Ware_Index) const; |
1073 | + bool needs_worker(WareIndex) const; |
1074 | |
1075 | - const Target_Quantity & ware_target_quantity (Ware_Index const i) const { |
1076 | - return m_ware_target_quantities[i]; |
1077 | - } |
1078 | - Target_Quantity & ware_target_quantity (Ware_Index const i) { |
1079 | - return m_ware_target_quantities[i]; |
1080 | - } |
1081 | - const Target_Quantity & worker_target_quantity(Ware_Index const i) const { |
1082 | + const TargetQuantity & ware_target_quantity (WareIndex const i) const { |
1083 | + return m_ware_target_quantities[i]; |
1084 | + } |
1085 | + TargetQuantity & ware_target_quantity (WareIndex const i) { |
1086 | + return m_ware_target_quantities[i]; |
1087 | + } |
1088 | + const TargetQuantity & worker_target_quantity(WareIndex const i) const { |
1089 | return m_worker_target_quantities[i]; |
1090 | } |
1091 | - Target_Quantity & worker_target_quantity(Ware_Index const i) { |
1092 | + TargetQuantity & worker_target_quantity(WareIndex const i) { |
1093 | return m_worker_target_quantities[i]; |
1094 | } |
1095 | |
1096 | @@ -201,18 +201,18 @@ |
1097 | void _balance_requestsupply(Game &); |
1098 | void _handle_active_supplies(Game &); |
1099 | void _create_requested_workers(Game &); |
1100 | - void _create_requested_worker(Game &, Ware_Index); |
1101 | + void _create_requested_worker(Game &, WareIndex); |
1102 | |
1103 | bool _has_request(Request &); |
1104 | |
1105 | /*************/ |
1106 | /* Variables */ |
1107 | /*************/ |
1108 | - typedef std::vector<Request *> RequestList; |
1109 | + using RequestList = std::vector<Request *>; |
1110 | |
1111 | Player & m_owner; |
1112 | |
1113 | - typedef std::vector<Flag *> Flags; |
1114 | + using Flags = std::vector<Flag *>; |
1115 | Flags m_flags; |
1116 | WareList m_wares; ///< virtual storage with all wares in this Economy |
1117 | WareList m_workers; ///< virtual storage with all workers in this Economy |
1118 | @@ -221,11 +221,11 @@ |
1119 | RequestList m_requests; ///< requests |
1120 | SupplyList m_supplies; |
1121 | |
1122 | - Target_Quantity * m_ware_target_quantities; |
1123 | - Target_Quantity * m_worker_target_quantities; |
1124 | + TargetQuantity * m_ware_target_quantities; |
1125 | + TargetQuantity * m_worker_target_quantities; |
1126 | Router * m_router; |
1127 | |
1128 | - typedef std::pair<OPtr<Flag>, OPtr<Flag> > SplitPair; |
1129 | + using SplitPair = std::pair<OPtr<Flag>, OPtr<Flag>>; |
1130 | std::vector<SplitPair> m_split_checks; |
1131 | |
1132 | /** |
1133 | |
1134 | === modified file 'src/economy/economy_data_packet.cc' |
1135 | --- src/economy/economy_data_packet.cc 2014-07-20 07:42:37 +0000 |
1136 | +++ src/economy/economy_data_packet.cc 2014-09-18 15:54:00 +0000 |
1137 | @@ -24,8 +24,8 @@ |
1138 | #include "io/filewrite.h" |
1139 | #include "logic/player.h" |
1140 | #include "logic/tribe.h" |
1141 | -#include "map_io/widelands_map_map_object_loader.h" |
1142 | -#include "map_io/widelands_map_map_object_saver.h" |
1143 | +#include "map_io/map_object_loader.h" |
1144 | +#include "map_io/map_object_saver.h" |
1145 | |
1146 | #define CURRENT_ECONOMY_VERSION 3 |
1147 | |
1148 | @@ -39,13 +39,13 @@ |
1149 | if (1 <= version && version <= CURRENT_ECONOMY_VERSION) { |
1150 | if (2 <= version) |
1151 | try { |
1152 | - const Tribe_Descr & tribe = m_eco->owner().tribe(); |
1153 | + const TribeDescr & tribe = m_eco->owner().tribe(); |
1154 | while (Time const last_modified = fr.Unsigned32()) { |
1155 | char const * const type_name = fr.CString(); |
1156 | uint32_t const permanent = fr.Unsigned32(); |
1157 | if (version <= 2) |
1158 | fr.Unsigned32(); |
1159 | - Ware_Index i = tribe.ware_index(type_name); |
1160 | + WareIndex i = tribe.ware_index(type_name); |
1161 | if (i != INVALID_INDEX) { |
1162 | if (tribe.get_ware_descr(i)->default_target_quantity() == |
1163 | std::numeric_limits<uint32_t>::max()) |
1164 | @@ -54,10 +54,10 @@ |
1165 | "ignoring\n", |
1166 | type_name); |
1167 | else { |
1168 | - Economy::Target_Quantity & tq = |
1169 | + Economy::TargetQuantity & tq = |
1170 | m_eco->m_ware_target_quantities[i]; |
1171 | if (tq.last_modified) |
1172 | - throw game_data_error |
1173 | + throw GameDataError |
1174 | ("duplicated entry for %s", type_name); |
1175 | tq.permanent = permanent; |
1176 | tq.last_modified = last_modified; |
1177 | @@ -73,10 +73,10 @@ |
1178 | "ignoring\n", |
1179 | type_name); |
1180 | else { |
1181 | - Economy::Target_Quantity & tq = |
1182 | + Economy::TargetQuantity & tq = |
1183 | m_eco->m_worker_target_quantities[i]; |
1184 | if (tq.last_modified) |
1185 | - throw game_data_error |
1186 | + throw GameDataError |
1187 | ("duplicated entry for %s", type_name); |
1188 | tq.permanent = permanent; |
1189 | tq.last_modified = last_modified; |
1190 | @@ -88,25 +88,25 @@ |
1191 | "%s, ignoring\n", |
1192 | type_name, tribe.name().c_str()); |
1193 | } |
1194 | - } catch (const _wexception & e) { |
1195 | - throw game_data_error("target quantities: %s", e.what()); |
1196 | + } catch (const WException & e) { |
1197 | + throw GameDataError("target quantities: %s", e.what()); |
1198 | } |
1199 | m_eco->m_request_timerid = fr.Unsigned32(); |
1200 | } else { |
1201 | - throw game_data_error("unknown version %u", version); |
1202 | + throw GameDataError("unknown version %u", version); |
1203 | } |
1204 | } catch (const std::exception & e) { |
1205 | - throw game_data_error("economy: %s", e.what()); |
1206 | + throw GameDataError("economy: %s", e.what()); |
1207 | } |
1208 | } |
1209 | |
1210 | void EconomyDataPacket::Write(FileWrite & fw) |
1211 | { |
1212 | fw.Unsigned16(CURRENT_ECONOMY_VERSION); |
1213 | - const Tribe_Descr & tribe = m_eco->owner().tribe(); |
1214 | - for (Ware_Index i = tribe.get_nrwares(); i;) { |
1215 | + const TribeDescr & tribe = m_eco->owner().tribe(); |
1216 | + for (WareIndex i = tribe.get_nrwares(); i;) { |
1217 | --i; |
1218 | - const Economy::Target_Quantity & tq = |
1219 | + const Economy::TargetQuantity & tq = |
1220 | m_eco->m_ware_target_quantities[i]; |
1221 | if (Time const last_modified = tq.last_modified) { |
1222 | fw.Unsigned32(last_modified); |
1223 | @@ -114,9 +114,9 @@ |
1224 | fw.Unsigned32(tq.permanent); |
1225 | } |
1226 | } |
1227 | - for (Ware_Index i = tribe.get_nrworkers(); i;) { |
1228 | + for (WareIndex i = tribe.get_nrworkers(); i;) { |
1229 | --i; |
1230 | - const Economy::Target_Quantity & tq = |
1231 | + const Economy::TargetQuantity & tq = |
1232 | m_eco->m_worker_target_quantities[i]; |
1233 | if (Time const last_modified = tq.last_modified) { |
1234 | fw.Unsigned32(last_modified); |
1235 | |
1236 | === modified file 'src/economy/economy_data_packet.h' |
1237 | --- src/economy/economy_data_packet.h 2014-07-28 14:17:07 +0000 |
1238 | +++ src/economy/economy_data_packet.h 2014-09-18 15:54:00 +0000 |
1239 | @@ -26,8 +26,8 @@ |
1240 | namespace Widelands { |
1241 | class Economy; |
1242 | class Game; |
1243 | -class MapMapObjectLoader; |
1244 | -struct MapMapObjectSaver; |
1245 | +class MapObjectLoader; |
1246 | +struct MapObjectSaver; |
1247 | |
1248 | class EconomyDataPacket { |
1249 | public: |
1250 | |
1251 | === modified file 'src/economy/flag.cc' |
1252 | --- src/economy/flag.cc 2014-07-28 16:59:54 +0000 |
1253 | +++ src/economy/flag.cc 2014-09-18 15:54:00 +0000 |
1254 | @@ -80,7 +80,7 @@ |
1255 | log("Flag: ouch! road left\n"); |
1256 | } |
1257 | |
1258 | -void Flag::load_finish(Editor_Game_Base & egbase) { |
1259 | +void Flag::load_finish(EditorGameBase & egbase) { |
1260 | auto should_be_deleted = [&egbase, this](const OPtr<Worker>& r) { |
1261 | Worker& worker = *r.get(egbase); |
1262 | Bob::State const* const state = worker.get_state(Worker::taskWaitforcapacity); |
1263 | @@ -112,7 +112,7 @@ |
1264 | * Create a flag at the given location |
1265 | */ |
1266 | Flag::Flag |
1267 | - (Editor_Game_Base & egbase, Player & owning_player, Coords const coords) |
1268 | + (EditorGameBase & egbase, Player & owning_player, Coords const coords) |
1269 | : |
1270 | PlayerImmovable (g_flag_descr), |
1271 | m_building (nullptr), |
1272 | @@ -196,7 +196,7 @@ |
1273 | /** |
1274 | * Call this only from the Building init! |
1275 | */ |
1276 | -void Flag::attach_building(Editor_Game_Base & egbase, Building & building) |
1277 | +void Flag::attach_building(EditorGameBase & egbase, Building & building) |
1278 | { |
1279 | assert(!m_building || m_building == &building); |
1280 | |
1281 | @@ -212,7 +212,7 @@ |
1282 | /** |
1283 | * Call this only from the Building cleanup! |
1284 | */ |
1285 | -void Flag::detach_building(Editor_Game_Base & egbase) |
1286 | +void Flag::detach_building(EditorGameBase & egbase) |
1287 | { |
1288 | assert(m_building); |
1289 | |
1290 | @@ -251,7 +251,7 @@ |
1291 | * Return all positions we occupy on the map. For a Flag, this is only one |
1292 | */ |
1293 | BaseImmovable::PositionList Flag::get_positions |
1294 | - (const Editor_Game_Base &) const |
1295 | + (const EditorGameBase &) const |
1296 | { |
1297 | PositionList rv; |
1298 | rv.push_back(m_position); |
1299 | @@ -368,7 +368,7 @@ |
1300 | } |
1301 | |
1302 | |
1303 | -void Flag::add_ware(Editor_Game_Base & egbase, WareInstance & ware) |
1304 | +void Flag::add_ware(EditorGameBase & egbase, WareInstance & ware) |
1305 | { |
1306 | |
1307 | assert(m_ware_filled < m_ware_capacity); |
1308 | @@ -558,7 +558,7 @@ |
1309 | * Force a removal of the given ware from this flag. |
1310 | * Called by \ref WareInstance::cleanup() |
1311 | */ |
1312 | -void Flag::remove_ware(Editor_Game_Base & egbase, WareInstance * const ware) |
1313 | +void Flag::remove_ware(EditorGameBase & egbase, WareInstance * const ware) |
1314 | { |
1315 | for (int32_t i = 0; i < m_ware_filled; ++i) { |
1316 | if (m_wares[i].ware != ware) |
1317 | @@ -694,7 +694,7 @@ |
1318 | m_always_call_for_flag = nullptr; |
1319 | } |
1320 | |
1321 | -void Flag::init(Editor_Game_Base & egbase) |
1322 | +void Flag::init(EditorGameBase & egbase) |
1323 | { |
1324 | PlayerImmovable::init(egbase); |
1325 | |
1326 | @@ -706,7 +706,7 @@ |
1327 | /** |
1328 | * Detach building and free roads. |
1329 | */ |
1330 | -void Flag::cleanup(Editor_Game_Base & egbase) |
1331 | +void Flag::cleanup(EditorGameBase & egbase) |
1332 | { |
1333 | //molog("Flag::cleanup\n"); |
1334 | |
1335 | @@ -753,7 +753,7 @@ |
1336 | * \ref Flag::cleanup(). This function is needed to ensure a fire is created |
1337 | * when a player removes a flag. |
1338 | */ |
1339 | -void Flag::destroy(Editor_Game_Base & egbase) |
1340 | +void Flag::destroy(EditorGameBase & egbase) |
1341 | { |
1342 | if (m_building) { |
1343 | m_building->destroy(egbase); |
1344 | @@ -768,7 +768,7 @@ |
1345 | * the given program once it's completed. |
1346 | */ |
1347 | void Flag::add_flag_job |
1348 | - (Game &, Ware_Index const workerware, const std::string & programname) |
1349 | + (Game &, WareIndex const workerware, const std::string & programname) |
1350 | { |
1351 | FlagJob j; |
1352 | |
1353 | @@ -787,7 +787,7 @@ |
1354 | void Flag::flag_job_request_callback |
1355 | (Game & game, |
1356 | Request & rq, |
1357 | - Ware_Index, |
1358 | + WareIndex, |
1359 | Worker * const w, |
1360 | PlayerImmovable & target) |
1361 | { |
1362 | @@ -811,7 +811,7 @@ |
1363 | flag.molog("BUG: flag_job_request_callback: worker not found in list\n"); |
1364 | } |
1365 | |
1366 | -void Flag::log_general_info(const Widelands::Editor_Game_Base & egbase) |
1367 | +void Flag::log_general_info(const Widelands::EditorGameBase & egbase) |
1368 | { |
1369 | molog("Flag at %i,%i\n", m_position.x, m_position.y); |
1370 | |
1371 | |
1372 | === modified file 'src/economy/flag.h' |
1373 | --- src/economy/flag.h 2014-07-28 16:59:54 +0000 |
1374 | +++ src/economy/flag.h 2014-09-18 15:54:00 +0000 |
1375 | @@ -61,23 +61,23 @@ |
1376 | * WALK_xx in all "direction" parameters. |
1377 | */ |
1378 | struct Flag : public PlayerImmovable, public RoutingNode { |
1379 | - typedef std::vector<const WareInstance *> Wares; |
1380 | + using Wares = std::vector<const WareInstance *>; |
1381 | |
1382 | friend class Economy; |
1383 | friend class FlagQueue; |
1384 | - friend class Map_Flagdata_Data_Packet; // has to read/write this to a file |
1385 | - friend struct Map_Ware_Data_Packet; // has to look at pending wares |
1386 | - friend struct Map_Waredata_Data_Packet; // has to look at pending wares |
1387 | + friend class MapFlagdataPacket; // has to read/write this to a file |
1388 | + friend struct MapWarePacket; // has to look at pending wares |
1389 | + friend struct MapWaredataPacket; // has to look at pending wares |
1390 | friend struct Router; |
1391 | |
1392 | const FlagDescr& descr() const; |
1393 | |
1394 | Flag(); /// empty flag for savegame loading |
1395 | - Flag(Editor_Game_Base &, Player & owner, Coords); /// create a new flag |
1396 | + Flag(EditorGameBase &, Player & owner, Coords); /// create a new flag |
1397 | ~Flag() override; |
1398 | |
1399 | - void load_finish(Editor_Game_Base &) override; |
1400 | - void destroy(Editor_Game_Base &) override; |
1401 | + void load_finish(EditorGameBase &) override; |
1402 | + void destroy(EditorGameBase &) override; |
1403 | |
1404 | int32_t get_size () const override; |
1405 | bool get_passable() const override; |
1406 | @@ -85,15 +85,15 @@ |
1407 | Flag & base_flag() override; |
1408 | |
1409 | const Coords & get_position() const override {return m_position;} |
1410 | - PositionList get_positions (const Editor_Game_Base &) const override; |
1411 | + PositionList get_positions (const EditorGameBase &) const override; |
1412 | void get_neighbours(WareWorker type, RoutingNodeNeighbours &) override; |
1413 | int32_t get_waitcost() const {return m_ware_filled;} |
1414 | |
1415 | void set_economy(Economy *) override; |
1416 | |
1417 | Building * get_building() const {return m_building;} |
1418 | - void attach_building(Editor_Game_Base &, Building &); |
1419 | - void detach_building(Editor_Game_Base &); |
1420 | + void attach_building(EditorGameBase &, Building &); |
1421 | + void detach_building(EditorGameBase &); |
1422 | |
1423 | bool has_road() const { |
1424 | return |
1425 | @@ -114,7 +114,7 @@ |
1426 | uint32_t current_wares() const {return m_ware_filled;} |
1427 | void wait_for_capacity(Game &, Worker &); |
1428 | void skip_wait_for_capacity(Game &, Worker &); |
1429 | - void add_ware(Editor_Game_Base &, WareInstance &); |
1430 | + void add_ware(EditorGameBase &, WareInstance &); |
1431 | bool has_pending_ware(Game &, Flag & destflag); |
1432 | bool ack_pickup(Game &, Flag & destflag); |
1433 | bool cancel_pickup(Game &, Flag & destflag); |
1434 | @@ -124,21 +124,21 @@ |
1435 | void call_carrier(Game &, WareInstance &, PlayerImmovable * nextstep); |
1436 | void update_wares(Game &, Flag * other); |
1437 | |
1438 | - void remove_ware(Editor_Game_Base &, WareInstance * const); |
1439 | - |
1440 | - void add_flag_job(Game &, Ware_Index workerware, const std::string & programname); |
1441 | - |
1442 | - void log_general_info(const Editor_Game_Base &) override; |
1443 | + void remove_ware(EditorGameBase &, WareInstance * const); |
1444 | + |
1445 | + void add_flag_job(Game &, WareIndex workerware, const std::string & programname); |
1446 | + |
1447 | + void log_general_info(const EditorGameBase &) override; |
1448 | |
1449 | protected: |
1450 | - void init(Editor_Game_Base &) override; |
1451 | - void cleanup(Editor_Game_Base &) override; |
1452 | + void init(EditorGameBase &) override; |
1453 | + void cleanup(EditorGameBase &) override; |
1454 | |
1455 | - void draw(const Editor_Game_Base &, RenderTarget &, const FCoords&, const Point&) override; |
1456 | + void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override; |
1457 | |
1458 | void wake_up_capacity_queue(Game &); |
1459 | |
1460 | - static void flag_job_request_callback(Game &, Request &, Ware_Index, Worker *, PlayerImmovable &); |
1461 | + static void flag_job_request_callback(Game &, Request &, WareIndex, Worker *, PlayerImmovable &); |
1462 | |
1463 | void set_flag_position(Coords coords); |
1464 | |
1465 | @@ -169,10 +169,10 @@ |
1466 | /// the given flag |
1467 | Flag * m_always_call_for_flag; |
1468 | |
1469 | - typedef std::vector<OPtr<Worker> > CapacityWaitQueue; |
1470 | + using CapacityWaitQueue = std::vector<OPtr<Worker>>; |
1471 | CapacityWaitQueue m_capacity_wait; ///< workers waiting for capacity |
1472 | |
1473 | - typedef std::list<FlagJob> FlagJobs; |
1474 | + using FlagJobs = std::list<FlagJob>; |
1475 | FlagJobs m_flag_jobs; |
1476 | }; |
1477 | |
1478 | |
1479 | === modified file 'src/economy/fleet.cc' |
1480 | --- src/economy/fleet.cc 2014-07-28 16:59:54 +0000 |
1481 | +++ src/economy/fleet.cc 2014-09-18 15:54:00 +0000 |
1482 | @@ -35,8 +35,8 @@ |
1483 | #include "logic/player.h" |
1484 | #include "logic/ship.h" |
1485 | #include "logic/warehouse.h" |
1486 | -#include "map_io/widelands_map_map_object_loader.h" |
1487 | -#include "map_io/widelands_map_map_object_saver.h" |
1488 | +#include "map_io/map_object_loader.h" |
1489 | +#include "map_io/map_object_saver.h" |
1490 | |
1491 | namespace Widelands { |
1492 | |
1493 | @@ -101,7 +101,7 @@ |
1494 | * Initialize the fleet, including a search through the map |
1495 | * to rejoin with the next other fleet we can find. |
1496 | */ |
1497 | -void Fleet::init(Editor_Game_Base & egbase) |
1498 | +void Fleet::init(EditorGameBase & egbase) |
1499 | { |
1500 | MapObject::init(egbase); |
1501 | |
1502 | @@ -140,7 +140,7 @@ |
1503 | * Search the map, starting at our ships and ports, for another fleet |
1504 | * of the same player. |
1505 | */ |
1506 | -void Fleet::find_other_fleet(Editor_Game_Base & egbase) |
1507 | +void Fleet::find_other_fleet(EditorGameBase & egbase) |
1508 | { |
1509 | Map & map = egbase.map(); |
1510 | MapAStar<StepEvalFindFleet> astar(map, StepEvalFindFleet()); |
1511 | @@ -192,7 +192,7 @@ |
1512 | /** |
1513 | * Merge the @p other fleet into this fleet, and remove the other fleet. |
1514 | */ |
1515 | -void Fleet::merge(Editor_Game_Base & egbase, Fleet * other) |
1516 | +void Fleet::merge(EditorGameBase & egbase, Fleet * other) |
1517 | { |
1518 | if (m_ports.empty() && !other->m_ports.empty()) { |
1519 | other->merge(egbase, this); |
1520 | @@ -244,7 +244,7 @@ |
1521 | } |
1522 | } |
1523 | |
1524 | -void Fleet::cleanup(Editor_Game_Base & egbase) |
1525 | +void Fleet::cleanup(EditorGameBase & egbase) |
1526 | { |
1527 | while (!m_ports.empty()) { |
1528 | PortDock * pd = m_ports.back(); |
1529 | @@ -371,7 +371,7 @@ |
1530 | } |
1531 | } |
1532 | |
1533 | -void Fleet::remove_ship(Editor_Game_Base & egbase, Ship * ship) |
1534 | +void Fleet::remove_ship(EditorGameBase & egbase, Ship * ship) |
1535 | { |
1536 | std::vector<Ship *>::iterator it = std::find(m_ships.begin(), m_ships.end(), ship); |
1537 | if (it != m_ships.end()) { |
1538 | @@ -432,7 +432,7 @@ |
1539 | * Note that this is done lazily, i.e. the first time a path is actually requested, |
1540 | * because path finding is flaky during map loading. |
1541 | */ |
1542 | -void Fleet::connect_port(Editor_Game_Base & egbase, uint32_t idx) |
1543 | +void Fleet::connect_port(EditorGameBase & egbase, uint32_t idx) |
1544 | { |
1545 | Map & map = egbase.map(); |
1546 | StepEvalFindPorts se; |
1547 | @@ -508,7 +508,7 @@ |
1548 | } |
1549 | } |
1550 | |
1551 | -void Fleet::add_port(Editor_Game_Base & /* egbase */, PortDock * port) |
1552 | +void Fleet::add_port(EditorGameBase & /* egbase */, PortDock * port) |
1553 | { |
1554 | m_ports.push_back(port); |
1555 | port->set_fleet(this); |
1556 | @@ -522,7 +522,7 @@ |
1557 | m_portpaths.resize((m_ports.size() * (m_ports.size() - 1)) / 2); |
1558 | } |
1559 | |
1560 | -void Fleet::remove_port(Editor_Game_Base & egbase, PortDock * port) |
1561 | +void Fleet::remove_port(EditorGameBase & egbase, PortDock * port) |
1562 | { |
1563 | std::vector<PortDock *>::iterator it = std::find(m_ports.begin(), m_ports.end(), port); |
1564 | if (it != m_ports.end()) { |
1565 | @@ -582,7 +582,7 @@ |
1566 | /** |
1567 | * Trigger an update of ship scheduling |
1568 | */ |
1569 | -void Fleet::update(Editor_Game_Base & egbase) |
1570 | +void Fleet::update(EditorGameBase & egbase) |
1571 | { |
1572 | if (m_act_pending) |
1573 | return; |
1574 | @@ -672,7 +672,7 @@ |
1575 | } |
1576 | } |
1577 | |
1578 | -void Fleet::log_general_info(const Editor_Game_Base & egbase) |
1579 | +void Fleet::log_general_info(const EditorGameBase & egbase) |
1580 | { |
1581 | MapObject::log_general_info(egbase); |
1582 | |
1583 | @@ -750,7 +750,7 @@ |
1584 | } |
1585 | |
1586 | MapObject::Loader * Fleet::load |
1587 | - (Editor_Game_Base & egbase, MapMapObjectLoader & mol, FileRead & fr) |
1588 | + (EditorGameBase & egbase, MapObjectLoader & mol, FileRead & fr) |
1589 | { |
1590 | std::unique_ptr<Loader> loader(new Loader); |
1591 | |
1592 | @@ -758,20 +758,20 @@ |
1593 | // The header has been peeled away by the caller |
1594 | uint8_t const version = fr.Unsigned8(); |
1595 | if (1 <= version && version <= FLEET_SAVEGAME_VERSION) { |
1596 | - Player_Number owner_number = fr.Unsigned8(); |
1597 | + PlayerNumber owner_number = fr.Unsigned8(); |
1598 | if (!owner_number || owner_number > egbase.map().get_nrplayers()) |
1599 | - throw game_data_error |
1600 | + throw GameDataError |
1601 | ("owner number is %u but there are only %u players", |
1602 | owner_number, egbase.map().get_nrplayers()); |
1603 | |
1604 | Player * owner = egbase.get_player(owner_number); |
1605 | if (!owner) |
1606 | - throw game_data_error("owning player %u does not exist", owner_number); |
1607 | + throw GameDataError("owning player %u does not exist", owner_number); |
1608 | |
1609 | loader->init(egbase, mol, *(new Fleet(*owner))); |
1610 | loader->load(fr, version); |
1611 | } else |
1612 | - throw game_data_error("unknown/unhandled version %u", version); |
1613 | + throw GameDataError("unknown/unhandled version %u", version); |
1614 | } catch (const std::exception & e) { |
1615 | throw wexception("loading portdock: %s", e.what()); |
1616 | } |
1617 | @@ -779,7 +779,7 @@ |
1618 | return loader.release(); |
1619 | } |
1620 | |
1621 | -void Fleet::save(Editor_Game_Base & egbase, MapMapObjectSaver & mos, FileWrite & fw) |
1622 | +void Fleet::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw) |
1623 | { |
1624 | fw.Unsigned8(HeaderFleet); |
1625 | fw.Unsigned8(FLEET_SAVEGAME_VERSION); |
1626 | |
1627 | === modified file 'src/economy/fleet.h' |
1628 | --- src/economy/fleet.h 2014-07-28 16:59:54 +0000 |
1629 | +++ src/economy/fleet.h 2014-09-18 15:54:00 +0000 |
1630 | @@ -84,16 +84,16 @@ |
1631 | |
1632 | bool active() const; |
1633 | |
1634 | - void init(Editor_Game_Base &) override; |
1635 | - void cleanup(Editor_Game_Base &) override; |
1636 | - void update(Editor_Game_Base &); |
1637 | + void init(EditorGameBase &) override; |
1638 | + void cleanup(EditorGameBase &) override; |
1639 | + void update(EditorGameBase &); |
1640 | |
1641 | void add_ship(Ship * ship); |
1642 | - void remove_ship(Editor_Game_Base & egbase, Ship * ship); |
1643 | - void add_port(Editor_Game_Base & egbase, PortDock * port); |
1644 | - void remove_port(Editor_Game_Base & egbase, PortDock * port); |
1645 | + void remove_ship(EditorGameBase & egbase, Ship * ship); |
1646 | + void add_port(EditorGameBase & egbase, PortDock * port); |
1647 | + void remove_port(EditorGameBase & egbase, PortDock * port); |
1648 | |
1649 | - void log_general_info(const Editor_Game_Base &) override; |
1650 | + void log_general_info(const EditorGameBase &) override; |
1651 | |
1652 | bool get_path(PortDock & start, PortDock & end, Path & path); |
1653 | void add_neighbours(PortDock & pd, std::vector<RoutingNodeNeighbour> & neighbours); |
1654 | @@ -102,10 +102,10 @@ |
1655 | void act(Game &, uint32_t data) override; |
1656 | |
1657 | private: |
1658 | - void find_other_fleet(Editor_Game_Base & egbase); |
1659 | - void merge(Editor_Game_Base & egbase, Fleet * other); |
1660 | + void find_other_fleet(EditorGameBase & egbase); |
1661 | + void merge(EditorGameBase & egbase, Fleet * other); |
1662 | void check_merge_economy(); |
1663 | - void connect_port(Editor_Game_Base & egbase, uint32_t idx); |
1664 | + void connect_port(EditorGameBase & egbase, uint32_t idx); |
1665 | |
1666 | PortPath & portpath(uint32_t i, uint32_t j); |
1667 | const PortPath & portpath(uint32_t i, uint32_t j) const; |
1668 | @@ -142,10 +142,10 @@ |
1669 | |
1670 | public: |
1671 | bool has_new_save_support() override {return true;} |
1672 | - void save(Editor_Game_Base &, MapMapObjectSaver &, FileWrite &) override; |
1673 | + void save(EditorGameBase &, MapObjectSaver &, FileWrite &) override; |
1674 | |
1675 | static MapObject::Loader * load |
1676 | - (Editor_Game_Base &, MapMapObjectLoader &, FileRead &); |
1677 | + (EditorGameBase &, MapObjectLoader &, FileRead &); |
1678 | }; |
1679 | |
1680 | } // namespace Widelands |
1681 | |
1682 | === modified file 'src/economy/idleworkersupply.cc' |
1683 | --- src/economy/idleworkersupply.cc 2014-07-20 07:42:37 +0000 |
1684 | +++ src/economy/idleworkersupply.cc 2014-09-18 15:54:00 +0000 |
1685 | @@ -76,7 +76,7 @@ |
1686 | return m_worker.get_transfer(); |
1687 | } |
1688 | |
1689 | -void IdleWorkerSupply::get_ware_type(WareWorker & type, Ware_Index & ware) const |
1690 | +void IdleWorkerSupply::get_ware_type(WareWorker & type, WareIndex & ware) const |
1691 | { |
1692 | type = wwWORKER; |
1693 | ware = m_worker.descr().worker_index(); |
1694 | |
1695 | === modified file 'src/economy/idleworkersupply.h' |
1696 | --- src/economy/idleworkersupply.h 2014-07-26 10:43:23 +0000 |
1697 | +++ src/economy/idleworkersupply.h 2014-09-18 15:54:00 +0000 |
1698 | @@ -35,7 +35,7 @@ |
1699 | |
1700 | bool is_active() const override; |
1701 | bool has_storage() const override; |
1702 | - void get_ware_type(WareWorker & type, Ware_Index & ware) const override; |
1703 | + void get_ware_type(WareWorker & type, WareIndex & ware) const override; |
1704 | void send_to_storage(Game &, Warehouse * wh) override; |
1705 | |
1706 | uint32_t nr_supplies(const Game &, const Request &) const override; |
1707 | |
1708 | === modified file 'src/economy/portdock.cc' |
1709 | --- src/economy/portdock.cc 2014-07-28 16:59:54 +0000 |
1710 | +++ src/economy/portdock.cc 2014-09-18 15:54:00 +0000 |
1711 | @@ -34,8 +34,8 @@ |
1712 | #include "logic/ship.h" |
1713 | #include "logic/warehouse.h" |
1714 | #include "logic/widelands_geometry_io.h" |
1715 | -#include "map_io/widelands_map_map_object_loader.h" |
1716 | -#include "map_io/widelands_map_map_object_saver.h" |
1717 | +#include "map_io/map_object_loader.h" |
1718 | +#include "map_io/map_object_saver.h" |
1719 | #include "wui/interactive_gamebase.h" |
1720 | |
1721 | namespace Widelands { |
1722 | @@ -106,7 +106,7 @@ |
1723 | } |
1724 | |
1725 | PortDock::PositionList PortDock::get_positions |
1726 | - (const Editor_Game_Base &) const |
1727 | + (const EditorGameBase &) const |
1728 | { |
1729 | return m_dockpoints; |
1730 | } |
1731 | @@ -154,12 +154,12 @@ |
1732 | |
1733 | |
1734 | void PortDock::draw |
1735 | - (const Editor_Game_Base &, RenderTarget &, const FCoords&, const Point&) |
1736 | + (const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) |
1737 | { |
1738 | // do nothing |
1739 | } |
1740 | |
1741 | -void PortDock::init(Editor_Game_Base & egbase) |
1742 | +void PortDock::init(EditorGameBase & egbase) |
1743 | { |
1744 | PlayerImmovable::init(egbase); |
1745 | |
1746 | @@ -174,7 +174,7 @@ |
1747 | * Create our initial singleton @ref Fleet. The fleet code ensures |
1748 | * that we merge with a larger fleet when possible. |
1749 | */ |
1750 | -void PortDock::init_fleet(Editor_Game_Base & egbase) |
1751 | +void PortDock::init_fleet(EditorGameBase & egbase) |
1752 | { |
1753 | Fleet * fleet = new Fleet(owner()); |
1754 | fleet->add_port(egbase, this); |
1755 | @@ -182,7 +182,7 @@ |
1756 | // Note: the Fleet calls our set_fleet automatically |
1757 | } |
1758 | |
1759 | -void PortDock::cleanup(Editor_Game_Base & egbase) |
1760 | +void PortDock::cleanup(EditorGameBase & egbase) |
1761 | { |
1762 | if (egbase.objects().object_still_available(m_warehouse)) { |
1763 | // Transfer all our wares into the warehouse. |
1764 | @@ -344,7 +344,7 @@ |
1765 | // The expedition goods are now on the ship, so from now on it is independent from the port |
1766 | // and thus we switch the port to normal, so we could even start a new expedition, |
1767 | cancel_expedition(game); |
1768 | - if (upcast(Interactive_GameBase, igb, game.get_ibase())) |
1769 | + if (upcast(InteractiveGameBase, igb, game.get_ibase())) |
1770 | ship.refresh_window(*igb); |
1771 | return m_fleet->update(game); |
1772 | } |
1773 | @@ -393,7 +393,7 @@ |
1774 | /** |
1775 | * Return the number of wares or workers of the given type that are waiting at the dock. |
1776 | */ |
1777 | -uint32_t PortDock::count_waiting(WareWorker waretype, Ware_Index wareindex) |
1778 | +uint32_t PortDock::count_waiting(WareWorker waretype, WareIndex wareindex) |
1779 | { |
1780 | uint32_t count = 0; |
1781 | |
1782 | @@ -446,7 +446,7 @@ |
1783 | } |
1784 | |
1785 | |
1786 | -void PortDock::log_general_info(const Editor_Game_Base & egbase) |
1787 | +void PortDock::log_general_info(const EditorGameBase & egbase) |
1788 | { |
1789 | PlayerImmovable::log_general_info(egbase); |
1790 | |
1791 | @@ -538,7 +538,7 @@ |
1792 | } |
1793 | |
1794 | MapObject::Loader * PortDock::load |
1795 | - (Editor_Game_Base & egbase, MapMapObjectLoader & mol, FileRead & fr) |
1796 | + (EditorGameBase & egbase, MapObjectLoader & mol, FileRead & fr) |
1797 | { |
1798 | std::unique_ptr<Loader> loader(new Loader); |
1799 | |
1800 | @@ -550,7 +550,7 @@ |
1801 | loader->init(egbase, mol, *new PortDock(nullptr)); |
1802 | loader->load(fr, version); |
1803 | } else |
1804 | - throw game_data_error("unknown/unhandled version %u", version); |
1805 | + throw GameDataError("unknown/unhandled version %u", version); |
1806 | } catch (const std::exception & e) { |
1807 | throw wexception("loading portdock: %s", e.what()); |
1808 | } |
1809 | @@ -558,7 +558,7 @@ |
1810 | return loader.release(); |
1811 | } |
1812 | |
1813 | -void PortDock::save(Editor_Game_Base & egbase, MapMapObjectSaver & mos, FileWrite & fw) |
1814 | +void PortDock::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw) |
1815 | { |
1816 | fw.Unsigned8(HeaderPortDock); |
1817 | fw.Unsigned8(PORTDOCK_SAVEGAME_VERSION); |
1818 | |
1819 | === modified file 'src/economy/portdock.h' |
1820 | --- src/economy/portdock.h 2014-07-28 16:59:54 +0000 |
1821 | +++ src/economy/portdock.h 2014-09-18 15:54:00 +0000 |
1822 | @@ -93,12 +93,12 @@ |
1823 | |
1824 | Flag & base_flag() override; |
1825 | PositionList get_positions |
1826 | - (const Editor_Game_Base &) const override; |
1827 | + (const EditorGameBase &) const override; |
1828 | void draw |
1829 | - (const Editor_Game_Base &, RenderTarget &, const FCoords&, const Point&) override; |
1830 | + (const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override; |
1831 | |
1832 | - void init(Editor_Game_Base &) override; |
1833 | - void cleanup(Editor_Game_Base &) override; |
1834 | + void init(EditorGameBase &) override; |
1835 | + void cleanup(EditorGameBase &) override; |
1836 | |
1837 | void add_neighbours(std::vector<RoutingNodeNeighbour> & neighbours); |
1838 | |
1839 | @@ -110,9 +110,9 @@ |
1840 | |
1841 | void ship_arrived(Game &, Ship &); |
1842 | |
1843 | - void log_general_info(const Editor_Game_Base &) override; |
1844 | + void log_general_info(const EditorGameBase &) override; |
1845 | |
1846 | - uint32_t count_waiting(WareWorker waretype, Ware_Index wareindex); |
1847 | + uint32_t count_waiting(WareWorker waretype, WareIndex wareindex); |
1848 | |
1849 | // Returns true if a expedition is started or ready to be send out. |
1850 | bool expedition_started(); |
1851 | @@ -131,7 +131,7 @@ |
1852 | private: |
1853 | friend struct Fleet; |
1854 | |
1855 | - void init_fleet(Editor_Game_Base & egbase); |
1856 | + void init_fleet(EditorGameBase & egbase); |
1857 | void set_fleet(Fleet * fleet); |
1858 | void _update_shippingitem(Game &, std::vector<ShippingItem>::iterator); |
1859 | void set_need_ship(Game &, bool need); |
1860 | @@ -162,10 +162,10 @@ |
1861 | |
1862 | public: |
1863 | bool has_new_save_support() override {return true;} |
1864 | - void save(Editor_Game_Base &, MapMapObjectSaver &, FileWrite &) override; |
1865 | + void save(EditorGameBase &, MapObjectSaver &, FileWrite &) override; |
1866 | |
1867 | static MapObject::Loader * load |
1868 | - (Editor_Game_Base &, MapMapObjectLoader &, FileRead &); |
1869 | + (EditorGameBase &, MapObjectLoader &, FileRead &); |
1870 | }; |
1871 | |
1872 | extern PortdockDescr g_portdock_descr; |
1873 | |
1874 | === modified file 'src/economy/request.cc' |
1875 | --- src/economy/request.cc 2014-07-28 14:23:03 +0000 |
1876 | +++ src/economy/request.cc 2014-09-18 15:54:00 +0000 |
1877 | @@ -34,8 +34,8 @@ |
1878 | #include "logic/tribe.h" |
1879 | #include "logic/warehouse.h" |
1880 | #include "logic/worker.h" |
1881 | -#include "map_io/widelands_map_map_object_loader.h" |
1882 | -#include "map_io/widelands_map_map_object_saver.h" |
1883 | +#include "map_io/map_object_loader.h" |
1884 | +#include "map_io/map_object_saver.h" |
1885 | |
1886 | |
1887 | namespace Widelands { |
1888 | @@ -50,8 +50,8 @@ |
1889 | |
1890 | Request::Request |
1891 | (PlayerImmovable & _target, |
1892 | - Ware_Index const index, |
1893 | - callback_t const cbfn, |
1894 | + WareIndex const index, |
1895 | + CallbackFn const cbfn, |
1896 | WareWorker const w) |
1897 | : |
1898 | m_type (w), |
1899 | @@ -106,19 +106,19 @@ |
1900 | * them through the data in the file |
1901 | */ |
1902 | void Request::Read |
1903 | - (FileRead & fr, Game & game, MapMapObjectLoader & mol) |
1904 | + (FileRead & fr, Game & game, MapObjectLoader & mol) |
1905 | { |
1906 | try { |
1907 | uint16_t const version = fr.Unsigned16(); |
1908 | if (version == 6) { |
1909 | - const Tribe_Descr& tribe = m_target.owner().tribe(); |
1910 | + const TribeDescr& tribe = m_target.owner().tribe(); |
1911 | char const* const type_name = fr.CString(); |
1912 | - Ware_Index const wai = tribe.ware_index(type_name); |
1913 | + WareIndex const wai = tribe.ware_index(type_name); |
1914 | if (wai != INVALID_INDEX) { |
1915 | m_type = wwWARE; |
1916 | m_index = wai; |
1917 | } else { |
1918 | - Ware_Index const woi = tribe.worker_index(type_name); |
1919 | + WareIndex const woi = tribe.worker_index(type_name); |
1920 | if (woi != INVALID_INDEX) { |
1921 | m_type = wwWORKER; |
1922 | m_index = woi; |
1923 | @@ -161,15 +161,15 @@ |
1924 | transfer->set_request(this); |
1925 | m_transfers.push_back(transfer); |
1926 | } |
1927 | - } catch (const _wexception& e) { |
1928 | + } catch (const WException& e) { |
1929 | throw wexception("transfer %u: %s", i, e.what()); |
1930 | } |
1931 | m_requirements.Read (fr, game, mol); |
1932 | if (!is_open() && m_economy) |
1933 | m_economy->remove_request(*this); |
1934 | } else |
1935 | - throw game_data_error("unknown/unhandled version %u", version); |
1936 | - } catch (const _wexception & e) { |
1937 | + throw GameDataError("unknown/unhandled version %u", version); |
1938 | + } catch (const WException & e) { |
1939 | throw wexception("request: %s", e.what()); |
1940 | } |
1941 | } |
1942 | @@ -178,14 +178,14 @@ |
1943 | * Write this request to a file |
1944 | */ |
1945 | void Request::Write |
1946 | - (FileWrite & fw, Game & game, MapMapObjectSaver & mos) const |
1947 | + (FileWrite & fw, Game & game, MapObjectSaver & mos) const |
1948 | { |
1949 | fw.Unsigned16(REQUEST_VERSION); |
1950 | |
1951 | // Target and econmy should be set. Same is true for callback stuff. |
1952 | |
1953 | assert(m_type == wwWARE || m_type == wwWORKER); |
1954 | - const Tribe_Descr & tribe = m_target.owner().tribe(); |
1955 | + const TribeDescr & tribe = m_target.owner().tribe(); |
1956 | assert(m_type != wwWARE || m_index < tribe.get_nrwares ()); |
1957 | assert(m_type != wwWORKER || m_index < tribe.get_nrworkers()); |
1958 | fw.CString |
1959 | @@ -227,7 +227,7 @@ |
1960 | * be delivered. nr is in the range [0..m_count[ |
1961 | */ |
1962 | int32_t Request::get_base_required_time |
1963 | - (Editor_Game_Base & egbase, uint32_t const nr) const |
1964 | + (EditorGameBase & egbase, uint32_t const nr) const |
1965 | { |
1966 | if (m_count <= nr) { |
1967 | if (!(m_count == 1 && nr == 1)) { |
1968 | |
1969 | === modified file 'src/economy/request.h' |
1970 | --- src/economy/request.h 2014-07-28 14:17:07 +0000 |
1971 | +++ src/economy/request.h 2014-09-18 15:54:00 +0000 |
1972 | @@ -31,11 +31,11 @@ |
1973 | namespace Widelands { |
1974 | |
1975 | class Economy; |
1976 | -class Editor_Game_Base; |
1977 | +class EditorGameBase; |
1978 | struct Flag; |
1979 | class Game; |
1980 | -class MapMapObjectLoader; |
1981 | -struct MapMapObjectSaver; |
1982 | +class MapObjectLoader; |
1983 | +struct MapObjectSaver; |
1984 | struct PlayerImmovable; |
1985 | class RequestList; |
1986 | struct Requirements; |
1987 | @@ -63,14 +63,14 @@ |
1988 | friend class Economy; |
1989 | friend class RequestList; |
1990 | |
1991 | - typedef void (*callback_t) |
1992 | - (Game &, Request &, Ware_Index, Worker *, PlayerImmovable &); |
1993 | + using CallbackFn = void (*) |
1994 | + (Game &, Request &, WareIndex, Worker *, PlayerImmovable &); |
1995 | |
1996 | - Request(PlayerImmovable & target, Ware_Index, callback_t, WareWorker); |
1997 | + Request(PlayerImmovable & target, WareIndex, CallbackFn, WareWorker); |
1998 | ~Request(); |
1999 | |
2000 | PlayerImmovable & target() const {return m_target;} |
2001 | - Ware_Index get_index() const {return m_index;} |
2002 | + WareIndex get_index() const {return m_index;} |
2003 | WareWorker get_type() const {return m_type;} |
2004 | uint32_t get_count() const {return m_count;} |
2005 | uint32_t get_open_count() const {return m_count - m_transfers.size();} |
2006 | @@ -93,8 +93,8 @@ |
2007 | |
2008 | void start_transfer(Game &, Supply &); |
2009 | |
2010 | - void Read (FileRead &, Game &, MapMapObjectLoader &); |
2011 | - void Write(FileWrite &, Game &, MapMapObjectSaver &) const; |
2012 | + void Read (FileRead &, Game &, MapObjectLoader &); |
2013 | + void Write(FileWrite &, Game &, MapObjectSaver &) const; |
2014 | Worker * get_transfer_worker(); |
2015 | |
2016 | // callbacks for WareInstance/Worker code |
2017 | @@ -105,14 +105,14 @@ |
2018 | const Requirements & get_requirements () const {return m_requirements;} |
2019 | |
2020 | private: |
2021 | - int32_t get_base_required_time(Editor_Game_Base &, uint32_t nr) const; |
2022 | + int32_t get_base_required_time(EditorGameBase &, uint32_t nr) const; |
2023 | public: |
2024 | void cancel_transfer(uint32_t idx); |
2025 | private: |
2026 | void remove_transfer(uint32_t idx); |
2027 | uint32_t find_transfer(Transfer &); |
2028 | |
2029 | - typedef std::vector<Transfer *> TransferList; |
2030 | + using TransferList = std::vector<Transfer *>; |
2031 | |
2032 | WareWorker m_type; |
2033 | |
2034 | @@ -126,10 +126,10 @@ |
2035 | ConstructionSite * m_target_constructionsite; |
2036 | |
2037 | Economy * m_economy; |
2038 | - Ware_Index m_index; // the index of the ware descr |
2039 | + WareIndex m_index; // the index of the ware descr |
2040 | uint32_t m_count; // how many do we need in total |
2041 | |
2042 | - callback_t m_callbackfn; // called on request success |
2043 | + CallbackFn m_callbackfn; // called on request success |
2044 | |
2045 | // when do we need the first ware (can be in the past) |
2046 | int32_t m_required_time; |
2047 | |
2048 | === modified file 'src/economy/road.cc' |
2049 | --- src/economy/road.cc 2014-07-28 16:59:54 +0000 |
2050 | +++ src/economy/road.cc 2014-09-18 15:54:00 +0000 |
2051 | @@ -89,7 +89,7 @@ |
2052 | * Create a road between the given flags, using the given path. |
2053 | */ |
2054 | Road & Road::create |
2055 | - (Editor_Game_Base & egbase, |
2056 | + (EditorGameBase & egbase, |
2057 | Flag & start, Flag & end, const Path & path) |
2058 | { |
2059 | assert(start.get_position() == path.get_start()); |
2060 | @@ -121,14 +121,14 @@ |
2061 | } |
2062 | |
2063 | BaseImmovable::PositionList Road::get_positions |
2064 | - (const Editor_Game_Base & egbase) const |
2065 | + (const EditorGameBase & egbase) const |
2066 | { |
2067 | Map & map = egbase.map(); |
2068 | Coords curf = map.get_fcoords(m_path.get_start()); |
2069 | |
2070 | PositionList rv; |
2071 | - const Path::Step_Vector::size_type nr_steps = m_path.get_nsteps(); |
2072 | - for (Path::Step_Vector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2073 | + const Path::StepVector::size_type nr_steps = m_path.get_nsteps(); |
2074 | + for (Path::StepVector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2075 | { |
2076 | if (steps > 0 && steps < m_path.get_nsteps()) |
2077 | rv.push_back(curf); |
2078 | @@ -156,7 +156,7 @@ |
2079 | * Set the new path, calculate costs. |
2080 | * You have to set start and end flags before calling this function. |
2081 | */ |
2082 | -void Road::_set_path(Editor_Game_Base & egbase, const Path & path) |
2083 | +void Road::_set_path(EditorGameBase & egbase, const Path & path) |
2084 | { |
2085 | assert(path.get_nsteps() >= 2); |
2086 | assert(path.get_start() == m_flags[FlagStart]->get_position()); |
2087 | @@ -172,13 +172,13 @@ |
2088 | /** |
2089 | * Add road markings to the map |
2090 | */ |
2091 | -void Road::_mark_map(Editor_Game_Base & egbase) |
2092 | +void Road::_mark_map(EditorGameBase & egbase) |
2093 | { |
2094 | Map & map = egbase.map(); |
2095 | FCoords curf = map.get_fcoords(m_path.get_start()); |
2096 | |
2097 | - const Path::Step_Vector::size_type nr_steps = m_path.get_nsteps(); |
2098 | - for (Path::Step_Vector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2099 | + const Path::StepVector::size_type nr_steps = m_path.get_nsteps(); |
2100 | + for (Path::StepVector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2101 | { |
2102 | if (steps > 0 && steps < m_path.get_nsteps()) |
2103 | set_position(egbase, curf); |
2104 | @@ -208,12 +208,12 @@ |
2105 | /** |
2106 | * Remove road markings from the map |
2107 | */ |
2108 | -void Road::_unmark_map(Editor_Game_Base & egbase) { |
2109 | +void Road::_unmark_map(EditorGameBase & egbase) { |
2110 | Map & map = egbase.map(); |
2111 | FCoords curf(m_path.get_start(), &map[m_path.get_start()]); |
2112 | |
2113 | - const Path::Step_Vector::size_type nr_steps = m_path.get_nsteps(); |
2114 | - for (Path::Step_Vector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2115 | + const Path::StepVector::size_type nr_steps = m_path.get_nsteps(); |
2116 | + for (Path::StepVector::size_type steps = 0; steps < nr_steps + 1; ++steps) |
2117 | { |
2118 | if (steps > 0 && steps < m_path.get_nsteps()) |
2119 | unset_position(egbase, curf); |
2120 | @@ -243,7 +243,7 @@ |
2121 | /** |
2122 | * Initialize the road. |
2123 | */ |
2124 | -void Road::init(Editor_Game_Base & egbase) |
2125 | +void Road::init(EditorGameBase & egbase) |
2126 | { |
2127 | PlayerImmovable::init(egbase); |
2128 | |
2129 | @@ -258,7 +258,7 @@ |
2130 | * we needed to have this road already registered |
2131 | * as Map Object, thats why this is moved |
2132 | */ |
2133 | -void Road::_link_into_flags(Editor_Game_Base & egbase) { |
2134 | +void Road::_link_into_flags(EditorGameBase & egbase) { |
2135 | assert(m_path.get_nsteps() >= 2); |
2136 | |
2137 | // Link into the flags (this will also set our economy) |
2138 | @@ -303,7 +303,7 @@ |
2139 | /** |
2140 | * Cleanup the road |
2141 | */ |
2142 | -void Road::cleanup(Editor_Game_Base & egbase) |
2143 | +void Road::cleanup(EditorGameBase & egbase) |
2144 | { |
2145 | |
2146 | for (CarrierSlot& slot : m_carrier_slots) { |
2147 | @@ -376,7 +376,7 @@ |
2148 | void Road::_request_carrier_callback |
2149 | (Game & game, |
2150 | Request & rq, |
2151 | - Ware_Index, |
2152 | + WareIndex, |
2153 | Worker * const w, |
2154 | PlayerImmovable & target) |
2155 | { |
2156 | @@ -412,7 +412,7 @@ |
2157 | */ |
2158 | void Road::remove_worker(Worker & w) |
2159 | { |
2160 | - Editor_Game_Base & egbase = owner().egbase(); |
2161 | + EditorGameBase & egbase = owner().egbase(); |
2162 | |
2163 | for (CarrierSlot& slot : m_carrier_slots) { |
2164 | Carrier const * carrier = slot.carrier.get(egbase); |
2165 | @@ -462,7 +462,7 @@ |
2166 | * After the split, this road will span [start...new flag]. A new road will |
2167 | * be created to span [new flag...end] |
2168 | */ |
2169 | -// TODO(SirVer): This need to take an Editor_Game_Base as well. |
2170 | +// TODO(SirVer): This needs to take an EditorGameBase as well. |
2171 | void Road::postsplit(Game & game, Flag & flag) |
2172 | { |
2173 | Flag & oldend = *m_flags[FlagEnd]; |
2174 | @@ -663,7 +663,7 @@ |
2175 | return false; |
2176 | } |
2177 | |
2178 | -void Road::log_general_info(const Editor_Game_Base & egbase) |
2179 | +void Road::log_general_info(const EditorGameBase & egbase) |
2180 | { |
2181 | PlayerImmovable::log_general_info(egbase); |
2182 | molog("m_busyness: %i\n", m_busyness); |
2183 | |
2184 | === modified file 'src/economy/road.h' |
2185 | --- src/economy/road.h 2014-07-28 16:59:54 +0000 |
2186 | +++ src/economy/road.h 2014-09-18 15:54:00 +0000 |
2187 | @@ -58,8 +58,8 @@ |
2188 | * road. |
2189 | */ |
2190 | struct Road : public PlayerImmovable { |
2191 | - friend class Map_Roaddata_Data_Packet; // For saving |
2192 | - friend class Map_Road_Data_Packet; // For init() |
2193 | + friend class MapRoaddataPacket; // For saving |
2194 | + friend class MapRoadPacket; // For init() |
2195 | |
2196 | const RoadDescr& descr() const; |
2197 | |
2198 | @@ -82,7 +82,7 @@ |
2199 | virtual ~Road(); |
2200 | |
2201 | static Road & create |
2202 | - (Editor_Game_Base &, |
2203 | + (EditorGameBase &, |
2204 | Flag & start, Flag & end, const Path &); |
2205 | |
2206 | Flag & get_flag(FlagId const flag) const {return *m_flags[flag];} |
2207 | @@ -90,7 +90,7 @@ |
2208 | uint8_t get_roadtype() const {return m_type;} |
2209 | int32_t get_size () const override; |
2210 | bool get_passable() const override; |
2211 | - PositionList get_positions(const Editor_Game_Base &) const override; |
2212 | + PositionList get_positions(const EditorGameBase &) const override; |
2213 | |
2214 | Flag & base_flag() override; |
2215 | |
2216 | @@ -108,25 +108,25 @@ |
2217 | void remove_worker(Worker &) override; |
2218 | void assign_carrier(Carrier &, uint8_t); |
2219 | |
2220 | - void log_general_info(const Editor_Game_Base &) override; |
2221 | + void log_general_info(const EditorGameBase &) override; |
2222 | |
2223 | protected: |
2224 | - void init(Editor_Game_Base &) override; |
2225 | - void cleanup(Editor_Game_Base &) override; |
2226 | + void init(EditorGameBase &) override; |
2227 | + void cleanup(EditorGameBase &) override; |
2228 | |
2229 | - void draw(const Editor_Game_Base &, RenderTarget &, const FCoords&, const Point&) override; |
2230 | + void draw(const EditorGameBase &, RenderTarget &, const FCoords&, const Point&) override; |
2231 | |
2232 | private: |
2233 | - void _set_path(Editor_Game_Base &, const Path &); |
2234 | - |
2235 | - void _mark_map(Editor_Game_Base &); |
2236 | - void _unmark_map(Editor_Game_Base &); |
2237 | - |
2238 | - void _link_into_flags(Editor_Game_Base &); |
2239 | + void _set_path(EditorGameBase &, const Path &); |
2240 | + |
2241 | + void _mark_map(EditorGameBase &); |
2242 | + void _unmark_map(EditorGameBase &); |
2243 | + |
2244 | + void _link_into_flags(EditorGameBase &); |
2245 | |
2246 | void _request_carrier(CarrierSlot &); |
2247 | static void _request_carrier_callback |
2248 | - (Game &, Request &, Ware_Index, Worker *, PlayerImmovable &); |
2249 | + (Game &, Request &, WareIndex, Worker *, PlayerImmovable &); |
2250 | |
2251 | private: |
2252 | |
2253 | @@ -147,7 +147,7 @@ |
2254 | Path m_path; ///< path goes from start to end |
2255 | uint32_t m_idle_index; ///< index into path where carriers should idle |
2256 | |
2257 | - typedef std::vector<CarrierSlot> SlotVector; |
2258 | + using SlotVector = std::vector<CarrierSlot>; |
2259 | SlotVector m_carrier_slots; |
2260 | }; |
2261 | |
2262 | |
2263 | === modified file 'src/economy/route.cc' |
2264 | --- src/economy/route.cc 2014-07-28 14:17:07 +0000 |
2265 | +++ src/economy/route.cc 2014-09-18 15:54:00 +0000 |
2266 | @@ -23,8 +23,8 @@ |
2267 | #include "io/fileread.h" |
2268 | #include "io/filewrite.h" |
2269 | #include "logic/editor_game_base.h" |
2270 | -#include "map_io/widelands_map_map_object_loader.h" |
2271 | -#include "map_io/widelands_map_map_object_saver.h" |
2272 | +#include "map_io/map_object_loader.h" |
2273 | +#include "map_io/map_object_saver.h" |
2274 | |
2275 | /* |
2276 | ============================================================================== |
2277 | @@ -54,7 +54,7 @@ |
2278 | * Every route has at least one flag. |
2279 | */ |
2280 | Flag & Route::get_flag |
2281 | - (Editor_Game_Base & egbase, std::vector<Flag *>::size_type const idx) |
2282 | + (EditorGameBase & egbase, std::vector<Flag *>::size_type const idx) |
2283 | { |
2284 | assert(idx < m_route.size()); |
2285 | return *m_route[idx].get(egbase); |
2286 | @@ -102,12 +102,12 @@ |
2287 | * load_pointers phase of loading: This is responsible for filling |
2288 | * in the \ref Flag pointers. Must be called after \ref load. |
2289 | */ |
2290 | -void Route::load_pointers(const LoadData & data, MapMapObjectLoader & mol) { |
2291 | +void Route::load_pointers(const LoadData & data, MapObjectLoader & mol) { |
2292 | for (uint32_t i = 0; i < data.flags.size(); ++i) { |
2293 | uint32_t const flag_serial = data.flags.size(); |
2294 | try { |
2295 | m_route.push_back(&mol.get<Flag>(flag_serial)); |
2296 | - } catch (const _wexception & e) { |
2297 | + } catch (const WException & e) { |
2298 | throw wexception("Route flag #%u (%u): %s", i, flag_serial, e.what()); |
2299 | } |
2300 | } |
2301 | @@ -118,12 +118,12 @@ |
2302 | * Save the route to the given file. |
2303 | */ |
2304 | void Route::save |
2305 | - (FileWrite & fw, Editor_Game_Base & egbase, MapMapObjectSaver & mos) |
2306 | + (FileWrite & fw, EditorGameBase & egbase, MapObjectSaver & mos) |
2307 | { |
2308 | fw.Signed32(get_totalcost()); |
2309 | fw.Unsigned16(m_route.size()); |
2310 | for |
2311 | - (std::vector<Object_Ptr>::size_type idx = 0; |
2312 | + (std::vector<ObjectPointer>::size_type idx = 0; |
2313 | idx < m_route.size(); |
2314 | ++idx) |
2315 | { |
2316 | |
2317 | === modified file 'src/economy/route.h' |
2318 | --- src/economy/route.h 2014-07-28 14:17:07 +0000 |
2319 | +++ src/economy/route.h 2014-09-18 15:54:00 +0000 |
2320 | @@ -29,9 +29,9 @@ |
2321 | namespace Widelands { |
2322 | |
2323 | struct Flag; |
2324 | -class Editor_Game_Base; |
2325 | -struct MapMapObjectSaver; |
2326 | -class MapMapObjectLoader; |
2327 | +class EditorGameBase; |
2328 | +struct MapObjectSaver; |
2329 | +class MapObjectLoader; |
2330 | struct RoutingNode; |
2331 | |
2332 | /** |
2333 | @@ -48,7 +48,7 @@ |
2334 | |
2335 | int32_t get_totalcost() const {return m_totalcost;} |
2336 | int32_t get_nrsteps() const {return m_route.size() - 1;} |
2337 | - Flag & get_flag(Editor_Game_Base &, std::vector<Flag *>::size_type); |
2338 | + Flag & get_flag(EditorGameBase &, std::vector<Flag *>::size_type); |
2339 | |
2340 | void starttrim(int32_t count); |
2341 | void truncate(int32_t count); |
2342 | @@ -58,8 +58,8 @@ |
2343 | }; |
2344 | |
2345 | void load(LoadData &, FileRead &); |
2346 | - void load_pointers(const LoadData &, MapMapObjectLoader &); |
2347 | - void save(FileWrite &, Editor_Game_Base &, MapMapObjectSaver &); |
2348 | + void load_pointers(const LoadData &, MapObjectLoader &); |
2349 | + void save(FileWrite &, EditorGameBase &, MapObjectSaver &); |
2350 | |
2351 | void insert_as_first(RoutingNode * node) override; |
2352 | |
2353 | |
2354 | === modified file 'src/economy/routeastar.h' |
2355 | --- src/economy/routeastar.h 2014-07-24 18:22:30 +0000 |
2356 | +++ src/economy/routeastar.h 2014-09-18 15:54:00 +0000 |
2357 | @@ -75,7 +75,7 @@ |
2358 | */ |
2359 | template<typename Est_> |
2360 | struct RouteAStar : BaseRouteAStar { |
2361 | - typedef Est_ Estimator; |
2362 | + using Estimator = Est_; |
2363 | |
2364 | RouteAStar(Router & router, WareWorker type, const Estimator & est = Estimator()); |
2365 | |
2366 | |
2367 | === modified file 'src/economy/router.h' |
2368 | --- src/economy/router.h 2014-07-16 08:23:42 +0000 |
2369 | +++ src/economy/router.h 2014-09-18 15:54:00 +0000 |
2370 | @@ -36,7 +36,7 @@ |
2371 | * The functionality was split from Economy |
2372 | */ |
2373 | struct Router { |
2374 | - typedef boost::function<void ()> ResetCycleFn; |
2375 | + using ResetCycleFn = boost::function<void ()>; |
2376 | |
2377 | Router(const ResetCycleFn & reset); |
2378 | |
2379 | |
2380 | === modified file 'src/economy/routing_node.h' |
2381 | --- src/economy/routing_node.h 2014-07-05 16:41:51 +0000 |
2382 | +++ src/economy/routing_node.h 2014-09-18 15:54:00 +0000 |
2383 | @@ -50,7 +50,7 @@ |
2384 | RoutingNode * m_nb; |
2385 | int32_t m_cost; /// Cost to get from me to the neighbour (Cost for road) |
2386 | }; |
2387 | -typedef std::vector<RoutingNodeNeighbour> RoutingNodeNeighbours; |
2388 | +using RoutingNodeNeighbours = std::vector<RoutingNodeNeighbour>; |
2389 | |
2390 | /** |
2391 | * A routing node is a field with a cost attached to it |
2392 | @@ -65,10 +65,10 @@ |
2393 | return a.cost() < b.cost(); |
2394 | } |
2395 | }; |
2396 | - typedef cookie_priority_queue<RoutingNode, LessCost> Queue; |
2397 | + using Queue = CookiePriorityQueue<RoutingNode, LessCost>; |
2398 | |
2399 | uint32_t mpf_cycle; |
2400 | - Queue::cookie mpf_cookie; |
2401 | + Queue::Cookie mpf_cookie; |
2402 | int32_t mpf_realcost; ///< real cost of getting to this flag |
2403 | RoutingNode * mpf_backlink; ///< flag where we came from |
2404 | int32_t mpf_estimate; ///< estimate of cost to destination |
2405 | @@ -83,7 +83,7 @@ |
2406 | } |
2407 | |
2408 | int32_t cost() const {return mpf_realcost + mpf_estimate;} |
2409 | - Queue::cookie & cookie() {return mpf_cookie;} |
2410 | + Queue::Cookie & cookie() {return mpf_cookie;} |
2411 | |
2412 | virtual Flag & base_flag() = 0; |
2413 | virtual void get_neighbours(WareWorker type, RoutingNodeNeighbours &) = 0; |
2414 | |
2415 | === modified file 'src/economy/shippingitem.cc' |
2416 | --- src/economy/shippingitem.cc 2014-07-28 14:23:03 +0000 |
2417 | +++ src/economy/shippingitem.cc 2014-09-18 15:54:00 +0000 |
2418 | @@ -25,8 +25,8 @@ |
2419 | #include "io/filewrite.h" |
2420 | #include "logic/game_data_error.h" |
2421 | #include "logic/worker.h" |
2422 | -#include "map_io/widelands_map_map_object_loader.h" |
2423 | -#include "map_io/widelands_map_map_object_saver.h" |
2424 | +#include "map_io/map_object_loader.h" |
2425 | +#include "map_io/map_object_saver.h" |
2426 | |
2427 | namespace Widelands { |
2428 | |
2429 | @@ -40,7 +40,7 @@ |
2430 | { |
2431 | } |
2432 | |
2433 | -void ShippingItem::get(Editor_Game_Base& game, WareInstance** ware, Worker** worker) const { |
2434 | +void ShippingItem::get(EditorGameBase& game, WareInstance** ware, Worker** worker) const { |
2435 | if (ware) { |
2436 | *ware = nullptr; |
2437 | } |
2438 | @@ -154,7 +154,7 @@ |
2439 | /** |
2440 | * Remove the underlying item directly. This is used when ships are removed. |
2441 | */ |
2442 | -void ShippingItem::remove(Editor_Game_Base & egbase) |
2443 | +void ShippingItem::remove(EditorGameBase & egbase) |
2444 | { |
2445 | if (MapObject * obj = m_object.get(egbase)) { |
2446 | obj->remove(egbase); |
2447 | @@ -171,10 +171,10 @@ |
2448 | if (1 <= version && version <= SHIPPINGITEM_SAVEGAME_VERSION) { |
2449 | m_serial = fr.Unsigned32(); |
2450 | } else |
2451 | - throw game_data_error("unknown ShippingItem version %u", version); |
2452 | + throw GameDataError("unknown ShippingItem version %u", version); |
2453 | } |
2454 | |
2455 | -ShippingItem ShippingItem::Loader::get(MapMapObjectLoader & mol) |
2456 | +ShippingItem ShippingItem::Loader::get(MapObjectLoader & mol) |
2457 | { |
2458 | ShippingItem it; |
2459 | if (m_serial != 0) |
2460 | @@ -182,7 +182,7 @@ |
2461 | return it; |
2462 | } |
2463 | |
2464 | -void ShippingItem::save(Editor_Game_Base & egbase, MapMapObjectSaver & mos, FileWrite & fw) |
2465 | +void ShippingItem::save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw) |
2466 | { |
2467 | fw.Unsigned8(SHIPPINGITEM_SAVEGAME_VERSION); |
2468 | fw.Unsigned32(mos.get_object_file_index_or_zero(m_object.get(egbase))); |
2469 | |
2470 | === modified file 'src/economy/shippingitem.h' |
2471 | --- src/economy/shippingitem.h 2014-07-28 14:17:07 +0000 |
2472 | +++ src/economy/shippingitem.h 2014-09-18 15:54:00 +0000 |
2473 | @@ -30,8 +30,8 @@ |
2474 | |
2475 | class Economy; |
2476 | class Game; |
2477 | -class MapMapObjectLoader; |
2478 | -struct MapMapObjectSaver; |
2479 | +class MapObjectLoader; |
2480 | +struct MapObjectSaver; |
2481 | class MapObject; |
2482 | class PortDock; |
2483 | class WareInstance; |
2484 | @@ -49,23 +49,23 @@ |
2485 | // Unboxes the item that is shipped which might be either a ware or a |
2486 | // worker. It is safe to pass nullptr for 'ware' or 'worker' in case you are |
2487 | // only interested in the ware if it is the one or the other. |
2488 | - void get(Editor_Game_Base& game, WareInstance** ware, Worker** worker) const; |
2489 | + void get(EditorGameBase& game, WareInstance** ware, Worker** worker) const; |
2490 | |
2491 | void set_economy(Game &, Economy * e); |
2492 | PortDock * get_destination(Game &); |
2493 | void schedule_update(Game &, int32_t delay); |
2494 | |
2495 | - void remove(Editor_Game_Base &); |
2496 | + void remove(EditorGameBase &); |
2497 | |
2498 | struct Loader { |
2499 | void load(FileRead & fr); |
2500 | - ShippingItem get(MapMapObjectLoader & mol); |
2501 | + ShippingItem get(MapObjectLoader & mol); |
2502 | |
2503 | private: |
2504 | uint32_t m_serial; |
2505 | }; |
2506 | |
2507 | - void save(Editor_Game_Base & egbase, MapMapObjectSaver & mos, FileWrite & fw); |
2508 | + void save(EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw); |
2509 | |
2510 | private: |
2511 | friend class PortDock; |
2512 | @@ -80,7 +80,7 @@ |
2513 | // Updates m_destination_dock. |
2514 | void update_destination(Game &, PortDock &); |
2515 | |
2516 | - Object_Ptr m_object; |
2517 | + ObjectPointer m_object; |
2518 | OPtr<PortDock> m_destination_dock; |
2519 | }; |
2520 | |
2521 | |
2522 | === modified file 'src/economy/supply.h' |
2523 | --- src/economy/supply.h 2014-07-05 16:41:51 +0000 |
2524 | +++ src/economy/supply.h 2014-09-18 15:54:00 +0000 |
2525 | @@ -69,7 +69,7 @@ |
2526 | * |
2527 | * \note This is only valid if \ref has_storage returns \c false. |
2528 | */ |
2529 | - virtual void get_ware_type(WareWorker & type, Ware_Index & ware) const = 0; |
2530 | + virtual void get_ware_type(WareWorker & type, WareIndex & ware) const = 0; |
2531 | |
2532 | /** |
2533 | * Send this to the given warehouse. |
2534 | |
2535 | === modified file 'src/economy/supply_list.h' |
2536 | --- src/economy/supply_list.h 2014-07-05 16:41:51 +0000 |
2537 | +++ src/economy/supply_list.h 2014-09-18 15:54:00 +0000 |
2538 | @@ -43,7 +43,7 @@ |
2539 | bool have_supplies(Game & game, const Request &); |
2540 | |
2541 | private: |
2542 | - typedef std::vector<Supply *> Supplies; |
2543 | + using Supplies = std::vector<Supply *>; |
2544 | Supplies m_supplies; |
2545 | }; |
2546 | |
2547 | |
2548 | === modified file 'src/economy/test/test_road.cc' |
2549 | --- src/economy/test/test_road.cc 2014-07-26 10:43:23 +0000 |
2550 | +++ src/economy/test/test_road.cc 2014-09-18 15:54:00 +0000 |
2551 | @@ -38,7 +38,7 @@ |
2552 | /* Helper classes */ |
2553 | /******************/ |
2554 | struct TestingFlag : public Flag { |
2555 | - TestingFlag(Editor_Game_Base &, Coords const c) : Flag() { |
2556 | + TestingFlag(EditorGameBase &, Coords const c) : Flag() { |
2557 | set_flag_position(c); |
2558 | } |
2559 | |
2560 | @@ -77,11 +77,11 @@ |
2561 | ~SimpleRoadTestsFixture() { |
2562 | delete start; |
2563 | delete end; |
2564 | - // Map is deleted by Editor_Game_Base |
2565 | + // Map is deleted by EditorGameBase |
2566 | } |
2567 | |
2568 | TestingMap * map; |
2569 | - Editor_Game_Base g; |
2570 | + EditorGameBase g; |
2571 | Road r; |
2572 | Path path; |
2573 | TestingFlag * start; |
2574 | |
2575 | === modified file 'src/economy/test/test_routing.cc' |
2576 | --- src/economy/test/test_routing.cc 2014-07-26 10:57:26 +0000 |
2577 | +++ src/economy/test/test_routing.cc 2014-09-18 15:54:00 +0000 |
2578 | @@ -67,7 +67,7 @@ |
2579 | bool all_members_zeroed(); |
2580 | |
2581 | private: |
2582 | - typedef std::vector<TestingRoutingNode *> Neigbours; |
2583 | + using Neigbours = std::vector<TestingRoutingNode *>; |
2584 | |
2585 | Neigbours _neighbours; |
2586 | int32_t _waitcost; |
2587 | @@ -100,7 +100,7 @@ |
2588 | }; |
2589 | class TestingRoute : public IRoute { |
2590 | public: |
2591 | - typedef std::vector<RoutingNode *> Nodes; |
2592 | + using Nodes = std::vector<RoutingNode *>; |
2593 | |
2594 | void init(int32_t) override { |
2595 | nodes.clear(); |
2596 | @@ -178,14 +178,14 @@ |
2597 | BOOST_CHECK_EQUAL(d0.get_position().x, 0); |
2598 | BOOST_CHECK_EQUAL(d1.get_position().x, 15); |
2599 | } |
2600 | -struct TestingNode_DefaultNodes_Fixture { |
2601 | - TestingNode_DefaultNodes_Fixture() { |
2602 | +struct TestingNodeDefaultNodesFixture { |
2603 | + TestingNodeDefaultNodesFixture() { |
2604 | d0 = new TestingRoutingNode(); |
2605 | d1 = new TestingRoutingNode(1, Coords(15, 0)); |
2606 | nodes.push_back(d0); |
2607 | nodes.push_back(d1); |
2608 | } |
2609 | - ~TestingNode_DefaultNodes_Fixture() { |
2610 | + ~TestingNodeDefaultNodesFixture() { |
2611 | while (!nodes.empty()) { |
2612 | TestingRoutingNode * n = nodes.back(); |
2613 | delete n; |
2614 | @@ -197,14 +197,14 @@ |
2615 | TestingRoutingNode * d1; |
2616 | }; |
2617 | BOOST_FIXTURE_TEST_CASE |
2618 | - (testingnode_neighbour_attaching, TestingNode_DefaultNodes_Fixture) |
2619 | + (testingnode_neighbour_attaching, TestingNodeDefaultNodesFixture) |
2620 | { |
2621 | d0->add_neighbour(d1); |
2622 | |
2623 | BOOST_CHECK_EQUAL(d0->get_neighbour(0), d1); |
2624 | } |
2625 | BOOST_FIXTURE_TEST_CASE |
2626 | - (testingnode_illegalneighbour_access, TestingNode_DefaultNodes_Fixture) |
2627 | + (testingnode_illegalneighbour_access, TestingNodeDefaultNodesFixture) |
2628 | { |
2629 | try { |
2630 | d0->get_neighbour(0); |
2631 | @@ -391,7 +391,7 @@ |
2632 | } |
2633 | |
2634 | struct ComplexRouterFixture { |
2635 | - typedef std::vector<RoutingNode *> Nodes; |
2636 | + using Nodes = std::vector<RoutingNode *>; |
2637 | |
2638 | ComplexRouterFixture() : r(boost::bind(&ComplexRouterFixture::reset, this)) { |
2639 | d0 = new TestingRoutingNode(); |
2640 | |
2641 | === modified file 'src/economy/transfer.cc' |
2642 | --- src/economy/transfer.cc 2014-07-28 14:17:07 +0000 |
2643 | +++ src/economy/transfer.cc 2014-09-18 15:54:00 +0000 |
2644 | @@ -33,8 +33,8 @@ |
2645 | #include "logic/player.h" |
2646 | #include "logic/warehouse.h" |
2647 | #include "logic/worker.h" |
2648 | -#include "map_io/widelands_map_map_object_loader.h" |
2649 | -#include "map_io/widelands_map_map_object_saver.h" |
2650 | +#include "map_io/map_object_loader.h" |
2651 | +#include "map_io/map_object_saver.h" |
2652 | |
2653 | namespace Widelands { |
2654 | |
2655 | @@ -324,13 +324,13 @@ |
2656 | } |
2657 | |
2658 | void Transfer::read_pointers |
2659 | - (MapMapObjectLoader & mol, const Widelands::Transfer::ReadData & rd) |
2660 | + (MapObjectLoader & mol, const Widelands::Transfer::ReadData & rd) |
2661 | { |
2662 | if (rd.destination) |
2663 | m_destination = &mol.get<PlayerImmovable>(rd.destination); |
2664 | } |
2665 | |
2666 | -void Transfer::write(MapMapObjectSaver & mos, FileWrite & fw) |
2667 | +void Transfer::write(MapObjectSaver & mos, FileWrite & fw) |
2668 | { |
2669 | fw.Unsigned8(TRANSFER_SAVEGAME_VERSION); |
2670 | fw.Unsigned32(mos.get_object_file_index_or_zero(m_destination.get(m_game))); |
2671 | |
2672 | === modified file 'src/economy/transfer.h' |
2673 | --- src/economy/transfer.h 2014-07-28 14:17:07 +0000 |
2674 | +++ src/economy/transfer.h 2014-09-18 15:54:00 +0000 |
2675 | @@ -27,8 +27,8 @@ |
2676 | struct PlayerImmovable; |
2677 | class Request; |
2678 | class WareInstance; |
2679 | -class MapMapObjectLoader; |
2680 | -struct MapMapObjectSaver; |
2681 | +class MapObjectLoader; |
2682 | +struct MapObjectSaver; |
2683 | class Worker; |
2684 | |
2685 | /** |
2686 | @@ -70,8 +70,8 @@ |
2687 | }; |
2688 | |
2689 | void read(FileRead & fr, ReadData & rd); |
2690 | - void read_pointers(MapMapObjectLoader & mol, const ReadData & rd); |
2691 | - void write(MapMapObjectSaver & mos, FileWrite & fw); |
2692 | + void read_pointers(MapObjectLoader & mol, const ReadData & rd); |
2693 | + void write(MapObjectSaver & mos, FileWrite & fw); |
2694 | |
2695 | private: |
2696 | void tlog(char const * fmt, ...) PRINTF_FORMAT(2, 3); |
2697 | |
2698 | === modified file 'src/economy/ware_instance.cc' |
2699 | --- src/economy/ware_instance.cc 2014-07-28 14:28:02 +0000 |
2700 | +++ src/economy/ware_instance.cc 2014-09-18 15:54:00 +0000 |
2701 | @@ -36,8 +36,8 @@ |
2702 | #include "logic/tribe.h" |
2703 | #include "logic/warehouse.h" |
2704 | #include "logic/worker.h" |
2705 | -#include "map_io/widelands_map_map_object_loader.h" |
2706 | -#include "map_io/widelands_map_map_object_saver.h" |
2707 | +#include "map_io/map_object_loader.h" |
2708 | +#include "map_io/map_object_saver.h" |
2709 | |
2710 | namespace Widelands { |
2711 | |
2712 | @@ -56,7 +56,7 @@ |
2713 | PlayerImmovable * get_position(Game &) override; |
2714 | bool is_active() const override; |
2715 | bool has_storage() const override; |
2716 | - void get_ware_type(WareWorker & type, Ware_Index & ware) const override; |
2717 | + void get_ware_type(WareWorker & type, WareIndex & ware) const override; |
2718 | void send_to_storage(Game &, Warehouse * wh) override; |
2719 | |
2720 | uint32_t nr_supplies(const Game &, const Request &) const override; |
2721 | @@ -131,7 +131,7 @@ |
2722 | return m_ware.is_moving(); |
2723 | } |
2724 | |
2725 | -void IdleWareSupply::get_ware_type(WareWorker & type, Ware_Index & ware) const |
2726 | +void IdleWareSupply::get_ware_type(WareWorker & type, WareIndex & ware) const |
2727 | { |
2728 | type = wwWARE; |
2729 | ware = m_ware.descr_index(); |
2730 | @@ -183,7 +183,7 @@ |
2731 | /* Ware Instance Implementation */ |
2732 | /*************************************************************************/ |
2733 | WareInstance::WareInstance |
2734 | - (Ware_Index const i, const WareDescr * const ware_descr) |
2735 | + (WareIndex const i, const WareDescr * const ware_descr) |
2736 | : |
2737 | MapObject (ware_descr), |
2738 | m_economy (nullptr), |
2739 | @@ -200,12 +200,12 @@ |
2740 | } |
2741 | } |
2742 | |
2743 | -void WareInstance::init(Editor_Game_Base & egbase) |
2744 | +void WareInstance::init(EditorGameBase & egbase) |
2745 | { |
2746 | MapObject::init(egbase); |
2747 | } |
2748 | |
2749 | -void WareInstance::cleanup(Editor_Game_Base & egbase) |
2750 | +void WareInstance::cleanup(EditorGameBase & egbase) |
2751 | { |
2752 | // Unlink from our current location, if necessary |
2753 | if (upcast(Flag, flag, m_location.get(egbase))) |
2754 | @@ -244,7 +244,7 @@ |
2755 | * Once you've assigned a ware to its new location, you usually have to call |
2756 | * \ref update() as well. |
2757 | */ |
2758 | -void WareInstance::set_location(Editor_Game_Base & egbase, MapObject * const location) |
2759 | +void WareInstance::set_location(EditorGameBase & egbase, MapObject * const location) |
2760 | { |
2761 | MapObject * const oldlocation = m_location.get(egbase); |
2762 | |
2763 | @@ -527,7 +527,7 @@ |
2764 | dynamic_cast<PlayerImmovable *>(m_transfer_nextstep.get(game)) : nullptr; |
2765 | } |
2766 | |
2767 | -void WareInstance::log_general_info(const Editor_Game_Base & egbase) |
2768 | +void WareInstance::log_general_info(const EditorGameBase & egbase) |
2769 | { |
2770 | MapObject::log_general_info(egbase); |
2771 | |
2772 | @@ -561,7 +561,7 @@ |
2773 | m_transfer_nextstep = fr.Unsigned32(); |
2774 | if (fr.Unsigned8()) { |
2775 | ware.m_transfer = |
2776 | - new Transfer(ref_cast<Game, Editor_Game_Base>(egbase()), ware); |
2777 | + new Transfer(ref_cast<Game, EditorGameBase>(egbase()), ware); |
2778 | ware.m_transfer->read(fr, m_transfer); |
2779 | } |
2780 | } |
2781 | @@ -596,7 +596,7 @@ |
2782 | |
2783 | |
2784 | void WareInstance::save |
2785 | - (Editor_Game_Base & egbase, MapMapObjectSaver & mos, FileWrite & fw) |
2786 | + (EditorGameBase & egbase, MapObjectSaver & mos, FileWrite & fw) |
2787 | { |
2788 | fw.Unsigned8(HeaderWareInstance); |
2789 | fw.Unsigned8(WAREINSTANCE_SAVEGAME_VERSION); |
2790 | @@ -617,7 +617,7 @@ |
2791 | } |
2792 | |
2793 | MapObject::Loader * WareInstance::load |
2794 | - (Editor_Game_Base & egbase, MapMapObjectLoader & mol, FileRead & fr) |
2795 | + (EditorGameBase & egbase, MapObjectLoader & mol, FileRead & fr) |
2796 | { |
2797 | try { |
2798 | uint8_t version = fr.Unsigned8(); |
2799 | @@ -630,11 +630,11 @@ |
2800 | |
2801 | egbase.manually_load_tribe(tribename); |
2802 | |
2803 | - const Tribe_Descr * tribe = egbase.get_tribe(tribename); |
2804 | + const TribeDescr * tribe = egbase.get_tribe(tribename); |
2805 | if (!tribe) |
2806 | throw wexception("unknown tribe '%s'", tribename.c_str()); |
2807 | |
2808 | - Ware_Index wareindex = tribe->ware_index(warename); |
2809 | + WareIndex wareindex = tribe->ware_index(warename); |
2810 | const WareDescr * descr = tribe->get_ware_descr(wareindex); |
2811 | |
2812 | std::unique_ptr<Loader> loader(new Loader); |
2813 | |
2814 | === modified file 'src/economy/ware_instance.h' |
2815 | --- src/economy/ware_instance.h 2014-07-28 14:17:07 +0000 |
2816 | +++ src/economy/ware_instance.h 2014-09-18 15:54:00 +0000 |
2817 | @@ -29,7 +29,7 @@ |
2818 | |
2819 | class Building; |
2820 | class Economy; |
2821 | -class Editor_Game_Base; |
2822 | +class EditorGameBase; |
2823 | class Game; |
2824 | struct IdleWareSupply; |
2825 | class MapObject; |
2826 | @@ -53,30 +53,30 @@ |
2827 | * for seafaring |
2828 | */ |
2829 | class WareInstance : public MapObject { |
2830 | - friend struct Map_Waredata_Data_Packet; |
2831 | + friend struct MapWaredataPacket; |
2832 | |
2833 | MO_DESCR(WareDescr) |
2834 | |
2835 | public: |
2836 | - WareInstance(Ware_Index, const WareDescr* const); |
2837 | + WareInstance(WareIndex, const WareDescr* const); |
2838 | ~WareInstance(); |
2839 | |
2840 | - MapObject* get_location(Editor_Game_Base& egbase) { |
2841 | + MapObject* get_location(EditorGameBase& egbase) { |
2842 | return m_location.get(egbase); |
2843 | } |
2844 | Economy* get_economy() const { |
2845 | return m_economy; |
2846 | } |
2847 | - Ware_Index descr_index() const { |
2848 | + WareIndex descr_index() const { |
2849 | return m_descr_index; |
2850 | } |
2851 | |
2852 | - void init(Editor_Game_Base&) override; |
2853 | - void cleanup(Editor_Game_Base&) override; |
2854 | + void init(EditorGameBase&) override; |
2855 | + void cleanup(EditorGameBase&) override; |
2856 | void act(Game&, uint32_t data) override; |
2857 | void update(Game&); |
2858 | |
2859 | - void set_location(Editor_Game_Base&, MapObject* loc); |
2860 | + void set_location(EditorGameBase&, MapObject* loc); |
2861 | void set_economy(Economy*); |
2862 | |
2863 | void enter_building(Game&, Building& building); |
2864 | @@ -92,16 +92,16 @@ |
2865 | return m_transfer; |
2866 | } |
2867 | |
2868 | - void log_general_info(const Editor_Game_Base& egbase) override; |
2869 | + void log_general_info(const EditorGameBase& egbase) override; |
2870 | |
2871 | private: |
2872 | - Object_Ptr m_location; |
2873 | + ObjectPointer m_location; |
2874 | Economy* m_economy; |
2875 | - Ware_Index m_descr_index; |
2876 | + WareIndex m_descr_index; |
2877 | |
2878 | IdleWareSupply* m_supply; |
2879 | Transfer* m_transfer; |
2880 | - Object_Ptr m_transfer_nextstep; ///< cached PlayerImmovable, can be 0 |
2881 | + ObjectPointer m_transfer_nextstep; ///< cached PlayerImmovable, can be 0 |
2882 | |
2883 | // loading and saving stuff |
2884 | protected: |
2885 | @@ -123,8 +123,8 @@ |
2886 | return true; |
2887 | } |
2888 | |
2889 | - void save(Editor_Game_Base&, MapMapObjectSaver&, FileWrite&) override; |
2890 | - static MapObject::Loader* load(Editor_Game_Base&, MapMapObjectLoader&, FileRead&); |
2891 | + void save(EditorGameBase&, MapObjectSaver&, FileWrite&) override; |
2892 | + static MapObject::Loader* load(EditorGameBase&, MapObjectLoader&, FileRead&); |
2893 | }; |
2894 | } |
2895 | |
2896 | |
2897 | === modified file 'src/economy/warehousesupply.h' |
2898 | --- src/economy/warehousesupply.h 2014-07-26 10:43:23 +0000 |
2899 | +++ src/economy/warehousesupply.h 2014-09-18 15:54:00 +0000 |
2900 | @@ -36,27 +36,27 @@ |
2901 | |
2902 | void set_economy(Economy *); |
2903 | |
2904 | - void set_nrworkers(Ware_Index); |
2905 | - void set_nrwares (Ware_Index); |
2906 | + void set_nrworkers(WareIndex); |
2907 | + void set_nrwares (WareIndex); |
2908 | |
2909 | const WareList & get_wares () const {return m_wares;} |
2910 | const WareList & get_workers() const {return m_workers;} |
2911 | - uint32_t stock_wares (Ware_Index const i) const { |
2912 | + uint32_t stock_wares (WareIndex const i) const { |
2913 | return m_wares .stock(i); |
2914 | } |
2915 | - uint32_t stock_workers(Ware_Index const i) const { |
2916 | + uint32_t stock_workers(WareIndex const i) const { |
2917 | return m_workers.stock(i); |
2918 | } |
2919 | - void add_wares (Ware_Index, uint32_t count); |
2920 | - void remove_wares (Ware_Index, uint32_t count); |
2921 | - void add_workers (Ware_Index, uint32_t count); |
2922 | - void remove_workers(Ware_Index, uint32_t count); |
2923 | + void add_wares (WareIndex, uint32_t count); |
2924 | + void remove_wares (WareIndex, uint32_t count); |
2925 | + void add_workers (WareIndex, uint32_t count); |
2926 | + void remove_workers(WareIndex, uint32_t count); |
2927 | |
2928 | // Supply implementation |
2929 | PlayerImmovable * get_position(Game &) override; |
2930 | bool is_active() const override; |
2931 | bool has_storage() const override; |
2932 | - void get_ware_type(WareWorker & type, Ware_Index & ware) const override; |
2933 | + void get_ware_type(WareWorker & type, WareIndex & ware) const override; |
2934 | |
2935 | void send_to_storage(Game &, Warehouse * wh) override; |
2936 | uint32_t nr_supplies(const Game &, const Request &) const override; |
2937 | |
2938 | === modified file 'src/economy/wares_queue.cc' |
2939 | --- src/economy/wares_queue.cc 2014-07-28 14:17:07 +0000 |
2940 | +++ src/economy/wares_queue.cc 2014-09-18 15:54:00 +0000 |
2941 | @@ -28,8 +28,8 @@ |
2942 | #include "logic/game.h" |
2943 | #include "logic/player.h" |
2944 | #include "logic/tribe.h" |
2945 | -#include "map_io/widelands_map_map_object_loader.h" |
2946 | -#include "map_io/widelands_map_map_object_saver.h" |
2947 | +#include "map_io/map_object_loader.h" |
2948 | +#include "map_io/map_object_saver.h" |
2949 | |
2950 | namespace Widelands { |
2951 | |
2952 | @@ -38,7 +38,7 @@ |
2953 | */ |
2954 | WaresQueue::WaresQueue |
2955 | (PlayerImmovable & _owner, |
2956 | - Ware_Index const _ware, |
2957 | + WareIndex const _ware, |
2958 | uint8_t const _max_size) |
2959 | : |
2960 | m_owner (_owner), |
2961 | @@ -110,7 +110,7 @@ |
2962 | /** |
2963 | * Set the callback function that is called when an item has arrived. |
2964 | */ |
2965 | -void WaresQueue::set_callback(callback_t * const fn, void * const data) |
2966 | +void WaresQueue::set_callback(CallbackFn * const fn, void * const data) |
2967 | { |
2968 | m_callback_fn = fn; |
2969 | m_callback_data = data; |
2970 | @@ -122,7 +122,7 @@ |
2971 | void WaresQueue::request_callback |
2972 | (Game & game, |
2973 | Request &, |
2974 | - Ware_Index const ware, |
2975 | + WareIndex const ware, |
2976 | #ifndef NDEBUG |
2977 | Worker * const w, |
2978 | #else |
2979 | @@ -235,7 +235,7 @@ |
2980 | * Read and write |
2981 | */ |
2982 | #define WARES_QUEUE_DATA_PACKET_VERSION 2 |
2983 | -void WaresQueue::Write(FileWrite & fw, Game & game, MapMapObjectSaver & mos) |
2984 | +void WaresQueue::Write(FileWrite & fw, Game & game, MapObjectSaver & mos) |
2985 | { |
2986 | fw.Unsigned16(WARES_QUEUE_DATA_PACKET_VERSION); |
2987 | |
2988 | @@ -254,7 +254,7 @@ |
2989 | } |
2990 | |
2991 | |
2992 | -void WaresQueue::Read(FileRead & fr, Game & game, MapMapObjectLoader & mol) |
2993 | +void WaresQueue::Read(FileRead & fr, Game & game, MapObjectLoader & mol) |
2994 | { |
2995 | uint16_t const packet_version = fr.Unsigned16(); |
2996 | try { |
2997 | @@ -283,10 +283,10 @@ |
2998 | if (m_owner.get_economy()) |
2999 | add_to_economy(*m_owner.get_economy()); |
3000 | } else |
3001 | - throw game_data_error |
3002 | + throw GameDataError |
3003 | ("unknown/unhandled version %u", packet_version); |
3004 | - } catch (const game_data_error & e) { |
3005 | - throw game_data_error("waresqueue: %s", e.what()); |
3006 | + } catch (const GameDataError & e) { |
3007 | + throw GameDataError("waresqueue: %s", e.what()); |
3008 | } |
3009 | } |
3010 | |
3011 | |
3012 | === modified file 'src/economy/wares_queue.h' |
3013 | --- src/economy/wares_queue.h 2014-07-28 14:17:07 +0000 |
3014 | +++ src/economy/wares_queue.h 2014-09-18 15:54:00 +0000 |
3015 | @@ -26,10 +26,10 @@ |
3016 | namespace Widelands { |
3017 | |
3018 | class Economy; |
3019 | -class Editor_Game_Base; |
3020 | +class EditorGameBase; |
3021 | class Game; |
3022 | -class MapMapObjectLoader; |
3023 | -struct MapMapObjectSaver; |
3024 | +class MapObjectLoader; |
3025 | +struct MapObjectSaver; |
3026 | class Player; |
3027 | class Request; |
3028 | class Worker; |
3029 | @@ -39,23 +39,23 @@ |
3030 | */ |
3031 | class WaresQueue { |
3032 | public: |
3033 | - typedef void (callback_t) |
3034 | - (Game &, WaresQueue *, Ware_Index ware, void * data); |
3035 | + using CallbackFn = void |
3036 | + (Game &, WaresQueue *, WareIndex ware, void * data); |
3037 | |
3038 | - WaresQueue(PlayerImmovable &, Ware_Index, uint8_t size); |
3039 | + WaresQueue(PlayerImmovable &, WareIndex, uint8_t size); |
3040 | |
3041 | #ifndef NDEBUG |
3042 | ~WaresQueue() {assert(m_ware == INVALID_INDEX);} |
3043 | #endif |
3044 | |
3045 | - Ware_Index get_ware() const {return m_ware;} |
3046 | + WareIndex get_ware() const {return m_ware;} |
3047 | uint32_t get_max_fill() const {return m_max_fill;} |
3048 | uint32_t get_max_size() const {return m_max_size;} |
3049 | uint32_t get_filled() const {return m_filled;} |
3050 | |
3051 | void cleanup(); |
3052 | |
3053 | - void set_callback(callback_t *, void * data); |
3054 | + void set_callback(CallbackFn *, void * data); |
3055 | |
3056 | void remove_from_economy(Economy &); |
3057 | void add_to_economy(Economy &); |
3058 | @@ -67,16 +67,16 @@ |
3059 | |
3060 | Player & owner() const {return m_owner.owner();} |
3061 | |
3062 | - void Read (FileRead &, Game &, MapMapObjectLoader &); |
3063 | - void Write(FileWrite &, Game &, MapMapObjectSaver &); |
3064 | + void Read (FileRead &, Game &, MapObjectLoader &); |
3065 | + void Write(FileWrite &, Game &, MapObjectSaver &); |
3066 | |
3067 | private: |
3068 | static void request_callback |
3069 | - (Game &, Request &, Ware_Index, Worker *, PlayerImmovable &); |
3070 | + (Game &, Request &, WareIndex, Worker *, PlayerImmovable &); |
3071 | void update(); |
3072 | |
3073 | PlayerImmovable & m_owner; |
3074 | - Ware_Index m_ware; ///< ware ID |
3075 | + WareIndex m_ware; ///< ware ID |
3076 | uint32_t m_max_size; ///< nr of items that fit into the queue maximum |
3077 | uint32_t m_max_fill; ///< nr of wares that should be ideally in this queue |
3078 | uint32_t m_filled; ///< nr of items that are currently in the queue |
3079 | @@ -86,7 +86,7 @@ |
3080 | |
3081 | Request * m_request; ///< currently pending request |
3082 | |
3083 | - callback_t * m_callback_fn; |
3084 | + CallbackFn * m_callback_fn; |
3085 | void * m_callback_data; |
3086 | }; |
3087 | |
3088 | |
3089 | === modified file 'src/editor/editorinteractive.cc' |
3090 | --- src/editor/editorinteractive.cc 2014-07-25 22:17:48 +0000 |
3091 | +++ src/editor/editorinteractive.cc 2014-09-18 15:54:00 +0000 |
3092 | @@ -58,8 +58,8 @@ |
3093 | using Widelands::Building; |
3094 | |
3095 | // Load all tribes from disk. |
3096 | -void load_all_tribes(Widelands::Editor_Game_Base* egbase, UI::ProgressWindow* loader_ui) { |
3097 | - for (const std::string& tribename : Widelands::Tribe_Descr::get_all_tribenames()) { |
3098 | +void load_all_tribes(Widelands::EditorGameBase* egbase, UI::ProgressWindow* loader_ui) { |
3099 | + for (const std::string& tribename : Widelands::TribeDescr::get_all_tribenames()) { |
3100 | ScopedTimer timer((boost::format("Loading %s took %%ums.") % tribename).str()); |
3101 | loader_ui->stepf(_("Loading tribe: %s"), tribename.c_str()); |
3102 | egbase->manually_load_tribe(tribename); |
3103 | @@ -68,8 +68,8 @@ |
3104 | |
3105 | } // namespace |
3106 | |
3107 | -Editor_Interactive::Editor_Interactive(Widelands::Editor_Game_Base & e) : |
3108 | - Interactive_Base(e, g_options.pull_section("global")), |
3109 | +EditorInteractive::EditorInteractive(Widelands::EditorGameBase & e) : |
3110 | + InteractiveBase(e, g_options.pull_section("global")), |
3111 | m_need_save(false), |
3112 | m_realtime(WLApplication::get()->get_time()), |
3113 | m_left_mouse_button_is_down(false), |
3114 | @@ -106,16 +106,16 @@ |
3115 | (INIT_BUTTON |
3116 | ("editor_redo", "redo", _("Redo"))) |
3117 | { |
3118 | - m_toggle_main_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_mainmenu, this)); |
3119 | - m_toggle_tool_menu.sigclicked.connect(boost::bind(&Editor_Interactive::tool_menu_btn, this)); |
3120 | - m_toggle_toolsize_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toolsize_menu_btn, this)); |
3121 | - m_toggle_minimap.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_minimap, this)); |
3122 | - m_toggle_buildhelp.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_buildhelp, this)); |
3123 | - m_toggle_player_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_playermenu, this)); |
3124 | + m_toggle_main_menu.sigclicked.connect(boost::bind(&EditorInteractive::toggle_mainmenu, this)); |
3125 | + m_toggle_tool_menu.sigclicked.connect(boost::bind(&EditorInteractive::tool_menu_btn, this)); |
3126 | + m_toggle_toolsize_menu.sigclicked.connect(boost::bind(&EditorInteractive::toolsize_menu_btn, this)); |
3127 | + m_toggle_minimap.sigclicked.connect(boost::bind(&EditorInteractive::toggle_minimap, this)); |
3128 | + m_toggle_buildhelp.sigclicked.connect(boost::bind(&EditorInteractive::toggle_buildhelp, this)); |
3129 | + m_toggle_player_menu.sigclicked.connect(boost::bind(&EditorInteractive::toggle_playermenu, this)); |
3130 | m_undo.sigclicked.connect( |
3131 | - boost::bind(&Editor_History::undo_action, &m_history, boost::cref(egbase().world()))); |
3132 | + boost::bind(&EditorHistory::undo_action, &m_history, boost::cref(egbase().world()))); |
3133 | m_redo.sigclicked.connect( |
3134 | - boost::bind(&Editor_History::redo_action, &m_history, boost::cref(egbase().world()))); |
3135 | + boost::bind(&EditorHistory::redo_action, &m_history, boost::cref(egbase().world()))); |
3136 | |
3137 | m_toolbar.set_layout_toplevel(true); |
3138 | m_toolbar.add(&m_toggle_main_menu, UI::Box::AlignLeft); |
3139 | @@ -132,19 +132,19 @@ |
3140 | m_redo.set_enabled(false); |
3141 | |
3142 | #ifndef NDEBUG |
3143 | - set_display_flag(Interactive_Base::dfDebug, true); |
3144 | + set_display_flag(InteractiveBase::dfDebug, true); |
3145 | #else |
3146 | - set_display_flag(Interactive_Base::dfDebug, false); |
3147 | + set_display_flag(InteractiveBase::dfDebug, false); |
3148 | #endif |
3149 | |
3150 | - fieldclicked.connect(boost::bind(&Editor_Interactive::map_clicked, this, false)); |
3151 | + fieldclicked.connect(boost::bind(&EditorInteractive::map_clicked, this, false)); |
3152 | } |
3153 | |
3154 | -void Editor_Interactive::register_overlays() { |
3155 | +void EditorInteractive::register_overlays() { |
3156 | Widelands::Map & map = egbase().map(); |
3157 | |
3158 | // Starting locations |
3159 | - Widelands::Player_Number const nr_players = map.get_nrplayers(); |
3160 | + Widelands::PlayerNumber const nr_players = map.get_nrplayers(); |
3161 | assert(nr_players <= 99); // 2 decimal digits |
3162 | char fname[] = "pics/editor_player_00_starting_pos.png"; |
3163 | iterate_player_numbers(p, nr_players) { |
3164 | @@ -174,7 +174,7 @@ |
3165 | } |
3166 | |
3167 | |
3168 | -void Editor_Interactive::load(const std::string & filename) { |
3169 | +void EditorInteractive::load(const std::string & filename) { |
3170 | assert(filename.size()); |
3171 | |
3172 | Widelands::Map & map = egbase().map(); |
3173 | @@ -184,9 +184,9 @@ |
3174 | egbase().cleanup_for_load(); |
3175 | m_history.reset(); |
3176 | |
3177 | - std::unique_ptr<Widelands::Map_Loader> ml(map.get_correct_loader(filename)); |
3178 | + std::unique_ptr<Widelands::MapLoader> ml(map.get_correct_loader(filename)); |
3179 | if (!ml.get()) |
3180 | - throw warning |
3181 | + throw WLWarning |
3182 | (_("Unsupported format"), |
3183 | _("Widelands could not load the file \"%s\". The file format seems to be incompatible."), |
3184 | filename.c_str()); |
3185 | @@ -219,7 +219,7 @@ |
3186 | |
3187 | |
3188 | /// Called just before the editor starts, after postload, init and gfxload. |
3189 | -void Editor_Interactive::start() { |
3190 | +void EditorInteractive::start() { |
3191 | // Run the editor initialization script, if any |
3192 | try { |
3193 | egbase().lua().run_script("map:scripting/editor_init.lua"); |
3194 | @@ -235,8 +235,8 @@ |
3195 | * |
3196 | * Advance the timecounter and animate textures. |
3197 | */ |
3198 | -void Editor_Interactive::think() { |
3199 | - Interactive_Base::think(); |
3200 | +void EditorInteractive::think() { |
3201 | + InteractiveBase::think(); |
3202 | |
3203 | int32_t lasttime = m_realtime; |
3204 | int32_t frametime; |
3205 | @@ -251,7 +251,7 @@ |
3206 | |
3207 | |
3208 | |
3209 | -void Editor_Interactive::exit() { |
3210 | +void EditorInteractive::exit() { |
3211 | if (m_need_save) { |
3212 | UI::WLMessageBox mmb |
3213 | (this, |
3214 | @@ -264,14 +264,14 @@ |
3215 | end_modal(0); |
3216 | } |
3217 | |
3218 | -void Editor_Interactive::toggle_mainmenu() { |
3219 | +void EditorInteractive::toggle_mainmenu() { |
3220 | if (m_mainmenu.window) |
3221 | delete m_mainmenu.window; |
3222 | else |
3223 | - new Editor_Main_Menu(*this, m_mainmenu); |
3224 | + new EditorMainMenu(*this, m_mainmenu); |
3225 | } |
3226 | |
3227 | -void Editor_Interactive::map_clicked(bool should_draw) { |
3228 | +void EditorInteractive::map_clicked(bool should_draw) { |
3229 | m_history.do_action |
3230 | (tools.current(), |
3231 | tools.use_tool, egbase().map(), egbase().world(), |
3232 | @@ -280,72 +280,72 @@ |
3233 | set_need_save(true); |
3234 | } |
3235 | |
3236 | -bool Editor_Interactive::handle_mouserelease(uint8_t btn, int32_t x, int32_t y) { |
3237 | +bool EditorInteractive::handle_mouserelease(uint8_t btn, int32_t x, int32_t y) { |
3238 | if (btn == SDL_BUTTON_LEFT) { |
3239 | m_left_mouse_button_is_down = false; |
3240 | } |
3241 | - return Interactive_Base::handle_mouserelease(btn, x, y); |
3242 | + return InteractiveBase::handle_mouserelease(btn, x, y); |
3243 | } |
3244 | |
3245 | -bool Editor_Interactive::handle_mousepress(uint8_t btn, int32_t x, int32_t y) { |
3246 | +bool EditorInteractive::handle_mousepress(uint8_t btn, int32_t x, int32_t y) { |
3247 | if (btn == SDL_BUTTON_LEFT) { |
3248 | m_left_mouse_button_is_down = true; |
3249 | } |
3250 | - return Interactive_Base::handle_mousepress(btn, x, y); |
3251 | + return InteractiveBase::handle_mousepress(btn, x, y); |
3252 | } |
3253 | |
3254 | /// Needed to get freehand painting tools (hold down mouse and move to edit). |
3255 | -void Editor_Interactive::set_sel_pos(Widelands::Node_and_Triangle<> const sel) { |
3256 | +void EditorInteractive::set_sel_pos(Widelands::NodeAndTriangle<> const sel) { |
3257 | bool const target_changed = |
3258 | tools.current().operates_on_triangles() ? |
3259 | sel.triangle != get_sel_pos().triangle : sel.node != get_sel_pos().node; |
3260 | - Interactive_Base::set_sel_pos(sel); |
3261 | + InteractiveBase::set_sel_pos(sel); |
3262 | if (target_changed && m_left_mouse_button_is_down) |
3263 | map_clicked(true); |
3264 | } |
3265 | |
3266 | -void Editor_Interactive::toggle_buildhelp() { |
3267 | +void EditorInteractive::toggle_buildhelp() { |
3268 | egbase().map().overlay_manager().toggle_buildhelp(); |
3269 | } |
3270 | |
3271 | |
3272 | -void Editor_Interactive::tool_menu_btn() { |
3273 | +void EditorInteractive::tool_menu_btn() { |
3274 | if (m_toolmenu.window) |
3275 | delete m_toolmenu.window; |
3276 | else |
3277 | - new Editor_Tool_Menu(*this, m_toolmenu); |
3278 | + new EditorToolMenu(*this, m_toolmenu); |
3279 | } |
3280 | |
3281 | |
3282 | -void Editor_Interactive::toggle_playermenu() { |
3283 | +void EditorInteractive::toggle_playermenu() { |
3284 | if (m_playermenu.window) |
3285 | delete m_playermenu.window; |
3286 | else { |
3287 | - select_tool(tools.set_starting_pos, Editor_Tool::First); |
3288 | - new Editor_Player_Menu(*this, m_playermenu); |
3289 | + select_tool(tools.set_starting_pos, EditorTool::First); |
3290 | + new EditorPlayerMenu(*this, m_playermenu); |
3291 | } |
3292 | |
3293 | } |
3294 | |
3295 | -void Editor_Interactive::toolsize_menu_btn() { |
3296 | +void EditorInteractive::toolsize_menu_btn() { |
3297 | if (m_toolsizemenu.window) |
3298 | delete m_toolsizemenu.window; |
3299 | else |
3300 | - new Editor_Toolsize_Menu(*this, m_toolsizemenu); |
3301 | + new EditorToolsizeMenu(*this, m_toolsizemenu); |
3302 | } |
3303 | |
3304 | -void Editor_Interactive::set_sel_radius_and_update_menu(uint32_t const val) { |
3305 | +void EditorInteractive::set_sel_radius_and_update_menu(uint32_t const val) { |
3306 | if (tools.current().has_size_one()) |
3307 | return; |
3308 | if (UI::UniqueWindow * const w = m_toolsizemenu.window) |
3309 | - ref_cast<Editor_Toolsize_Menu, UI::UniqueWindow>(*w).update(val); |
3310 | + ref_cast<EditorToolsizeMenu, UI::UniqueWindow>(*w).update(val); |
3311 | else |
3312 | set_sel_radius(val); |
3313 | } |
3314 | |
3315 | |
3316 | -bool Editor_Interactive::handle_key(bool const down, SDL_keysym const code) { |
3317 | - bool handled = Interactive_Base::handle_key(down, code); |
3318 | +bool EditorInteractive::handle_key(bool const down, SDL_keysym const code) { |
3319 | + bool handled = InteractiveBase::handle_key(down, code); |
3320 | |
3321 | if (down) { |
3322 | // only on down events |
3323 | @@ -395,16 +395,16 @@ |
3324 | |
3325 | case SDLK_LSHIFT: |
3326 | case SDLK_RSHIFT: |
3327 | - if (tools.use_tool == Editor_Tool::First) |
3328 | - select_tool(tools.current(), Editor_Tool::Second); |
3329 | + if (tools.use_tool == EditorTool::First) |
3330 | + select_tool(tools.current(), EditorTool::Second); |
3331 | handled = true; |
3332 | break; |
3333 | |
3334 | case SDLK_LALT: |
3335 | case SDLK_RALT: |
3336 | case SDLK_MODE: |
3337 | - if (tools.use_tool == Editor_Tool::First) |
3338 | - select_tool(tools.current(), Editor_Tool::Third); |
3339 | + if (tools.use_tool == EditorTool::First) |
3340 | + select_tool(tools.current(), EditorTool::Third); |
3341 | handled = true; |
3342 | break; |
3343 | |
3344 | @@ -415,8 +415,8 @@ |
3345 | |
3346 | case SDLK_c: |
3347 | set_display_flag |
3348 | - (Interactive_Base::dfShowCensus, |
3349 | - !get_display_flag(Interactive_Base::dfShowCensus)); |
3350 | + (InteractiveBase::dfShowCensus, |
3351 | + !get_display_flag(InteractiveBase::dfShowCensus)); |
3352 | handled = true; |
3353 | break; |
3354 | |
3355 | @@ -431,7 +431,7 @@ |
3356 | break; |
3357 | |
3358 | case SDLK_i: |
3359 | - select_tool(tools.info, Editor_Tool::First); |
3360 | + select_tool(tools.info, EditorTool::First); |
3361 | handled = true; |
3362 | break; |
3363 | |
3364 | @@ -442,7 +442,7 @@ |
3365 | |
3366 | case SDLK_l: |
3367 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
3368 | - new Main_Menu_Load_Map(*this); |
3369 | + new MainMenuLoadMap(*this); |
3370 | handled = true; |
3371 | break; |
3372 | |
3373 | @@ -453,7 +453,7 @@ |
3374 | |
3375 | case SDLK_s: |
3376 | if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) |
3377 | - new Main_Menu_Save_Map(*this); |
3378 | + new MainMenuSaveMap(*this); |
3379 | handled = true; |
3380 | break; |
3381 | |
3382 | @@ -486,8 +486,8 @@ |
3383 | case SDLK_LALT: |
3384 | case SDLK_RALT: |
3385 | case SDLK_MODE: |
3386 | - if (tools.use_tool != Editor_Tool::First) |
3387 | - select_tool(tools.current(), Editor_Tool::First); |
3388 | + if (tools.use_tool != EditorTool::First) |
3389 | + select_tool(tools.current(), EditorTool::First); |
3390 | handled = true; |
3391 | break; |
3392 | default: |
3393 | @@ -498,9 +498,9 @@ |
3394 | } |
3395 | |
3396 | |
3397 | -void Editor_Interactive::select_tool |
3398 | -(Editor_Tool & primary, Editor_Tool::Tool_Index const which) { |
3399 | - if (which == Editor_Tool::First && & primary != tools.current_pointer) { |
3400 | +void EditorInteractive::select_tool |
3401 | +(EditorTool & primary, EditorTool::ToolIndex const which) { |
3402 | + if (which == EditorTool::First && & primary != tools.current_pointer) { |
3403 | if (primary.has_size_one()) |
3404 | set_sel_radius_and_update_menu(0); |
3405 | Widelands::Map & map = egbase().map(); |
3406 | @@ -524,12 +524,12 @@ |
3407 | * |
3408 | * data is a pointer to a tribe (for buildings) |
3409 | */ |
3410 | -void Editor_Interactive::reference_player_tribe |
3411 | -(Widelands::Player_Number player, void const * const data) { |
3412 | +void EditorInteractive::reference_player_tribe |
3413 | +(Widelands::PlayerNumber player, void const * const data) { |
3414 | assert(0 < player); |
3415 | assert(player <= egbase().map().get_nrplayers()); |
3416 | |
3417 | - Player_References r; |
3418 | + PlayerReferences r; |
3419 | r.player = player; |
3420 | r.object = data; |
3421 | |
3422 | @@ -537,14 +537,14 @@ |
3423 | } |
3424 | |
3425 | /// Unreference !once!, if referenced many times, this will leak a reference. |
3426 | -void Editor_Interactive::unreference_player_tribe |
3427 | -(Widelands::Player_Number const player, void const * const data) { |
3428 | +void EditorInteractive::unreference_player_tribe |
3429 | +(Widelands::PlayerNumber const player, void const * const data) { |
3430 | assert(player <= egbase().map().get_nrplayers()); |
3431 | assert(data); |
3432 | |
3433 | - std::vector<Player_References> & references = m_player_tribe_references; |
3434 | - std::vector<Player_References>::iterator it = references.begin(); |
3435 | - std::vector<Player_References>::const_iterator references_end = |
3436 | + std::vector<PlayerReferences> & references = m_player_tribe_references; |
3437 | + std::vector<PlayerReferences>::iterator it = references.begin(); |
3438 | + std::vector<PlayerReferences>::const_iterator references_end = |
3439 | references.end(); |
3440 | if (player) { |
3441 | for (; it < references_end; ++it) |
3442 | @@ -561,8 +561,8 @@ |
3443 | ++it; |
3444 | } |
3445 | |
3446 | -bool Editor_Interactive::is_player_tribe_referenced |
3447 | -(Widelands::Player_Number const player) { |
3448 | +bool EditorInteractive::is_player_tribe_referenced |
3449 | +(Widelands::PlayerNumber const player) { |
3450 | assert(0 < player); |
3451 | assert(player <= egbase().map().get_nrplayers()); |
3452 | |
3453 | @@ -573,9 +573,9 @@ |
3454 | return false; |
3455 | } |
3456 | |
3457 | -void Editor_Interactive::run_editor(const std::string& filename, const std::string& script_to_run) { |
3458 | - Widelands::Editor_Game_Base editor(nullptr); |
3459 | - Editor_Interactive eia(editor); |
3460 | +void EditorInteractive::run_editor(const std::string& filename, const std::string& script_to_run) { |
3461 | + Widelands::EditorGameBase editor(nullptr); |
3462 | + EditorInteractive eia(editor); |
3463 | editor.set_ibase(&eia); // TODO(unknown): get rid of this |
3464 | { |
3465 | UI::ProgressWindow loader_ui("pics/editor.jpg"); |
3466 | @@ -606,7 +606,7 @@ |
3467 | } |
3468 | } |
3469 | |
3470 | - eia.select_tool(eia.tools.increase_height, Editor_Tool::First); |
3471 | + eia.select_tool(eia.tools.increase_height, EditorTool::First); |
3472 | editor.postload(); |
3473 | eia.start(); |
3474 | |
3475 | |
3476 | === modified file 'src/editor/editorinteractive.h' |
3477 | --- src/editor/editorinteractive.h 2014-07-26 10:43:23 +0000 |
3478 | +++ src/editor/editorinteractive.h 2014-09-18 15:54:00 +0000 |
3479 | @@ -37,21 +37,21 @@ |
3480 | #include "wui/interactive_base.h" |
3481 | |
3482 | class Editor; |
3483 | -class Editor_Tool; |
3484 | +class EditorTool; |
3485 | |
3486 | /** |
3487 | * This is the EditorInteractive. It is like the InteractivePlayer class, |
3488 | * but for the Editor instead of the game |
3489 | */ |
3490 | -struct Editor_Interactive : public Interactive_Base { |
3491 | - friend struct Editor_Tool_Menu; |
3492 | +struct EditorInteractive : public InteractiveBase { |
3493 | + friend struct EditorToolMenu; |
3494 | |
3495 | // Runs the Editor via the commandline --editor flag. Will load 'filename' as a |
3496 | // map and run 'script_to_run' directly after all initialization is done. |
3497 | static void run_editor(const std::string & filename, const std::string& script_to_run); |
3498 | |
3499 | private: |
3500 | - Editor_Interactive(Widelands::Editor_Game_Base &); |
3501 | + EditorInteractive(Widelands::EditorGameBase &); |
3502 | |
3503 | public: |
3504 | void register_overlays(); |
3505 | @@ -62,7 +62,7 @@ |
3506 | void think() override; |
3507 | |
3508 | void map_clicked(bool draw = false); |
3509 | - void set_sel_pos(Widelands::Node_and_Triangle<>) override; |
3510 | + void set_sel_pos(Widelands::NodeAndTriangle<>) override; |
3511 | void set_sel_radius_and_update_menu(uint32_t); |
3512 | |
3513 | // Handle UI elements. |
3514 | @@ -74,7 +74,7 @@ |
3515 | Tools() |
3516 | : |
3517 | current_pointer(&increase_height), |
3518 | - use_tool(Editor_Tool::First), |
3519 | + use_tool(EditorTool::First), |
3520 | increase_height(decrease_height, set_height), |
3521 | noise_height(set_height), |
3522 | place_immovable(delete_immovable), |
3523 | @@ -82,32 +82,32 @@ |
3524 | increase_resources(decrease_resources, set_resources), |
3525 | set_port_space(unset_port_space) |
3526 | {} |
3527 | - Editor_Tool & current() const {return *current_pointer;} |
3528 | - typedef std::vector<Editor_Tool *> Tool_Vector; |
3529 | - //Tool_Vector tools; |
3530 | - Editor_Tool * current_pointer; |
3531 | - Editor_Tool::Tool_Index use_tool; |
3532 | - Editor_Info_Tool info; |
3533 | - Editor_Set_Height_Tool set_height; |
3534 | - Editor_Decrease_Height_Tool decrease_height; |
3535 | - Editor_Increase_Height_Tool increase_height; |
3536 | - Editor_Noise_Height_Tool noise_height; |
3537 | - Editor_Set_Terrain_Tool set_terrain; |
3538 | - Editor_Delete_Immovable_Tool delete_immovable; |
3539 | - Editor_Place_Immovable_Tool place_immovable; |
3540 | - Editor_Set_Starting_Pos_Tool set_starting_pos; |
3541 | - Editor_Delete_Bob_Tool delete_bob; |
3542 | - Editor_Place_Bob_Tool place_bob; |
3543 | - Editor_Decrease_Resources_Tool decrease_resources; |
3544 | - Editor_Set_Resources_Tool set_resources; |
3545 | - Editor_Increase_Resources_Tool increase_resources; |
3546 | - Editor_Set_Port_Space_Tool set_port_space; |
3547 | - Editor_Unset_Port_Space_Tool unset_port_space; |
3548 | - Editor_Set_Origin_Tool set_origin; |
3549 | - Editor_Make_Infrastructure_Tool make_infrastructure; |
3550 | + EditorTool & current() const {return *current_pointer;} |
3551 | + using ToolVector = std::vector<EditorTool *>; |
3552 | + //ToolVector tools; |
3553 | + EditorTool * current_pointer; |
3554 | + EditorTool::ToolIndex use_tool; |
3555 | + EditorInfoTool info; |
3556 | + EditorSetHeightTool set_height; |
3557 | + EditorDecreaseHeightTool decrease_height; |
3558 | + EditorIncreaseHeightTool increase_height; |
3559 | + EditorNoiseHeightTool noise_height; |
3560 | + EditorSetTerrainTool set_terrain; |
3561 | + EditorDeleteImmovableTool delete_immovable; |
3562 | + EditorPlaceImmovableTool place_immovable; |
3563 | + EditorSetStartingPosTool set_starting_pos; |
3564 | + EditorDeleteBobTool delete_bob; |
3565 | + EditorPlaceBobTool place_bob; |
3566 | + EditorDecreaseResourcesTool decrease_resources; |
3567 | + EditorSetResourcesTool set_resources; |
3568 | + EditorIncreaseResourcesTool increase_resources; |
3569 | + EditorSetPortSpaceTool set_port_space; |
3570 | + EditorUnsetPortSpaceTool unset_port_space; |
3571 | + EditorSetOriginTool set_origin; |
3572 | + EditorMakeInfrastructureTool make_infrastructure; |
3573 | } tools; |
3574 | |
3575 | - void select_tool(Editor_Tool &, Editor_Tool::Tool_Index); |
3576 | + void select_tool(EditorTool &, EditorTool::ToolIndex); |
3577 | |
3578 | Widelands::Player * get_player() const override {return nullptr;} |
3579 | |
3580 | @@ -115,9 +115,9 @@ |
3581 | void exit(); |
3582 | |
3583 | // reference functions |
3584 | - void reference_player_tribe(Widelands::Player_Number, void const * const) override; |
3585 | - void unreference_player_tribe(Widelands::Player_Number, void const * const); |
3586 | - bool is_player_tribe_referenced(Widelands::Player_Number); |
3587 | + void reference_player_tribe(Widelands::PlayerNumber, void const * const) override; |
3588 | + void unreference_player_tribe(Widelands::PlayerNumber, void const * const); |
3589 | + bool is_player_tribe_referenced(Widelands::PlayerNumber); |
3590 | void set_need_save(bool const t) {m_need_save = t;} |
3591 | |
3592 | private: |
3593 | @@ -129,16 +129,16 @@ |
3594 | |
3595 | // state variables |
3596 | bool m_need_save; |
3597 | - struct Player_References { |
3598 | + struct PlayerReferences { |
3599 | int32_t player; |
3600 | void const * object; |
3601 | }; |
3602 | - std::vector<Player_References> m_player_tribe_references; |
3603 | + std::vector<PlayerReferences> m_player_tribe_references; |
3604 | |
3605 | int32_t m_realtime; |
3606 | bool m_left_mouse_button_is_down; |
3607 | |
3608 | - Editor_History m_history; |
3609 | + EditorHistory m_history; |
3610 | |
3611 | UI::UniqueWindow::Registry m_toolmenu; |
3612 | |
3613 | |
3614 | === modified file 'src/editor/map_generator.cc' |
3615 | --- src/editor/map_generator.cc 2014-07-25 22:17:48 +0000 |
3616 | +++ src/editor/map_generator.cc 2014-09-18 15:54:00 +0000 |
3617 | @@ -40,7 +40,7 @@ |
3618 | |
3619 | namespace Widelands { |
3620 | |
3621 | -MapGenerator::MapGenerator(Map& map, const UniqueRandomMapInfo& mapInfo, Editor_Game_Base& egbase) : |
3622 | +MapGenerator::MapGenerator(Map& map, const UniqueRandomMapInfo& mapInfo, EditorGameBase& egbase) : |
3623 | map_(map), |
3624 | map_info_(mapInfo), |
3625 | egbase_(egbase) |
3626 | @@ -126,12 +126,12 @@ |
3627 | // TODO(unknown): Check how the editor handles this... |
3628 | |
3629 | const World& world = egbase_.world(); |
3630 | - Terrain_Index const tix = fc.field->get_terrains().d; |
3631 | + TerrainIndex const tix = fc.field->get_terrains().d; |
3632 | const TerrainDescription& terrain_description = egbase_.world().terrain_descr(tix); |
3633 | |
3634 | const auto set_resource_helper = [this, &world, &terrain_description, &fc] ( |
3635 | const uint32_t random_value, const int valid_resource_index) { |
3636 | - const Resource_Index res_idx = terrain_description.get_valid_resource(valid_resource_index); |
3637 | + const ResourceIndex res_idx = terrain_description.get_valid_resource(valid_resource_index); |
3638 | const uint32_t max_amount = world.get_resource(res_idx)->max_amount(); |
3639 | uint8_t res_val = static_cast<uint8_t>(random_value / (kMaxElevation / max_amount)); |
3640 | res_val *= static_cast<uint8_t>(map_info_.resource_amount) + 1; |
3641 | @@ -227,8 +227,8 @@ |
3642 | if (map_info_.islandMode) { |
3643 | int32_t const border_dist = |
3644 | std::min |
3645 | - (std::min<X_Coordinate>(c.x, map_info_.w - c.x), |
3646 | - std::min<Y_Coordinate>(c.y, map_info_.h - c.y)); |
3647 | + (std::min<int16_t>(c.x, map_info_.w - c.x), |
3648 | + std::min<int16_t>(c.y, map_info_.h - c.y)); |
3649 | if (border_dist <= kIslandBorder) { |
3650 | res_h = |
3651 | static_cast<uint8_t> |
3652 | @@ -442,7 +442,7 @@ |
3653 | terrType: Returns the terrain-Type fpor this triangle |
3654 | =============== |
3655 | */ |
3656 | -Terrain_Index MapGenerator::figure_out_terrain |
3657 | +TerrainIndex MapGenerator::figure_out_terrain |
3658 | (uint32_t * const random2, |
3659 | uint32_t * const random3, |
3660 | uint32_t * const random4, |
3661 | @@ -770,16 +770,16 @@ |
3662 | |
3663 | // Random placement of starting positions |
3664 | assert(map_info_.numPlayers); |
3665 | - std::vector<Player_Number> pn(map_info_.numPlayers); |
3666 | - for (Player_Number n = 1; n <= map_info_.numPlayers; ++n) { |
3667 | + std::vector<PlayerNumber> pn(map_info_.numPlayers); |
3668 | + for (PlayerNumber n = 1; n <= map_info_.numPlayers; ++n) { |
3669 | bool okay = false; |
3670 | // This is a kinda dump algorithm -> we generate a random number and increase it until it fits. |
3671 | // However it's working and simple ;) - if you've got a better idea, feel free to fix it. |
3672 | - Player_Number x = rng.rand() % map_info_.numPlayers; |
3673 | + PlayerNumber x = rng.rand() % map_info_.numPlayers; |
3674 | while (!okay) { |
3675 | okay = true; |
3676 | - ++x; // Player_Number begins at 1 not at 0 |
3677 | - for (Player_Number p = 1; p < n; ++p) { |
3678 | + ++x; // PlayerNumber begins at 1 not at 0 |
3679 | + for (PlayerNumber p = 1; p < n; ++p) { |
3680 | if (pn[p - 1] == x) { |
3681 | okay = false; |
3682 | x = x % map_info_.numPlayers; |
3683 | @@ -790,7 +790,7 @@ |
3684 | pn[n - 1] = x; |
3685 | } |
3686 | |
3687 | - for (Player_Number n = 1; n <= map_info_.numPlayers; ++n) { |
3688 | + for (PlayerNumber n = 1; n <= map_info_.numPlayers; ++n) { |
3689 | // Set scenario information - needed even if it's not a scenario |
3690 | map_.set_scenario_player_name(n, "Random Player"); |
3691 | map_.set_scenario_player_tribe(n, tribe); |
3692 | @@ -1010,7 +1010,7 @@ |
3693 | |
3694 | // Convert amount of resources |
3695 | mapInfo_out.resource_amount = |
3696 | - static_cast<Widelands::UniqueRandomMapInfo::Resource_Amount> |
3697 | + static_cast<Widelands::UniqueRandomMapInfo::ResourceAmount> |
3698 | ((nums[6] & 0xc) >> 2); |
3699 | |
3700 | if |
3701 | |
3702 | === modified file 'src/editor/map_generator.h' |
3703 | --- src/editor/map_generator.h 2014-07-05 16:41:51 +0000 |
3704 | +++ src/editor/map_generator.h 2014-09-18 15:54:00 +0000 |
3705 | @@ -30,7 +30,7 @@ |
3706 | namespace Widelands { |
3707 | |
3708 | class Map; |
3709 | -class Editor_Game_Base; |
3710 | +class EditorGameBase; |
3711 | |
3712 | /** |
3713 | * This helper class repesents the complete map initialization |
3714 | @@ -43,7 +43,7 @@ |
3715 | */ |
3716 | struct UniqueRandomMapInfo { |
3717 | |
3718 | - enum Resource_Amount |
3719 | + enum ResourceAmount |
3720 | { |
3721 | raLow = 0, |
3722 | raMedium = 1, |
3723 | @@ -53,13 +53,13 @@ |
3724 | uint32_t mapNumber; |
3725 | uint32_t w; |
3726 | uint32_t h; |
3727 | - Resource_Amount resource_amount; |
3728 | + ResourceAmount resource_amount; |
3729 | std::string world_name; |
3730 | |
3731 | double waterRatio; // How much of the map is water? |
3732 | double landRatio; // How much of the map is land? |
3733 | double wastelandRatio; // How much of the "land" is wasteland? |
3734 | - Player_Number numPlayers; // number of player to generate |
3735 | + PlayerNumber numPlayers; // number of player to generate |
3736 | bool islandMode; // whether the world will be an island |
3737 | |
3738 | // other stuff |
3739 | @@ -79,7 +79,7 @@ |
3740 | |
3741 | MapGenerator |
3742 | (Map & map, const UniqueRandomMapInfo & mapInfo, |
3743 | - Editor_Game_Base & egbase); |
3744 | + EditorGameBase & egbase); |
3745 | |
3746 | void create_random_map(); |
3747 | |
3748 | @@ -104,7 +104,7 @@ |
3749 | static uint32_t * generate_random_value_map |
3750 | (uint32_t w, uint32_t h, RNG & rng); |
3751 | |
3752 | - Terrain_Index figure_out_terrain |
3753 | + TerrainIndex figure_out_terrain |
3754 | (uint32_t * const random2, |
3755 | uint32_t * const random3, |
3756 | uint32_t * const random4, |
3757 | @@ -116,7 +116,7 @@ |
3758 | std::unique_ptr<const MapGenInfo> map_gen_info_; |
3759 | Map& map_; |
3760 | const UniqueRandomMapInfo& map_info_; |
3761 | - Editor_Game_Base& egbase_; |
3762 | + EditorGameBase& egbase_; |
3763 | }; |
3764 | |
3765 | } |
3766 | |
3767 | === modified file 'src/editor/tools/editor_action_args.h' |
3768 | --- src/editor/tools/editor_action_args.h 2014-07-26 16:37:37 +0000 |
3769 | +++ src/editor/tools/editor_action_args.h 2014-09-18 15:54:00 +0000 |
3770 | @@ -30,21 +30,21 @@ |
3771 | class BobDescr; |
3772 | } // namespace Widelands |
3773 | |
3774 | -struct Editor_Interactive; |
3775 | -struct Editor_Tool_Action; |
3776 | +struct EditorInteractive; |
3777 | +struct EditorToolAction; |
3778 | |
3779 | /// Class to save important and changeable properties of classes needed for actions |
3780 | // Implementations in editor_history.cc |
3781 | -struct Editor_Action_Args { |
3782 | - Editor_Action_Args(Editor_Interactive & base); |
3783 | +struct EditorActionArgs { |
3784 | + EditorActionArgs(EditorInteractive & base); |
3785 | |
3786 | // TODO(sirver): This class does its own reference counting. This design is |
3787 | // brittle and on a quick overview I have a feeling that it might not be |
3788 | // correct. |
3789 | - Editor_Action_Args(const Editor_Action_Args&) = default; |
3790 | - Editor_Action_Args& operator = (const Editor_Action_Args&) = default; |
3791 | + EditorActionArgs(const EditorActionArgs&) = default; |
3792 | + EditorActionArgs& operator = (const EditorActionArgs&) = default; |
3793 | |
3794 | - ~Editor_Action_Args(); |
3795 | + ~EditorActionArgs(); |
3796 | |
3797 | uint32_t sel_radius; |
3798 | |
3799 | @@ -56,9 +56,9 @@ |
3800 | std::list<std::string> oimmov_types; // immovable change tools |
3801 | std::list<int32_t> nimmov_types; // immovable change tools |
3802 | Widelands::HeightInterval m_interval; // noise hight tool |
3803 | - std::list<Widelands::Terrain_Index> terrainType, origTerrainType; // set terrain tool |
3804 | + std::list<Widelands::TerrainIndex> terrainType, origTerrainType; // set terrain tool |
3805 | |
3806 | - std::list<Editor_Tool_Action *> draw_actions; // draw tool |
3807 | + std::list<EditorToolAction *> draw_actions; // draw tool |
3808 | |
3809 | uint32_t refcount; |
3810 | }; |
3811 | |
3812 | === modified file 'src/editor/tools/editor_decrease_height_tool.cc' |
3813 | --- src/editor/tools/editor_decrease_height_tool.cc 2014-03-01 17:09:07 +0000 |
3814 | +++ src/editor/tools/editor_decrease_height_tool.cc 2014-09-18 15:54:00 +0000 |
3815 | @@ -27,11 +27,11 @@ |
3816 | #include "logic/mapregion.h" |
3817 | |
3818 | /// Decreases the heights by a value. Chages surrounding nodes if necessary. |
3819 | -int32_t Editor_Decrease_Height_Tool::handle_click_impl(Widelands::Map& map, |
3820 | +int32_t EditorDecreaseHeightTool::handle_click_impl(Widelands::Map& map, |
3821 | const Widelands::World& world, |
3822 | - Widelands::Node_and_Triangle<> center, |
3823 | - Editor_Interactive& /* parent */, |
3824 | - Editor_Action_Args& args) { |
3825 | + Widelands::NodeAndTriangle<> center, |
3826 | + EditorInteractive& /* parent */, |
3827 | + EditorActionArgs& args) { |
3828 | if (args.origHights.empty()) { |
3829 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
3830 | (map, |
3831 | @@ -47,12 +47,12 @@ |
3832 | -args.change_by); |
3833 | } |
3834 | |
3835 | -int32_t Editor_Decrease_Height_Tool::handle_undo_impl |
3836 | +int32_t EditorDecreaseHeightTool::handle_undo_impl |
3837 | (Widelands::Map & map, |
3838 | const Widelands::World& world, |
3839 | - Widelands::Node_and_Triangle<> center, |
3840 | - Editor_Interactive & /* parent */, |
3841 | - Editor_Action_Args & args) |
3842 | + Widelands::NodeAndTriangle<> center, |
3843 | + EditorInteractive & /* parent */, |
3844 | + EditorActionArgs & args) |
3845 | { |
3846 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
3847 | (map, |
3848 | @@ -72,9 +72,9 @@ |
3849 | return mr.radius() + 1; |
3850 | } |
3851 | |
3852 | -Editor_Action_Args Editor_Decrease_Height_Tool::format_args_impl(Editor_Interactive & parent) |
3853 | +EditorActionArgs EditorDecreaseHeightTool::format_args_impl(EditorInteractive & parent) |
3854 | { |
3855 | - Editor_Action_Args a(parent); |
3856 | + EditorActionArgs a(parent); |
3857 | a.change_by = m_change_by; |
3858 | return a; |
3859 | } |
3860 | |
3861 | === modified file 'src/editor/tools/editor_decrease_height_tool.h' |
3862 | --- src/editor/tools/editor_decrease_height_tool.h 2014-07-05 16:41:51 +0000 |
3863 | +++ src/editor/tools/editor_decrease_height_tool.h 2014-09-18 15:54:00 +0000 |
3864 | @@ -23,22 +23,22 @@ |
3865 | #include "editor/tools/editor_tool.h" |
3866 | |
3867 | /// Decreases the height of a node by a value. |
3868 | -struct Editor_Decrease_Height_Tool : public Editor_Tool { |
3869 | - Editor_Decrease_Height_Tool() : Editor_Tool(*this, *this), m_change_by(1) {} |
3870 | +struct EditorDecreaseHeightTool : public EditorTool { |
3871 | + EditorDecreaseHeightTool() : EditorTool(*this, *this), m_change_by(1) {} |
3872 | |
3873 | int32_t handle_click_impl |
3874 | (Widelands::Map & map, |
3875 | const Widelands::World& world, |
3876 | - Widelands::Node_and_Triangle<> center, |
3877 | - Editor_Interactive & parent, Editor_Action_Args & args) override; |
3878 | + Widelands::NodeAndTriangle<> center, |
3879 | + EditorInteractive & parent, EditorActionArgs & args) override; |
3880 | |
3881 | int32_t handle_undo_impl |
3882 | (Widelands::Map & map, |
3883 | const Widelands::World& world, |
3884 | - Widelands::Node_and_Triangle<> center, |
3885 | - Editor_Interactive & parent, Editor_Action_Args & args) override; |
3886 | + Widelands::NodeAndTriangle<> center, |
3887 | + EditorInteractive & parent, EditorActionArgs & args) override; |
3888 | |
3889 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
3890 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
3891 | |
3892 | char const * get_sel_impl() const override { |
3893 | return "pics/fsel_editor_decrease_height.png"; |
3894 | |
3895 | === modified file 'src/editor/tools/editor_decrease_resources_tool.cc' |
3896 | --- src/editor/tools/editor_decrease_resources_tool.cc 2014-03-23 18:26:08 +0000 |
3897 | +++ src/editor/tools/editor_decrease_resources_tool.cc 2014-09-18 15:54:00 +0000 |
3898 | @@ -36,11 +36,11 @@ |
3899 | * there is not already another resource there. |
3900 | */ |
3901 | int32_t |
3902 | -Editor_Decrease_Resources_Tool::handle_click_impl(Widelands::Map& map, |
3903 | +EditorDecreaseResourcesTool::handle_click_impl(Widelands::Map& map, |
3904 | const Widelands::World& world, |
3905 | - Widelands::Node_and_Triangle<> const center, |
3906 | - Editor_Interactive& /* parent */, |
3907 | - Editor_Action_Args& args) { |
3908 | + Widelands::NodeAndTriangle<> const center, |
3909 | + EditorInteractive& /* parent */, |
3910 | + EditorActionArgs& args) { |
3911 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
3912 | (map, |
3913 | Widelands::Area<Widelands::FCoords> |
3914 | @@ -82,18 +82,18 @@ |
3915 | return mr.radius(); |
3916 | } |
3917 | |
3918 | -int32_t Editor_Decrease_Resources_Tool::handle_undo_impl( |
3919 | +int32_t EditorDecreaseResourcesTool::handle_undo_impl( |
3920 | Widelands::Map& map, |
3921 | const Widelands::World& world, |
3922 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
3923 | - Editor_Interactive& parent, |
3924 | - Editor_Action_Args& args) { |
3925 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
3926 | + EditorInteractive& parent, |
3927 | + EditorActionArgs& args) { |
3928 | return parent.tools.set_resources.handle_undo_impl(map, world, center, parent, args); |
3929 | } |
3930 | |
3931 | -Editor_Action_Args Editor_Decrease_Resources_Tool::format_args_impl(Editor_Interactive & parent) |
3932 | +EditorActionArgs EditorDecreaseResourcesTool::format_args_impl(EditorInteractive & parent) |
3933 | { |
3934 | - Editor_Action_Args a(parent); |
3935 | + EditorActionArgs a(parent); |
3936 | a.change_by = m_change_by; |
3937 | a.cur_res = m_cur_res; |
3938 | return a; |
3939 | |
3940 | === modified file 'src/editor/tools/editor_decrease_resources_tool.h' |
3941 | --- src/editor/tools/editor_decrease_resources_tool.h 2014-07-05 16:41:51 +0000 |
3942 | +++ src/editor/tools/editor_decrease_resources_tool.h 2014-09-18 15:54:00 +0000 |
3943 | @@ -23,24 +23,24 @@ |
3944 | #include "editor/tools/editor_tool.h" |
3945 | |
3946 | /// Decreases the resources of a node by a value. |
3947 | -struct Editor_Decrease_Resources_Tool : public Editor_Tool { |
3948 | - Editor_Decrease_Resources_Tool() |
3949 | - : Editor_Tool(*this, *this), m_cur_res(0), m_change_by(1) |
3950 | +struct EditorDecreaseResourcesTool : public EditorTool { |
3951 | + EditorDecreaseResourcesTool() |
3952 | + : EditorTool(*this, *this), m_cur_res(0), m_change_by(1) |
3953 | {} |
3954 | |
3955 | int32_t handle_click_impl(Widelands::Map& map, |
3956 | const Widelands::World& world, |
3957 | - Widelands::Node_and_Triangle<> center, |
3958 | - Editor_Interactive& parent, |
3959 | - Editor_Action_Args& args) override; |
3960 | + Widelands::NodeAndTriangle<> center, |
3961 | + EditorInteractive& parent, |
3962 | + EditorActionArgs& args) override; |
3963 | |
3964 | int32_t handle_undo_impl(Widelands::Map& map, |
3965 | const Widelands::World& world, |
3966 | - Widelands::Node_and_Triangle<> center, |
3967 | - Editor_Interactive& parent, |
3968 | - Editor_Action_Args& args) override; |
3969 | + Widelands::NodeAndTriangle<> center, |
3970 | + EditorInteractive& parent, |
3971 | + EditorActionArgs& args) override; |
3972 | |
3973 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
3974 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
3975 | |
3976 | char const * get_sel_impl() const override { |
3977 | return "pics/fsel_editor_decrease_resources.png"; |
3978 | @@ -48,13 +48,13 @@ |
3979 | |
3980 | int32_t get_change_by() const {return m_change_by;} |
3981 | void set_change_by(const int32_t n) {m_change_by = n;} |
3982 | - Widelands::Resource_Index get_cur_res() const {return m_cur_res;} |
3983 | - void set_cur_res(Widelands::Resource_Index const res) { |
3984 | + Widelands::ResourceIndex get_cur_res() const {return m_cur_res;} |
3985 | + void set_cur_res(Widelands::ResourceIndex const res) { |
3986 | m_cur_res = res; |
3987 | } |
3988 | |
3989 | private: |
3990 | - Widelands::Resource_Index m_cur_res; |
3991 | + Widelands::ResourceIndex m_cur_res; |
3992 | int32_t m_change_by; |
3993 | }; |
3994 | |
3995 | |
3996 | === modified file 'src/editor/tools/editor_delete_bob_tool.cc' |
3997 | --- src/editor/tools/editor_delete_bob_tool.cc 2014-03-01 17:09:07 +0000 |
3998 | +++ src/editor/tools/editor_delete_bob_tool.cc 2014-09-18 15:54:00 +0000 |
3999 | @@ -28,12 +28,12 @@ |
4000 | * Deletes the bob at the given location |
4001 | */ |
4002 | int32_t |
4003 | -Editor_Delete_Bob_Tool::handle_click_impl(Widelands::Map& map, |
4004 | +EditorDeleteBobTool::handle_click_impl(Widelands::Map& map, |
4005 | const Widelands::World&, |
4006 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4007 | - Editor_Interactive& parent, |
4008 | - Editor_Action_Args& args) { |
4009 | - Widelands::Editor_Game_Base & egbase = parent.egbase(); |
4010 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4011 | + EditorInteractive& parent, |
4012 | + EditorActionArgs& args) { |
4013 | + Widelands::EditorGameBase & egbase = parent.egbase(); |
4014 | const int32_t radius = args.sel_radius; |
4015 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4016 | (map, |
4017 | @@ -51,18 +51,18 @@ |
4018 | } |
4019 | |
4020 | int32_t |
4021 | -Editor_Delete_Bob_Tool::handle_undo_impl(Widelands::Map& map, |
4022 | +EditorDeleteBobTool::handle_undo_impl(Widelands::Map& map, |
4023 | const Widelands::World& world, |
4024 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4025 | - Editor_Interactive& parent, |
4026 | - Editor_Action_Args& args) { |
4027 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4028 | + EditorInteractive& parent, |
4029 | + EditorActionArgs& args) { |
4030 | |
4031 | uint32_t ret = parent.tools.place_bob.handle_undo_impl(map, world, center, parent, args); |
4032 | args.obob_type.clear(); |
4033 | return ret; |
4034 | } |
4035 | |
4036 | -Editor_Action_Args Editor_Delete_Bob_Tool::format_args_impl(Editor_Interactive & parent) |
4037 | +EditorActionArgs EditorDeleteBobTool::format_args_impl(EditorInteractive & parent) |
4038 | { |
4039 | - return Editor_Tool::format_args_impl(parent); |
4040 | + return EditorTool::format_args_impl(parent); |
4041 | } |
4042 | |
4043 | === modified file 'src/editor/tools/editor_delete_bob_tool.h' |
4044 | --- src/editor/tools/editor_delete_bob_tool.h 2014-07-05 16:41:51 +0000 |
4045 | +++ src/editor/tools/editor_delete_bob_tool.h 2014-09-18 15:54:00 +0000 |
4046 | @@ -23,22 +23,22 @@ |
4047 | #include "editor/tools/editor_tool.h" |
4048 | |
4049 | /// Deletes bob from the map. |
4050 | -struct Editor_Delete_Bob_Tool : public Editor_Tool { |
4051 | - Editor_Delete_Bob_Tool() : Editor_Tool(*this, *this) {} |
4052 | +struct EditorDeleteBobTool : public EditorTool { |
4053 | + EditorDeleteBobTool() : EditorTool(*this, *this) {} |
4054 | |
4055 | int32_t handle_click_impl(Widelands::Map& map, |
4056 | const Widelands::World& world, |
4057 | - Widelands::Node_and_Triangle<> center, |
4058 | - Editor_Interactive& parent, |
4059 | - Editor_Action_Args& args) override; |
4060 | + Widelands::NodeAndTriangle<> center, |
4061 | + EditorInteractive& parent, |
4062 | + EditorActionArgs& args) override; |
4063 | |
4064 | int32_t handle_undo_impl(Widelands::Map& map, |
4065 | const Widelands::World& world, |
4066 | - Widelands::Node_and_Triangle<> center, |
4067 | - Editor_Interactive& parent, |
4068 | - Editor_Action_Args& args) override; |
4069 | + Widelands::NodeAndTriangle<> center, |
4070 | + EditorInteractive& parent, |
4071 | + EditorActionArgs& args) override; |
4072 | |
4073 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4074 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4075 | |
4076 | char const * get_sel_impl() const override { |
4077 | return "pics/fsel_editor_delete.png"; |
4078 | |
4079 | === modified file 'src/editor/tools/editor_delete_immovable_tool.cc' |
4080 | --- src/editor/tools/editor_delete_immovable_tool.cc 2014-07-03 19:26:30 +0000 |
4081 | +++ src/editor/tools/editor_delete_immovable_tool.cc 2014-09-18 15:54:00 +0000 |
4082 | @@ -28,12 +28,12 @@ |
4083 | /** |
4084 | * Deletes the immovable at the given location |
4085 | */ |
4086 | -int32_t Editor_Delete_Immovable_Tool::handle_click_impl(Widelands::Map& map, |
4087 | +int32_t EditorDeleteImmovableTool::handle_click_impl(Widelands::Map& map, |
4088 | const Widelands::World&, |
4089 | - Widelands::Node_and_Triangle<> const center, |
4090 | - Editor_Interactive& parent, |
4091 | - Editor_Action_Args& args) { |
4092 | - Widelands::Editor_Game_Base & egbase = parent.egbase(); |
4093 | + Widelands::NodeAndTriangle<> const center, |
4094 | + EditorInteractive& parent, |
4095 | + EditorActionArgs& args) { |
4096 | + Widelands::EditorGameBase & egbase = parent.egbase(); |
4097 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4098 | (map, |
4099 | Widelands::Area<Widelands::FCoords> |
4100 | @@ -53,16 +53,16 @@ |
4101 | return mr.radius() + 2; |
4102 | } |
4103 | |
4104 | -int32_t Editor_Delete_Immovable_Tool::handle_undo_impl( |
4105 | +int32_t EditorDeleteImmovableTool::handle_undo_impl( |
4106 | Widelands::Map& map, |
4107 | const Widelands::World& world, |
4108 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4109 | - Editor_Interactive& parent, |
4110 | - Editor_Action_Args& args) { |
4111 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4112 | + EditorInteractive& parent, |
4113 | + EditorActionArgs& args) { |
4114 | return parent.tools.place_immovable.handle_undo_impl(map, world, center, parent, args); |
4115 | } |
4116 | |
4117 | -Editor_Action_Args Editor_Delete_Immovable_Tool::format_args_impl(Editor_Interactive & parent) |
4118 | +EditorActionArgs EditorDeleteImmovableTool::format_args_impl(EditorInteractive & parent) |
4119 | { |
4120 | - return Editor_Tool::format_args_impl(parent); |
4121 | + return EditorTool::format_args_impl(parent); |
4122 | } |
4123 | |
4124 | === modified file 'src/editor/tools/editor_delete_immovable_tool.h' |
4125 | --- src/editor/tools/editor_delete_immovable_tool.h 2014-07-05 16:41:51 +0000 |
4126 | +++ src/editor/tools/editor_delete_immovable_tool.h 2014-09-18 15:54:00 +0000 |
4127 | @@ -23,22 +23,22 @@ |
4128 | #include "editor/tools/editor_tool.h" |
4129 | |
4130 | /// Deletes immovables from the map. |
4131 | -struct Editor_Delete_Immovable_Tool : public Editor_Tool { |
4132 | - Editor_Delete_Immovable_Tool() : Editor_Tool(*this, *this) {} |
4133 | +struct EditorDeleteImmovableTool : public EditorTool { |
4134 | + EditorDeleteImmovableTool() : EditorTool(*this, *this) {} |
4135 | |
4136 | int32_t handle_click_impl(Widelands::Map& map, |
4137 | const Widelands::World& world, |
4138 | - Widelands::Node_and_Triangle<> center, |
4139 | - Editor_Interactive& parent, |
4140 | - Editor_Action_Args& args) override; |
4141 | + Widelands::NodeAndTriangle<> center, |
4142 | + EditorInteractive& parent, |
4143 | + EditorActionArgs& args) override; |
4144 | |
4145 | int32_t handle_undo_impl(Widelands::Map& map, |
4146 | const Widelands::World& world, |
4147 | - Widelands::Node_and_Triangle<> center, |
4148 | - Editor_Interactive& parent, |
4149 | - Editor_Action_Args& args) override; |
4150 | + Widelands::NodeAndTriangle<> center, |
4151 | + EditorInteractive& parent, |
4152 | + EditorActionArgs& args) override; |
4153 | |
4154 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4155 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4156 | |
4157 | char const * get_sel_impl() const override { |
4158 | return "pics/fsel_editor_delete.png"; |
4159 | |
4160 | === modified file 'src/editor/tools/editor_draw_tool.cc' |
4161 | --- src/editor/tools/editor_draw_tool.cc 2014-07-23 14:49:10 +0000 |
4162 | +++ src/editor/tools/editor_draw_tool.cc 2014-09-18 15:54:00 +0000 |
4163 | @@ -27,50 +27,50 @@ |
4164 | // TODO(unknown): Saving every action in a list isn't very efficient. |
4165 | // A long list can take several seconds to undo/redo every action. |
4166 | // If someone has a better idea how to do this, implement it! |
4167 | -void Editor_Draw_Tool::add_action |
4168 | -(Editor_Tool_Action ac, Editor_Action_Args & args) |
4169 | +void EditorDrawTool::add_action |
4170 | +(EditorToolAction ac, EditorActionArgs & args) |
4171 | { |
4172 | - args.draw_actions.push_back(new Editor_Tool_Action(ac)); |
4173 | + args.draw_actions.push_back(new EditorToolAction(ac)); |
4174 | } |
4175 | |
4176 | int32_t |
4177 | -Editor_Draw_Tool::handle_click_impl(Widelands::Map& /* map */, |
4178 | +EditorDrawTool::handle_click_impl(Widelands::Map& /* map */, |
4179 | const Widelands::World& world, |
4180 | - Widelands::Node_and_Triangle<Widelands::Coords> /* center */, |
4181 | - Editor_Interactive& /* parent */, |
4182 | - Editor_Action_Args& args) { |
4183 | + Widelands::NodeAndTriangle<Widelands::Coords> /* center */, |
4184 | + EditorInteractive& /* parent */, |
4185 | + EditorActionArgs& args) { |
4186 | |
4187 | for |
4188 | - (std::list<Editor_Tool_Action *>::iterator i = args.draw_actions.begin(); |
4189 | + (std::list<EditorToolAction *>::iterator i = args.draw_actions.begin(); |
4190 | i != args.draw_actions.end(); |
4191 | ++i) |
4192 | { |
4193 | (*i)->tool.handle_click |
4194 | - (static_cast<Editor_Tool::Tool_Index>((*i)->i), |
4195 | + (static_cast<EditorTool::ToolIndex>((*i)->i), |
4196 | (*i)->map, world, (*i)->center, (*i)->parent, *((*i)->args)); |
4197 | } |
4198 | return args.draw_actions.size(); |
4199 | } |
4200 | |
4201 | int32_t |
4202 | -Editor_Draw_Tool::handle_undo_impl(Widelands::Map& /* map */, |
4203 | +EditorDrawTool::handle_undo_impl(Widelands::Map& /* map */, |
4204 | const Widelands::World& world, |
4205 | - Widelands::Node_and_Triangle<Widelands::Coords> /* center */, |
4206 | - Editor_Interactive& /* parent */, |
4207 | - Editor_Action_Args& args) { |
4208 | + Widelands::NodeAndTriangle<Widelands::Coords> /* center */, |
4209 | + EditorInteractive& /* parent */, |
4210 | + EditorActionArgs& args) { |
4211 | for |
4212 | - (std::list<Editor_Tool_Action *>::reverse_iterator i = args.draw_actions.rbegin(); |
4213 | + (std::list<EditorToolAction *>::reverse_iterator i = args.draw_actions.rbegin(); |
4214 | i != args.draw_actions.rend(); |
4215 | ++i) |
4216 | { |
4217 | (*i)->tool.handle_undo |
4218 | - (static_cast<Editor_Tool::Tool_Index>((*i)->i), |
4219 | + (static_cast<EditorTool::ToolIndex>((*i)->i), |
4220 | (*i)->map, world, (*i)->center, (*i)->parent, *((*i)->args)); |
4221 | } |
4222 | return args.draw_actions.size(); |
4223 | } |
4224 | |
4225 | -Editor_Action_Args Editor_Draw_Tool::format_args_impl(Editor_Interactive & parent) |
4226 | +EditorActionArgs EditorDrawTool::format_args_impl(EditorInteractive & parent) |
4227 | { |
4228 | - return Editor_Tool::format_args_impl(parent); |
4229 | + return EditorTool::format_args_impl(parent); |
4230 | } |
4231 | |
4232 | === modified file 'src/editor/tools/editor_draw_tool.h' |
4233 | --- src/editor/tools/editor_draw_tool.h 2014-07-05 16:41:51 +0000 |
4234 | +++ src/editor/tools/editor_draw_tool.h 2014-09-18 15:54:00 +0000 |
4235 | @@ -25,28 +25,28 @@ |
4236 | |
4237 | /// This is not a real editor tool. It serves to combine 'hold down mouse and move' |
4238 | /// tool actions in one class. |
4239 | -struct Editor_Draw_Tool : public Editor_Tool { |
4240 | - Editor_Draw_Tool() : Editor_Tool(*this, *this) {} |
4241 | +struct EditorDrawTool : public EditorTool { |
4242 | + EditorDrawTool() : EditorTool(*this, *this) {} |
4243 | |
4244 | int32_t handle_click_impl(Widelands::Map& map, |
4245 | const Widelands::World& world, |
4246 | - Widelands::Node_and_Triangle<> center, |
4247 | - Editor_Interactive& parent, |
4248 | - Editor_Action_Args& args) override; |
4249 | + Widelands::NodeAndTriangle<> center, |
4250 | + EditorInteractive& parent, |
4251 | + EditorActionArgs& args) override; |
4252 | |
4253 | int32_t handle_undo_impl(Widelands::Map& map, |
4254 | const Widelands::World& world, |
4255 | - Widelands::Node_and_Triangle<> center, |
4256 | - Editor_Interactive& parent, |
4257 | - Editor_Action_Args& args) override; |
4258 | + Widelands::NodeAndTriangle<> center, |
4259 | + EditorInteractive& parent, |
4260 | + EditorActionArgs& args) override; |
4261 | |
4262 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4263 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4264 | |
4265 | char const * get_sel_impl() const override { |
4266 | return "EDITOR_DRAW_TOOL"; |
4267 | } |
4268 | |
4269 | - void add_action(Editor_Tool_Action ac, Editor_Action_Args & args); |
4270 | + void add_action(EditorToolAction ac, EditorActionArgs & args); |
4271 | |
4272 | }; |
4273 | |
4274 | |
4275 | === modified file 'src/editor/tools/editor_history.cc' |
4276 | --- src/editor/tools/editor_history.cc 2014-07-20 07:43:07 +0000 |
4277 | +++ src/editor/tools/editor_history.cc 2014-09-18 15:54:00 +0000 |
4278 | @@ -25,9 +25,9 @@ |
4279 | #include "editor/tools/editor_action_args.h" |
4280 | #include "editor/tools/editor_tool_action.h" |
4281 | |
4282 | -// === Editor_Action_Args === // |
4283 | +// === EditorActionArgs === // |
4284 | |
4285 | -Editor_Action_Args::Editor_Action_Args(Editor_Interactive & base): |
4286 | +EditorActionArgs::EditorActionArgs(EditorInteractive & base): |
4287 | sel_radius(base.get_sel_radius()), |
4288 | change_by(0), |
4289 | cur_res(0), |
4290 | @@ -36,7 +36,7 @@ |
4291 | refcount(0) |
4292 | {} |
4293 | |
4294 | -Editor_Action_Args::~Editor_Action_Args() |
4295 | +EditorActionArgs::~EditorActionArgs() |
4296 | { |
4297 | while (!draw_actions.empty()) { |
4298 | delete draw_actions.back(); |
4299 | @@ -53,20 +53,20 @@ |
4300 | terrainType.clear(); |
4301 | } |
4302 | |
4303 | -// === Editor_History === // |
4304 | +// === EditorHistory === // |
4305 | |
4306 | -uint32_t Editor_History::undo_action(const Widelands::World& world) { |
4307 | +uint32_t EditorHistory::undo_action(const Widelands::World& world) { |
4308 | if (undo_stack.empty()) |
4309 | return 0; |
4310 | |
4311 | - Editor_Tool_Action uac = undo_stack.front(); |
4312 | + EditorToolAction uac = undo_stack.front(); |
4313 | undo_stack.pop_front(); |
4314 | redo_stack.push_front(uac); |
4315 | |
4316 | m_undo_button.set_enabled(!undo_stack.empty()); |
4317 | m_redo_button.set_enabled(true); |
4318 | |
4319 | - return uac.tool.handle_undo(static_cast<Editor_Tool::Tool_Index>(uac.i), |
4320 | + return uac.tool.handle_undo(static_cast<EditorTool::ToolIndex>(uac.i), |
4321 | uac.map, |
4322 | world, |
4323 | uac.center, |
4324 | @@ -74,18 +74,18 @@ |
4325 | *uac.args); |
4326 | } |
4327 | |
4328 | -uint32_t Editor_History::redo_action(const Widelands::World& world) { |
4329 | +uint32_t EditorHistory::redo_action(const Widelands::World& world) { |
4330 | if (redo_stack.empty()) |
4331 | return 0; |
4332 | |
4333 | - Editor_Tool_Action rac = redo_stack.front(); |
4334 | + EditorToolAction rac = redo_stack.front(); |
4335 | redo_stack.pop_front(); |
4336 | undo_stack.push_front(rac); |
4337 | |
4338 | m_undo_button.set_enabled(true); |
4339 | m_redo_button.set_enabled(!redo_stack.empty()); |
4340 | |
4341 | - return rac.tool.handle_click(static_cast<Editor_Tool::Tool_Index>(rac.i), |
4342 | + return rac.tool.handle_click(static_cast<EditorTool::ToolIndex>(rac.i), |
4343 | rac.map, |
4344 | world, |
4345 | rac.center, |
4346 | @@ -93,14 +93,14 @@ |
4347 | *rac.args); |
4348 | } |
4349 | |
4350 | -uint32_t Editor_History::do_action(Editor_Tool& tool, |
4351 | - Editor_Tool::Tool_Index ind, |
4352 | +uint32_t EditorHistory::do_action(EditorTool& tool, |
4353 | + EditorTool::ToolIndex ind, |
4354 | Widelands::Map& map, |
4355 | const Widelands::World& world, |
4356 | - const Widelands::Node_and_Triangle<Widelands::Coords> center, |
4357 | - Editor_Interactive& parent, |
4358 | + const Widelands::NodeAndTriangle<Widelands::Coords> center, |
4359 | + EditorInteractive& parent, |
4360 | bool draw) { |
4361 | - Editor_Tool_Action ac |
4362 | + EditorToolAction ac |
4363 | (tool, static_cast<uint32_t>(ind), |
4364 | map, center, parent, tool.format_args(ind, parent)); |
4365 | if (draw && tool.is_unduable()) { |
4366 | @@ -108,10 +108,10 @@ |
4367 | (undo_stack.empty() || |
4368 | undo_stack.front().tool.get_sel_impl() != std::string(m_draw_tool.get_sel_impl())) |
4369 | { |
4370 | - Editor_Tool_Action da |
4371 | - (m_draw_tool, Editor_Tool::First, |
4372 | + EditorToolAction da |
4373 | + (m_draw_tool, EditorTool::First, |
4374 | map, center, parent, |
4375 | - m_draw_tool.format_args(Editor_Tool::First, parent)); |
4376 | + m_draw_tool.format_args(EditorTool::First, parent)); |
4377 | |
4378 | if (!undo_stack.empty()) { |
4379 | m_draw_tool.add_action(undo_stack.front(), *da.args); |
4380 | @@ -123,7 +123,7 @@ |
4381 | m_undo_button.set_enabled(true); |
4382 | m_redo_button.set_enabled(false); |
4383 | } |
4384 | - dynamic_cast<Editor_Draw_Tool *> |
4385 | + dynamic_cast<EditorDrawTool *> |
4386 | (&(undo_stack.front().tool))->add_action(ac, *undo_stack.front().args); |
4387 | } else if (tool.is_unduable()) { |
4388 | redo_stack.clear(); |
4389 | @@ -135,7 +135,7 @@ |
4390 | } |
4391 | |
4392 | |
4393 | -void Editor_History::reset() |
4394 | +void EditorHistory::reset() |
4395 | { |
4396 | undo_stack.clear(); |
4397 | redo_stack.clear(); |
4398 | |
4399 | === modified file 'src/editor/tools/editor_history.h' |
4400 | --- src/editor/tools/editor_history.h 2014-07-05 16:41:51 +0000 |
4401 | +++ src/editor/tools/editor_history.h 2014-09-18 15:54:00 +0000 |
4402 | @@ -25,8 +25,8 @@ |
4403 | #include "editor/tools/editor_draw_tool.h" |
4404 | #include "editor/tools/editor_tool.h" |
4405 | |
4406 | -//struct Editor_Action_Args; |
4407 | -struct Editor_Interactive; |
4408 | +//struct EditorActionArgs; |
4409 | +struct EditorInteractive; |
4410 | namespace UI {struct Button;} |
4411 | |
4412 | /** |
4413 | @@ -34,17 +34,17 @@ |
4414 | * provide undo / redo functionality. |
4415 | * Do all tool action you want to make "undoable" using this class. |
4416 | */ |
4417 | -struct Editor_History { |
4418 | +struct EditorHistory { |
4419 | |
4420 | - Editor_History(UI::Button & undo, UI::Button & redo): |
4421 | + EditorHistory(UI::Button & undo, UI::Button & redo): |
4422 | m_undo_button(undo), m_redo_button(redo) {} |
4423 | |
4424 | - uint32_t do_action(Editor_Tool& tool, |
4425 | - Editor_Tool::Tool_Index ind, |
4426 | + uint32_t do_action(EditorTool& tool, |
4427 | + EditorTool::ToolIndex ind, |
4428 | Widelands::Map& map, |
4429 | const Widelands::World& world, |
4430 | - Widelands::Node_and_Triangle<> const center, |
4431 | - Editor_Interactive& parent, |
4432 | + Widelands::NodeAndTriangle<> const center, |
4433 | + EditorInteractive& parent, |
4434 | bool draw = false); |
4435 | uint32_t undo_action(const Widelands::World& world); |
4436 | uint32_t redo_action(const Widelands::World& world); |
4437 | @@ -57,10 +57,10 @@ |
4438 | UI::Button & m_undo_button; |
4439 | UI::Button & m_redo_button; |
4440 | |
4441 | - Editor_Draw_Tool m_draw_tool; |
4442 | + EditorDrawTool m_draw_tool; |
4443 | |
4444 | - std::deque<Editor_Tool_Action> undo_stack; |
4445 | - std::deque<Editor_Tool_Action> redo_stack; |
4446 | + std::deque<EditorToolAction> undo_stack; |
4447 | + std::deque<EditorToolAction> redo_stack; |
4448 | |
4449 | }; |
4450 | |
4451 | |
4452 | === modified file 'src/editor/tools/editor_increase_height_tool.cc' |
4453 | --- src/editor/tools/editor_increase_height_tool.cc 2014-03-01 17:09:07 +0000 |
4454 | +++ src/editor/tools/editor_increase_height_tool.cc 2014-09-18 15:54:00 +0000 |
4455 | @@ -25,11 +25,11 @@ |
4456 | #include "logic/mapregion.h" |
4457 | |
4458 | /// Increases the heights by a value. Chages surrounding nodes if necessary. |
4459 | -int32_t Editor_Increase_Height_Tool::handle_click_impl(Widelands::Map& map, |
4460 | +int32_t EditorIncreaseHeightTool::handle_click_impl(Widelands::Map& map, |
4461 | const Widelands::World& world, |
4462 | - Widelands::Node_and_Triangle<> center, |
4463 | - Editor_Interactive& /* parent */, |
4464 | - Editor_Action_Args& args) { |
4465 | + Widelands::NodeAndTriangle<> center, |
4466 | + EditorInteractive& /* parent */, |
4467 | + EditorActionArgs& args) { |
4468 | if (args.origHights.empty()) { |
4469 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords>> mr( |
4470 | map, |
4471 | @@ -47,17 +47,17 @@ |
4472 | args.change_by); |
4473 | } |
4474 | |
4475 | -int32_t Editor_Increase_Height_Tool::handle_undo_impl(Widelands::Map& map, |
4476 | +int32_t EditorIncreaseHeightTool::handle_undo_impl(Widelands::Map& map, |
4477 | const Widelands::World& world, |
4478 | - Widelands::Node_and_Triangle<> center, |
4479 | - Editor_Interactive& parent, |
4480 | - Editor_Action_Args& args) { |
4481 | + Widelands::NodeAndTriangle<> center, |
4482 | + EditorInteractive& parent, |
4483 | + EditorActionArgs& args) { |
4484 | return m_decrease_tool.handle_undo_impl(map, world, center, parent, args); |
4485 | } |
4486 | |
4487 | -Editor_Action_Args Editor_Increase_Height_Tool::format_args_impl(Editor_Interactive & parent) |
4488 | +EditorActionArgs EditorIncreaseHeightTool::format_args_impl(EditorInteractive & parent) |
4489 | { |
4490 | - Editor_Action_Args a(parent); |
4491 | + EditorActionArgs a(parent); |
4492 | a.change_by = m_change_by; |
4493 | return a; |
4494 | } |
4495 | |
4496 | === modified file 'src/editor/tools/editor_increase_height_tool.h' |
4497 | --- src/editor/tools/editor_increase_height_tool.h 2014-07-05 16:41:51 +0000 |
4498 | +++ src/editor/tools/editor_increase_height_tool.h 2014-09-18 15:54:00 +0000 |
4499 | @@ -24,29 +24,29 @@ |
4500 | #include "editor/tools/editor_set_height_tool.h" |
4501 | |
4502 | /// Increases the height of a field by a value. |
4503 | -struct Editor_Increase_Height_Tool : public Editor_Tool { |
4504 | - Editor_Increase_Height_Tool |
4505 | - (Editor_Decrease_Height_Tool & the_decrease_tool, |
4506 | - Editor_Set_Height_Tool & the_set_tool) |
4507 | +struct EditorIncreaseHeightTool : public EditorTool { |
4508 | + EditorIncreaseHeightTool |
4509 | + (EditorDecreaseHeightTool & the_decrease_tool, |
4510 | + EditorSetHeightTool & the_set_tool) |
4511 | : |
4512 | - Editor_Tool(the_decrease_tool, the_set_tool), |
4513 | + EditorTool(the_decrease_tool, the_set_tool), |
4514 | m_decrease_tool(the_decrease_tool), m_set_tool(the_set_tool), |
4515 | m_change_by(1) |
4516 | {} |
4517 | |
4518 | int32_t handle_click_impl(Widelands::Map& map, |
4519 | const Widelands::World& world, |
4520 | - Widelands::Node_and_Triangle<> center, |
4521 | - Editor_Interactive& parent, |
4522 | - Editor_Action_Args& args) override; |
4523 | + Widelands::NodeAndTriangle<> center, |
4524 | + EditorInteractive& parent, |
4525 | + EditorActionArgs& args) override; |
4526 | |
4527 | int32_t handle_undo_impl(Widelands::Map& map, |
4528 | const Widelands::World& world, |
4529 | - Widelands::Node_and_Triangle<> center, |
4530 | - Editor_Interactive& parent, |
4531 | - Editor_Action_Args& args) override; |
4532 | + Widelands::NodeAndTriangle<> center, |
4533 | + EditorInteractive& parent, |
4534 | + EditorActionArgs& args) override; |
4535 | |
4536 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4537 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4538 | |
4539 | char const * get_sel_impl() const override { |
4540 | return "pics/fsel_editor_increase_height.png"; |
4541 | @@ -55,14 +55,14 @@ |
4542 | int32_t get_change_by() const {return m_change_by;} |
4543 | void set_change_by(const int32_t n) {m_change_by = n;} |
4544 | |
4545 | - Editor_Decrease_Height_Tool & decrease_tool() const { |
4546 | + EditorDecreaseHeightTool & decrease_tool() const { |
4547 | return m_decrease_tool; |
4548 | } |
4549 | - Editor_Set_Height_Tool & set_tool() const {return m_set_tool;} |
4550 | + EditorSetHeightTool & set_tool() const {return m_set_tool;} |
4551 | |
4552 | private: |
4553 | - Editor_Decrease_Height_Tool & m_decrease_tool; |
4554 | - Editor_Set_Height_Tool & m_set_tool; |
4555 | + EditorDecreaseHeightTool & m_decrease_tool; |
4556 | + EditorSetHeightTool & m_set_tool; |
4557 | int32_t m_change_by; |
4558 | }; |
4559 | |
4560 | |
4561 | === modified file 'src/editor/tools/editor_increase_resources_tool.cc' |
4562 | --- src/editor/tools/editor_increase_resources_tool.cc 2014-07-20 07:43:07 +0000 |
4563 | +++ src/editor/tools/editor_increase_resources_tool.cc 2014-09-18 15:54:00 +0000 |
4564 | @@ -33,7 +33,7 @@ |
4565 | namespace { |
4566 | |
4567 | int32_t resource_value(const Widelands::TerrainDescription& terrain, |
4568 | - const Widelands::Resource_Index resource) { |
4569 | + const Widelands::ResourceIndex resource) { |
4570 | if (!terrain.is_resource_valid(resource)) { |
4571 | return -1; |
4572 | } |
4573 | @@ -78,18 +78,18 @@ |
4574 | |
4575 | /* |
4576 | =========== |
4577 | -Editor_Increase_Resources_Tool::handle_click_impl() |
4578 | +EditorIncreaseResourcesTool::handle_click_impl() |
4579 | |
4580 | increase the resources of the current field by one if |
4581 | there is not already another resource there. |
4582 | =========== |
4583 | */ |
4584 | int32_t |
4585 | -Editor_Increase_Resources_Tool::handle_click_impl(Widelands::Map& map, |
4586 | +EditorIncreaseResourcesTool::handle_click_impl(Widelands::Map& map, |
4587 | const Widelands::World& world, |
4588 | - Widelands::Node_and_Triangle<> const center, |
4589 | - Editor_Interactive& /* parent */, |
4590 | - Editor_Action_Args& args) { |
4591 | + Widelands::NodeAndTriangle<> const center, |
4592 | + EditorInteractive& /* parent */, |
4593 | + EditorActionArgs& args) { |
4594 | OverlayManager & overlay_manager = map.overlay_manager(); |
4595 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4596 | (map, |
4597 | @@ -137,18 +137,18 @@ |
4598 | return mr.radius(); |
4599 | } |
4600 | |
4601 | -int32_t Editor_Increase_Resources_Tool::handle_undo_impl( |
4602 | +int32_t EditorIncreaseResourcesTool::handle_undo_impl( |
4603 | Widelands::Map& map, |
4604 | const Widelands::World& world, |
4605 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4606 | - Editor_Interactive& parent, |
4607 | - Editor_Action_Args& args) { |
4608 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4609 | + EditorInteractive& parent, |
4610 | + EditorActionArgs& args) { |
4611 | return m_set_tool.handle_undo_impl(map, world, center, parent, args); |
4612 | } |
4613 | |
4614 | -Editor_Action_Args Editor_Increase_Resources_Tool::format_args_impl(Editor_Interactive & parent) |
4615 | +EditorActionArgs EditorIncreaseResourcesTool::format_args_impl(EditorInteractive & parent) |
4616 | { |
4617 | - Editor_Action_Args a(parent); |
4618 | + EditorActionArgs a(parent); |
4619 | a.change_by = m_change_by; |
4620 | a.cur_res = m_cur_res; |
4621 | return a; |
4622 | |
4623 | === modified file 'src/editor/tools/editor_increase_resources_tool.h' |
4624 | --- src/editor/tools/editor_increase_resources_tool.h 2014-07-05 16:41:51 +0000 |
4625 | +++ src/editor/tools/editor_increase_resources_tool.h 2014-09-18 15:54:00 +0000 |
4626 | @@ -25,10 +25,10 @@ |
4627 | #include "logic/widelands_geometry.h" |
4628 | |
4629 | /// Increases the resources of a node by a value. |
4630 | -struct Editor_Increase_Resources_Tool : public Editor_Tool { |
4631 | - Editor_Increase_Resources_Tool(Editor_Decrease_Resources_Tool& the_decrease_tool, |
4632 | - Editor_Set_Resources_Tool& the_set_to_tool) |
4633 | - : Editor_Tool(the_decrease_tool, the_set_to_tool), |
4634 | +struct EditorIncreaseResourcesTool : public EditorTool { |
4635 | + EditorIncreaseResourcesTool(EditorDecreaseResourcesTool& the_decrease_tool, |
4636 | + EditorSetResourcesTool& the_set_to_tool) |
4637 | + : EditorTool(the_decrease_tool, the_set_to_tool), |
4638 | m_decrease_tool(the_decrease_tool), |
4639 | m_set_tool(the_set_to_tool), |
4640 | m_change_by(1), |
4641 | @@ -37,17 +37,17 @@ |
4642 | |
4643 | int32_t handle_click_impl(Widelands::Map& map, |
4644 | const Widelands::World& world, |
4645 | - Widelands::Node_and_Triangle<> center, |
4646 | - Editor_Interactive& parent, |
4647 | - Editor_Action_Args& args) override; |
4648 | + Widelands::NodeAndTriangle<> center, |
4649 | + EditorInteractive& parent, |
4650 | + EditorActionArgs& args) override; |
4651 | |
4652 | int32_t handle_undo_impl(Widelands::Map& map, |
4653 | const Widelands::World& world, |
4654 | - Widelands::Node_and_Triangle<> center, |
4655 | - Editor_Interactive& parent, |
4656 | - Editor_Action_Args& args) override; |
4657 | + Widelands::NodeAndTriangle<> center, |
4658 | + EditorInteractive& parent, |
4659 | + EditorActionArgs& args) override; |
4660 | |
4661 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4662 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4663 | |
4664 | char const * get_sel_impl() const override { |
4665 | return "pics/fsel_editor_increase_resources.png"; |
4666 | @@ -55,21 +55,21 @@ |
4667 | |
4668 | int32_t get_change_by() const {return m_change_by;} |
4669 | void set_change_by(const int32_t n) {m_change_by = n;} |
4670 | - Widelands::Resource_Index get_cur_res() const {return m_cur_res;} |
4671 | - void set_cur_res(Widelands::Resource_Index const res) { |
4672 | + Widelands::ResourceIndex get_cur_res() const {return m_cur_res;} |
4673 | + void set_cur_res(Widelands::ResourceIndex const res) { |
4674 | m_cur_res = res; |
4675 | } |
4676 | |
4677 | - Editor_Decrease_Resources_Tool & decrease_tool() const { |
4678 | + EditorDecreaseResourcesTool & decrease_tool() const { |
4679 | return m_decrease_tool; |
4680 | } |
4681 | - Editor_Set_Resources_Tool & set_tool() const {return m_set_tool;} |
4682 | + EditorSetResourcesTool & set_tool() const {return m_set_tool;} |
4683 | |
4684 | private: |
4685 | - Editor_Decrease_Resources_Tool & m_decrease_tool; |
4686 | - Editor_Set_Resources_Tool& m_set_tool; |
4687 | + EditorDecreaseResourcesTool & m_decrease_tool; |
4688 | + EditorSetResourcesTool& m_set_tool; |
4689 | int32_t m_change_by; |
4690 | - Widelands::Resource_Index m_cur_res; |
4691 | + Widelands::ResourceIndex m_cur_res; |
4692 | }; |
4693 | |
4694 | int32_t Editor_Change_Resource_Tool_Callback |
4695 | |
4696 | === modified file 'src/editor/tools/editor_info_tool.cc' |
4697 | --- src/editor/tools/editor_info_tool.cc 2014-07-14 10:45:44 +0000 |
4698 | +++ src/editor/tools/editor_info_tool.cc 2014-09-18 15:54:00 +0000 |
4699 | @@ -32,17 +32,17 @@ |
4700 | #include "ui_basic/window.h" |
4701 | |
4702 | /// Show a window with information about the pointed at node and triangle. |
4703 | -int32_t Editor_Info_Tool::handle_click_impl(Widelands::Map& map, |
4704 | +int32_t EditorInfoTool::handle_click_impl(Widelands::Map& map, |
4705 | const Widelands::World& world, |
4706 | - Widelands::Node_and_Triangle<> center, |
4707 | - Editor_Interactive& parent, |
4708 | - Editor_Action_Args& /* args */) { |
4709 | + Widelands::NodeAndTriangle<> center, |
4710 | + EditorInteractive& parent, |
4711 | + EditorActionArgs& /* args */) { |
4712 | UI::Window * const w = |
4713 | new UI::Window |
4714 | (&parent, "field_information", 30, 30, 400, 200, |
4715 | _("Field Information")); |
4716 | - UI::Multiline_Textarea * const multiline_textarea = |
4717 | - new UI::Multiline_Textarea |
4718 | + UI::MultilineTextarea * const multiline_textarea = |
4719 | + new UI::MultilineTextarea |
4720 | (w, 0, 0, w->get_inner_w(), w->get_inner_h()); |
4721 | |
4722 | Widelands::Field & f = map[center.node]; |
4723 | @@ -105,7 +105,7 @@ |
4724 | // *** Resources info |
4725 | buf += std::string("\n") + _("Resources:") + "\n"; |
4726 | |
4727 | - Widelands::Resource_Index ridx = f.get_resources(); |
4728 | + Widelands::ResourceIndex ridx = f.get_resources(); |
4729 | int ramount = f.get_resources_amount(); |
4730 | |
4731 | if (ramount > 0) { |
4732 | |
4733 | === modified file 'src/editor/tools/editor_info_tool.h' |
4734 | --- src/editor/tools/editor_info_tool.h 2014-07-05 16:41:51 +0000 |
4735 | +++ src/editor/tools/editor_info_tool.h 2014-09-18 15:54:00 +0000 |
4736 | @@ -23,15 +23,15 @@ |
4737 | #include "editor/tools/editor_tool.h" |
4738 | |
4739 | /// A simple tool to show information about the clicked node. |
4740 | -struct Editor_Info_Tool : public Editor_Tool { |
4741 | - Editor_Info_Tool() : Editor_Tool(*this, *this, false) { |
4742 | +struct EditorInfoTool : public EditorTool { |
4743 | + EditorInfoTool() : EditorTool(*this, *this, false) { |
4744 | } |
4745 | |
4746 | int32_t handle_click_impl(Widelands::Map& map, |
4747 | const Widelands::World& world, |
4748 | - Widelands::Node_and_Triangle<> center, |
4749 | - Editor_Interactive& parent, |
4750 | - Editor_Action_Args& args) override; |
4751 | + Widelands::NodeAndTriangle<> center, |
4752 | + EditorInteractive& parent, |
4753 | + EditorActionArgs& args) override; |
4754 | |
4755 | char const* get_sel_impl() const override { |
4756 | return "pics/fsel_editor_info.png"; |
4757 | |
4758 | === modified file 'src/editor/tools/editor_make_infrastructure_tool.cc' |
4759 | --- src/editor/tools/editor_make_infrastructure_tool.cc 2014-03-09 19:29:08 +0000 |
4760 | +++ src/editor/tools/editor_make_infrastructure_tool.cc 2014-09-18 15:54:00 +0000 |
4761 | @@ -33,7 +33,7 @@ |
4762 | int32_t |
4763 | Editor_Make_Infrastructure_Tool_Callback |
4764 | (const Widelands::TCoords<Widelands::FCoords>& c, |
4765 | - Widelands::Editor_Game_Base& egbase, |
4766 | + Widelands::EditorGameBase& egbase, |
4767 | int32_t const player) |
4768 | { |
4769 | return egbase.player(player).get_buildcaps(c); |
4770 | @@ -46,11 +46,11 @@ |
4771 | * |
4772 | * Obviously, this function ignores the sel radius |
4773 | */ |
4774 | -int32_t Editor_Make_Infrastructure_Tool::handle_click_impl(Widelands::Map&, |
4775 | +int32_t EditorMakeInfrastructureTool::handle_click_impl(Widelands::Map&, |
4776 | const Widelands::World&, |
4777 | - Widelands::Node_and_Triangle<> const, |
4778 | - Editor_Interactive& parent, |
4779 | - Editor_Action_Args& /* args */) { |
4780 | + Widelands::NodeAndTriangle<> const, |
4781 | + EditorInteractive& parent, |
4782 | + EditorActionArgs& /* args */) { |
4783 | show_field_action |
4784 | (&parent, parent.egbase().get_player(m_player), &m_registry); |
4785 | |
4786 | |
4787 | === modified file 'src/editor/tools/editor_make_infrastructure_tool.h' |
4788 | --- src/editor/tools/editor_make_infrastructure_tool.h 2014-07-23 14:49:10 +0000 |
4789 | +++ src/editor/tools/editor_make_infrastructure_tool.h 2014-09-18 15:54:00 +0000 |
4790 | @@ -24,37 +24,37 @@ |
4791 | #include "ui_basic/unique_window.h" |
4792 | |
4793 | namespace Widelands { |
4794 | -class Editor_Game_Base; |
4795 | +class EditorGameBase; |
4796 | } // namespace Widelands |
4797 | |
4798 | /** |
4799 | * This places immovables on the map |
4800 | */ |
4801 | // TODO(unknown): Implement undo for this tool |
4802 | -struct Editor_Make_Infrastructure_Tool : public Editor_Tool { |
4803 | - Editor_Make_Infrastructure_Tool() : Editor_Tool(*this, *this, false), m_player(0) {} |
4804 | +struct EditorMakeInfrastructureTool : public EditorTool { |
4805 | + EditorMakeInfrastructureTool() : EditorTool(*this, *this, false), m_player(0) {} |
4806 | |
4807 | - void set_player(Widelands::Player_Number const n) |
4808 | + void set_player(Widelands::PlayerNumber const n) |
4809 | {m_player = n;} |
4810 | - Widelands::Player_Number get_player() const |
4811 | + Widelands::PlayerNumber get_player() const |
4812 | {return m_player;} |
4813 | |
4814 | int32_t handle_click_impl(Widelands::Map& map, |
4815 | const Widelands::World& world, |
4816 | - Widelands::Node_and_Triangle<> center, |
4817 | - Editor_Interactive& parent, |
4818 | - Editor_Action_Args& args) override; |
4819 | + Widelands::NodeAndTriangle<> center, |
4820 | + EditorInteractive& parent, |
4821 | + EditorActionArgs& args) override; |
4822 | |
4823 | const char * get_sel_impl() const override |
4824 | {return "pics/fsel.png";} // Standard sel icon, most complex tool of all |
4825 | |
4826 | private: |
4827 | - Widelands::Player_Number m_player; |
4828 | + Widelands::PlayerNumber m_player; |
4829 | UI::UniqueWindow::Registry m_registry; |
4830 | }; |
4831 | |
4832 | int32_t Editor_Make_Infrastructure_Tool_Callback |
4833 | (const Widelands::TCoords<Widelands::FCoords>& c, |
4834 | - Widelands::Editor_Game_Base& egbase, int32_t const player); |
4835 | + Widelands::EditorGameBase& egbase, int32_t const player); |
4836 | |
4837 | #endif // end of include guard: WL_EDITOR_TOOLS_EDITOR_MAKE_INFRASTRUCTURE_TOOL_H |
4838 | |
4839 | === modified file 'src/editor/tools/editor_noise_height_tool.cc' |
4840 | --- src/editor/tools/editor_noise_height_tool.cc 2014-03-01 17:09:07 +0000 |
4841 | +++ src/editor/tools/editor_noise_height_tool.cc 2014-09-18 15:54:00 +0000 |
4842 | @@ -27,11 +27,11 @@ |
4843 | #include "logic/mapregion.h" |
4844 | |
4845 | /// Sets the heights to random values. Changes surrounding nodes if necessary. |
4846 | -int32_t Editor_Noise_Height_Tool::handle_click_impl(Widelands::Map& map, |
4847 | +int32_t EditorNoiseHeightTool::handle_click_impl(Widelands::Map& map, |
4848 | const Widelands::World& world, |
4849 | - Widelands::Node_and_Triangle<> const center, |
4850 | - Editor_Interactive& /* parent */, |
4851 | - Editor_Action_Args& args) { |
4852 | + Widelands::NodeAndTriangle<> const center, |
4853 | + EditorInteractive& /* parent */, |
4854 | + EditorActionArgs& args) { |
4855 | if (args.origHights.empty()) { |
4856 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4857 | (map, |
4858 | @@ -62,17 +62,17 @@ |
4859 | } |
4860 | |
4861 | int32_t |
4862 | -Editor_Noise_Height_Tool::handle_undo_impl(Widelands::Map& map, |
4863 | +EditorNoiseHeightTool::handle_undo_impl(Widelands::Map& map, |
4864 | const Widelands::World& world, |
4865 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4866 | - Editor_Interactive& parent, |
4867 | - Editor_Action_Args& args) { |
4868 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4869 | + EditorInteractive& parent, |
4870 | + EditorActionArgs& args) { |
4871 | return m_set_tool.handle_undo_impl(map, world, center, parent, args); |
4872 | } |
4873 | |
4874 | -Editor_Action_Args Editor_Noise_Height_Tool::format_args_impl(Editor_Interactive & parent) |
4875 | +EditorActionArgs EditorNoiseHeightTool::format_args_impl(EditorInteractive & parent) |
4876 | { |
4877 | - Editor_Action_Args a(parent); |
4878 | + EditorActionArgs a(parent); |
4879 | a.m_interval = m_interval; |
4880 | return a; |
4881 | } |
4882 | |
4883 | === modified file 'src/editor/tools/editor_noise_height_tool.h' |
4884 | --- src/editor/tools/editor_noise_height_tool.h 2014-07-26 16:37:37 +0000 |
4885 | +++ src/editor/tools/editor_noise_height_tool.h 2014-09-18 15:54:00 +0000 |
4886 | @@ -23,30 +23,30 @@ |
4887 | #include "editor/tools/editor_set_height_tool.h" |
4888 | |
4889 | /// Set the height of a node to a random value within a defined interval. |
4890 | -struct Editor_Noise_Height_Tool : public Editor_Tool { |
4891 | - Editor_Noise_Height_Tool |
4892 | - (Editor_Set_Height_Tool & the_set_tool, |
4893 | +struct EditorNoiseHeightTool : public EditorTool { |
4894 | + EditorNoiseHeightTool |
4895 | + (EditorSetHeightTool & the_set_tool, |
4896 | const Widelands::HeightInterval the_interval = |
4897 | Widelands::HeightInterval(10, 14)) |
4898 | : |
4899 | - Editor_Tool(the_set_tool, the_set_tool), |
4900 | + EditorTool(the_set_tool, the_set_tool), |
4901 | m_set_tool(the_set_tool), |
4902 | m_interval(the_interval) |
4903 | {} |
4904 | |
4905 | int32_t handle_click_impl(Widelands::Map& map, |
4906 | const Widelands::World& world, |
4907 | - Widelands::Node_and_Triangle<> center, |
4908 | - Editor_Interactive& parent, |
4909 | - Editor_Action_Args& args) override; |
4910 | + Widelands::NodeAndTriangle<> center, |
4911 | + EditorInteractive& parent, |
4912 | + EditorActionArgs& args) override; |
4913 | |
4914 | int32_t handle_undo_impl(Widelands::Map& map, |
4915 | const Widelands::World& world, |
4916 | - Widelands::Node_and_Triangle<> center, |
4917 | - Editor_Interactive& parent, |
4918 | - Editor_Action_Args& args) override; |
4919 | + Widelands::NodeAndTriangle<> center, |
4920 | + EditorInteractive& parent, |
4921 | + EditorActionArgs& args) override; |
4922 | |
4923 | - Editor_Action_Args format_args_impl(Editor_Interactive & parent) override; |
4924 | + EditorActionArgs format_args_impl(EditorInteractive & parent) override; |
4925 | |
4926 | char const * get_sel_impl() const override { |
4927 | return "pics/fsel_editor_noise_height.png"; |
4928 | @@ -59,10 +59,10 @@ |
4929 | m_interval = i; |
4930 | } |
4931 | |
4932 | - Editor_Set_Height_Tool & set_tool() const {return m_set_tool;} |
4933 | + EditorSetHeightTool & set_tool() const {return m_set_tool;} |
4934 | |
4935 | private: |
4936 | - Editor_Set_Height_Tool & m_set_tool; |
4937 | + EditorSetHeightTool & m_set_tool; |
4938 | Widelands::HeightInterval m_interval; |
4939 | }; |
4940 | |
4941 | |
4942 | === modified file 'src/editor/tools/editor_place_bob_tool.cc' |
4943 | --- src/editor/tools/editor_place_bob_tool.cc 2014-07-20 07:43:07 +0000 |
4944 | +++ src/editor/tools/editor_place_bob_tool.cc 2014-09-18 15:54:00 +0000 |
4945 | @@ -30,11 +30,11 @@ |
4946 | * Choses an object to place randomly from all enabled |
4947 | * and places this on the current field |
4948 | */ |
4949 | -int32_t Editor_Place_Bob_Tool::handle_click_impl(Widelands::Map& map, |
4950 | +int32_t EditorPlaceBobTool::handle_click_impl(Widelands::Map& map, |
4951 | const Widelands::World& world, |
4952 | - Widelands::Node_and_Triangle<> const center, |
4953 | - Editor_Interactive& parent, |
4954 | - Editor_Action_Args& args) { |
4955 | + Widelands::NodeAndTriangle<> const center, |
4956 | + EditorInteractive& parent, |
4957 | + EditorActionArgs& args) { |
4958 | |
4959 | if (get_nr_enabled() && args.obob_type.empty()) { |
4960 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4961 | @@ -49,7 +49,7 @@ |
4962 | } |
4963 | |
4964 | if (!args.nbob_type.empty()) { |
4965 | - Widelands::Editor_Game_Base & egbase = parent.egbase(); |
4966 | + Widelands::EditorGameBase & egbase = parent.egbase(); |
4967 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4968 | (map, |
4969 | Widelands::Area<Widelands::FCoords> |
4970 | @@ -70,13 +70,13 @@ |
4971 | } |
4972 | |
4973 | int32_t |
4974 | -Editor_Place_Bob_Tool::handle_undo_impl(Widelands::Map& map, |
4975 | +EditorPlaceBobTool::handle_undo_impl(Widelands::Map& map, |
4976 | const Widelands::World&, |
4977 | - Widelands::Node_and_Triangle<Widelands::Coords> center, |
4978 | - Editor_Interactive& parent, |
4979 | - Editor_Action_Args& args) { |
4980 | + Widelands::NodeAndTriangle<Widelands::Coords> center, |
4981 | + EditorInteractive& parent, |
4982 | + EditorActionArgs& args) { |
4983 | if (!args.nbob_type.empty()) { |
4984 | - Widelands::Editor_Game_Base & egbase = parent.egbase(); |
4985 | + Widelands::EditorGameBase & egbase = parent.egbase(); |
4986 | Widelands::MapRegion<Widelands::Area<Widelands::FCoords> > mr |
4987 | (map, |
4988 | Widelands::Area<Widelands::FCoords> |
4989 | @@ -100,7 +100,7 @@ |
4990 | return 0; |
4991 | } |
4992 | |
4993 | -Editor_Action_Args Editor_Place_Bob_Tool::format_args_impl(Editor_Interactive & parent) |
4994 | +EditorActionArgs EditorPlaceBobTool::format_args_impl(EditorInteractive & parent) |
4995 | { |
4996 | - return Editor_Tool::format_args_impl(parent); |
4997 | + return EditorTool::format_args_impl(parent); |
4998 | } |
4999 | |
5000 | === modified file 'src/editor/tools/editor_place_bob_tool.h' |
small nits.