← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/split_up_liblogic_2_mapobjectdescr into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/split_up_liblogic_2_mapobjectdescr into lp:widelands.

Commit message:
Some small refactorings to the logic code structure
- Pull out some libraries from liblogic
- Remove EditorGameBase from MapObjectDescr constructors
- Delete the unused struct SoldierStrength in widelands.h


Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/split_up_liblogic_2_mapobjectdescr/+merge/366332

Some code cleanup to make the circular dependencies more visible for future refactoring. There will be 1 more branch in the series after this one.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/split_up_liblogic_2_mapobjectdescr into lp:widelands.
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt	2018-09-06 09:06:55 +0000
+++ src/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -115,6 +115,7 @@
     logic_filesystem_constants
     logic_game_controller
     logic_game_settings
+    logic_map
     logic_single_player_game_settings
     map_io_map_loader
     network

=== modified file 'src/ai/CMakeLists.txt'
--- src/ai/CMakeLists.txt	2017-02-28 12:59:39 +0000
+++ src/ai/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -19,5 +19,8 @@
     economy
     logic
     logic_constants
+    logic_commands
+    logic_map
+    logic_map_objects
     scripting_lua_table
 )

=== modified file 'src/ai/ai_help_structs.h'
--- src/ai/ai_help_structs.h	2019-02-23 11:00:49 +0000
+++ src/ai/ai_help_structs.h	2019-04-20 05:49:35 +0000
@@ -28,7 +28,7 @@
 #include "economy/flag.h"
 #include "economy/road.h"
 #include "logic/ai_dna_handler.h"
-#include "logic/findnode.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/game.h"
 #include "logic/map.h"
 #include "logic/map_objects/checkstep.h"

=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2019-04-10 16:39:31 +0000
+++ src/ai/defaultai.cc	2019-04-20 05:49:35 +0000
@@ -35,10 +35,10 @@
 #include "economy/flag.h"
 #include "economy/portdock.h"
 #include "economy/road.h"
-#include "logic/findbob.h"
-#include "logic/findimmovable.h"
-#include "logic/findnode.h"
 #include "logic/map.h"
+#include "logic/map_objects/findbob.h"
+#include "logic/map_objects/findimmovable.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/constructionsite.h"
 #include "logic/map_objects/tribes/militarysite.h"
 #include "logic/map_objects/tribes/productionsite.h"

=== modified file 'src/economy/CMakeLists.txt'
--- src/economy/CMakeLists.txt	2017-11-20 13:50:51 +0000
+++ src/economy/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -52,9 +52,13 @@
     base_macros
     io_fileread
     logic
+    logic_commands
     logic_constants
     logic_exceptions
+    logic_map
+    logic_map_objects
     logic_widelands_geometry
+    logic_widelands_geometry_io
     map_io
     notifications
 )

=== modified file 'src/economy/input_queue.h'
--- src/economy/input_queue.h	2019-02-23 11:00:49 +0000
+++ src/economy/input_queue.h	2019-04-20 05:49:35 +0000
@@ -24,7 +24,6 @@
 
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/tribes/wareworker.h"
-#include "logic/widelands.h"
 
 namespace Widelands {
 

=== modified file 'src/economy/test/CMakeLists.txt'
--- src/economy/test/CMakeLists.txt	2018-09-06 09:06:55 +0000
+++ src/economy/test/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -9,5 +9,6 @@
     economy
     io_filesystem
     logic
+    logic_map_objects
     logic_widelands_geometry
 )

=== modified file 'src/economy/ware_instance.h'
--- src/economy/ware_instance.h	2019-02-23 11:00:49 +0000
+++ src/economy/ware_instance.h	2019-04-20 05:49:35 +0000
@@ -23,7 +23,6 @@
 #include "economy/transfer.h"
 #include "logic/map_objects/map_object.h"
 #include "logic/map_objects/tribes/ware_descr.h"
-#include "logic/widelands.h"
 #include "map_io/tribes_legacy_lookup_table.h"
 
 namespace Widelands {

=== modified file 'src/economy/wares_queue.h'
--- src/economy/wares_queue.h	2019-02-23 11:00:49 +0000
+++ src/economy/wares_queue.h	2019-04-20 05:49:35 +0000
@@ -22,7 +22,6 @@
 
 #include "economy/input_queue.h"
 #include "logic/map_objects/immovable.h"
-#include "logic/widelands.h"
 
 namespace Widelands {
 

=== modified file 'src/economy/workers_queue.h'
--- src/economy/workers_queue.h	2019-02-23 11:00:49 +0000
+++ src/economy/workers_queue.h	2019-04-20 05:49:35 +0000
@@ -22,7 +22,6 @@
 
 #include "economy/input_queue.h"
 #include "logic/map_objects/immovable.h"
-#include "logic/widelands.h"
 
 namespace Widelands {
 

=== modified file 'src/editor/CMakeLists.txt'
--- src/editor/CMakeLists.txt	2018-11-04 17:56:37 +0000
+++ src/editor/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -100,6 +100,9 @@
     logic_constants
     logic_filesystem_constants
     logic_generic_save_handler
+    logic_map
+    logic_map_objects
+    logic_map_objects_description_maintainer
     logic_tribe_basic_info
     logic_widelands_geometry
     map_io

=== modified file 'src/editor/map_generator.cc'
--- src/editor/map_generator.cc	2019-02-23 11:00:49 +0000
+++ src/editor/map_generator.cc	2019-04-20 05:49:35 +0000
@@ -26,8 +26,8 @@
 #include "base/wexception.h"
 #include "editor/tools/increase_resources_tool.h"
 #include "logic/editor_game_base.h"
-#include "logic/findnode.h"
 #include "logic/map.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/tribe_basic_info.h"
 #include "logic/map_objects/world/map_gen.h"
 #include "logic/map_objects/world/world.h"

=== modified file 'src/editor/tools/set_origin_tool.h'
--- src/editor/tools/set_origin_tool.h	2019-02-23 11:00:49 +0000
+++ src/editor/tools/set_origin_tool.h	2019-04-20 05:49:35 +0000
@@ -21,7 +21,6 @@
 #define WL_EDITOR_TOOLS_SET_ORIGIN_TOOL_H
 
 #include "editor/tools/tool.h"
-#include "logic/widelands.h"
 
 /// Sets the starting position of players.
 struct EditorSetOriginTool : public EditorTool {

=== modified file 'src/editor/tools/set_port_space_tool.h'
--- src/editor/tools/set_port_space_tool.h	2019-02-23 11:00:49 +0000
+++ src/editor/tools/set_port_space_tool.h	2019-04-20 05:49:35 +0000
@@ -21,7 +21,6 @@
 #define WL_EDITOR_TOOLS_SET_PORT_SPACE_TOOL_H
 
 #include "editor/tools/tool.h"
-#include "logic/widelands.h"
 
 #define FSEL_ESPS_FILENAME "images/wui/editor/fsel_editor_set_port_space.png"
 #define FSEL_EUPS_FILENAME "images/wui/editor/fsel_editor_unset_port_space.png"

=== modified file 'src/editor/tools/set_resources_tool.h'
--- src/editor/tools/set_resources_tool.h	2019-02-23 11:00:49 +0000
+++ src/editor/tools/set_resources_tool.h	2019-04-20 05:49:35 +0000
@@ -22,7 +22,6 @@
 
 #include "editor/tools/tool.h"
 #include "logic/mapregion.h"
-#include "logic/widelands.h"
 
 Widelands::NodeCaps resource_tools_nodecaps(const Widelands::FCoords& fcoords,
                                             const Widelands::EditorGameBase& egbase,

=== modified file 'src/editor/tools/set_starting_pos_tool.h'
--- src/editor/tools/set_starting_pos_tool.h	2019-02-23 11:00:49 +0000
+++ src/editor/tools/set_starting_pos_tool.h	2019-04-20 05:49:35 +0000
@@ -24,7 +24,6 @@
 
 #include "editor/tools/tool.h"
 #include "graphic/playercolor.h"
-#include "logic/widelands.h"
 
 // How much place should be left around a player position
 // where no other player can start

=== modified file 'src/editor/ui_menus/categorized_item_selection_menu.h'
--- src/editor/ui_menus/categorized_item_selection_menu.h	2019-02-23 11:00:49 +0000
+++ src/editor/ui_menus/categorized_item_selection_menu.h	2019-04-20 05:49:35 +0000
@@ -28,7 +28,7 @@
 
 #include "base/i18n.h"
 #include "graphic/image.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/world/editor_category.h"
 #include "ui_basic/box.h"
 #include "ui_basic/checkbox.h"
@@ -47,8 +47,8 @@
 	// not take ownership.
 	CategorizedItemSelectionMenu(
 	   UI::Panel* parent,
-	   const DescriptionMaintainer<Widelands::EditorCategory>& categories,
-	   const DescriptionMaintainer<DescriptionType>& descriptions,
+	   const Widelands::DescriptionMaintainer<Widelands::EditorCategory>& categories,
+	   const Widelands::DescriptionMaintainer<DescriptionType>& descriptions,
 	   std::function<UI::Checkbox*(UI::Panel* parent, const DescriptionType& descr)> create_checkbox,
 	   const std::function<void()> select_correct_tool,
 	   ToolType* const tool);
@@ -60,7 +60,7 @@
 	// Update the label with the currently selected object names.
 	void update_label();
 
-	const DescriptionMaintainer<DescriptionType>& descriptions_;
+	const Widelands::DescriptionMaintainer<DescriptionType>& descriptions_;
 	std::function<void()> select_correct_tool_;
 	bool protect_against_recursive_select_;
 	UI::TabPanel tab_panel_;
@@ -72,8 +72,8 @@
 template <typename DescriptionType, typename ToolType>
 CategorizedItemSelectionMenu<DescriptionType, ToolType>::CategorizedItemSelectionMenu(
    UI::Panel* parent,
-   const DescriptionMaintainer<Widelands::EditorCategory>& categories,
-   const DescriptionMaintainer<DescriptionType>& descriptions,
+   const Widelands::DescriptionMaintainer<Widelands::EditorCategory>& categories,
+   const Widelands::DescriptionMaintainer<DescriptionType>& descriptions,
    const std::function<UI::Checkbox*(UI::Panel* parent, const DescriptionType& descr)>
       create_checkbox,
    const std::function<void()> select_correct_tool,

=== modified file 'src/editor/ui_menus/main_menu_new_map.cc'
--- src/editor/ui_menus/main_menu_new_map.cc	2019-02-23 11:00:49 +0000
+++ src/editor/ui_menus/main_menu_new_map.cc	2019-04-20 05:49:35 +0000
@@ -167,7 +167,7 @@
  */
 void MainMenuNewMap::fill_list() {
 	list_.clear();
-	const DescriptionMaintainer<Widelands::TerrainDescription>& terrains =
+	const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains =
 	   eia().egbase().world().terrains();
 
 	for (Widelands::DescriptionIndex index = 0; index < terrains.size(); ++index) {

=== modified file 'src/editor/ui_menus/main_menu_new_map.h'
--- src/editor/ui_menus/main_menu_new_map.h	2019-02-23 11:00:49 +0000
+++ src/editor/ui_menus/main_menu_new_map.h	2019-04-20 05:49:35 +0000
@@ -20,7 +20,7 @@
 #ifndef WL_EDITOR_UI_MENUS_MAIN_MENU_NEW_MAP_H
 #define WL_EDITOR_UI_MENUS_MAIN_MENU_NEW_MAP_H
 
-#include "logic/description_maintainer.h"
+#include "logic/widelands.h"
 #include "ui_basic/box.h"
 #include "ui_basic/button.h"
 #include "ui_basic/listselect.h"

=== modified file 'src/editor/ui_menus/tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/tool_change_resources_options_menu.cc	2019-02-23 11:00:49 +0000
+++ src/editor/ui_menus/tool_change_resources_options_menu.cc	2019-04-20 05:49:35 +0000
@@ -33,7 +33,6 @@
 #include "logic/map.h"
 #include "logic/map_objects/world/resource_description.h"
 #include "logic/map_objects/world/world.h"
-#include "logic/widelands.h"
 #include "logic/widelands_geometry.h"
 
 constexpr int kMaxValue = 63;

=== modified file 'src/game_io/CMakeLists.txt'
--- src/game_io/CMakeLists.txt	2018-02-13 10:14:35 +0000
+++ src/game_io/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -34,8 +34,12 @@
     io_fileread
     io_filesystem
     logic
+    logic_commands
     logic_exceptions
     logic_game_controller
+    logic_map
+    logic_map_objects
+    logic_widelands_geometry_io
     map_io
     map_io_map_loader
     profile

=== modified file 'src/graphic/CMakeLists.txt'
--- src/graphic/CMakeLists.txt	2018-07-19 16:43:14 +0000
+++ src/graphic/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -176,7 +176,8 @@
     graphic_draw_programs
     graphic_fields_to_draw
     graphic_terrain_programs
-    logic
+    logic_map_objects
+    logic_map_objects_description_maintainer
 )
 
 wl_library(graphic_game_renderer
@@ -192,6 +193,7 @@
     graphic_render_queue
     graphic_surface
     logic
+    logic_map_objects
     wui
     wui_mapview_pixelfunctions
 )
@@ -206,6 +208,8 @@
     economy
     graphic_surface
     logic
+    logic_map
+    logic_map_objects
     wui_mapview_pixelfunctions
 )
 
@@ -219,6 +223,7 @@
     graphic_gl_utils
     logic
     logic_constants
+    logic_map_objects
     logic_widelands_geometry
     wui_mapview_pixelfunctions
 )
@@ -242,6 +247,9 @@
     graphic_surface
     io_filesystem
     logic
+    logic_constants
+    logic_map_objects
+    logic_map_objects_description_maintainer
 )
 
 

=== modified file 'src/graphic/gl/dither_program.cc'
--- src/graphic/gl/dither_program.cc	2019-02-23 11:00:49 +0000
+++ src/graphic/gl/dither_program.cc	2019-04-20 05:49:35 +0000
@@ -86,7 +86,7 @@
 
 void DitherProgram::maybe_add_dithering_triangle(
    const uint32_t gametime,
-   const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+   const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
    const FieldsToDraw& fields_to_draw,
    const int idx1,
    const int idx2,
@@ -140,7 +140,7 @@
 }
 
 void DitherProgram::draw(const uint32_t gametime,
-                         const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+                         const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
                          const FieldsToDraw& fields_to_draw,
                          const float z_value) {
 	// This method expects that all terrains have the same dimensions and that

=== modified file 'src/graphic/gl/dither_program.h'
--- src/graphic/gl/dither_program.h	2019-02-23 11:00:49 +0000
+++ src/graphic/gl/dither_program.h	2019-04-20 05:49:35 +0000
@@ -25,7 +25,7 @@
 #include "base/vector.h"
 #include "graphic/gl/fields_to_draw.h"
 #include "graphic/gl/utils.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/world/terrain_description.h"
 
 class Texture;
@@ -37,7 +37,7 @@
 
 	// Draws the terrain.
 	void draw(uint32_t gametime,
-	          const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+	          const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
 	          const FieldsToDraw& fields_to_draw,
 	          float z_value);
 
@@ -53,7 +53,7 @@
 	// agree.
 	void maybe_add_dithering_triangle(
 	   uint32_t gametime,
-	   const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+	   const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
 	   const FieldsToDraw& fields_to_draw,
 	   int idx1,
 	   int idx2,

=== modified file 'src/graphic/gl/fields_to_draw.h'
--- src/graphic/gl/fields_to_draw.h	2019-02-23 11:00:49 +0000
+++ src/graphic/gl/fields_to_draw.h	2019-04-20 05:49:35 +0000
@@ -30,7 +30,6 @@
 #include "base/vector.h"
 #include "graphic/rendertarget.h"
 #include "logic/editor_game_base.h"
-#include "logic/widelands.h"
 #include "logic/widelands_geometry.h"
 
 // Helper struct that contains the data needed for drawing all fields.
@@ -61,7 +60,7 @@
 		Widelands::Vision vision;
 		Widelands::Player* owner;  // can be nullptr.
 
-		// Index of neighbors in this 'FieldsToDraw'. kInvalidIndex if this
+		// Index of neighbors in this 'FieldsToDraw'. INVALID_INDEX if this
 		// neighbor is not contained.
 		int ln_index;
 		int rn_index;
@@ -99,7 +98,7 @@
 
 private:
 	// Calculates the index of the given field with ('fx', 'fy') being geometric
-	// coordinates in the map. Returns kInvalidIndex if this field is not in the
+	// coordinates in the map. Returns INVALID_INDEX if this field is not in the
 	// fields_to_draw.
 	inline int calculate_index(int fx, int fy) const {
 		uint16_t xidx = fx - min_fx_;

=== modified file 'src/graphic/gl/terrain_program.cc'
--- src/graphic/gl/terrain_program.cc	2019-02-23 11:00:49 +0000
+++ src/graphic/gl/terrain_program.cc	2019-04-20 05:49:35 +0000
@@ -84,7 +84,7 @@
 }
 
 void TerrainProgram::draw(uint32_t gametime,
-                          const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+                          const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
                           const FieldsToDraw& fields_to_draw,
                           float z_value) {
 	// This method expects that all terrains have the same dimensions and that

=== modified file 'src/graphic/gl/terrain_program.h'
--- src/graphic/gl/terrain_program.h	2019-02-23 11:00:49 +0000
+++ src/graphic/gl/terrain_program.h	2019-04-20 05:49:35 +0000
@@ -25,7 +25,7 @@
 #include "base/vector.h"
 #include "graphic/gl/fields_to_draw.h"
 #include "graphic/gl/utils.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/world/terrain_description.h"
 
 class TerrainProgram {
@@ -35,7 +35,7 @@
 
 	// Draws the terrain.
 	void draw(uint32_t gametime,
-	          const DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
+	          const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>& terrains,
 	          const FieldsToDraw& fields_to_draw,
 	          float z_value);
 

=== modified file 'src/graphic/render_queue.h'
--- src/graphic/render_queue.h	2019-02-23 11:00:49 +0000
+++ src/graphic/render_queue.h	2019-04-20 05:49:35 +0000
@@ -32,7 +32,7 @@
 #include "graphic/color.h"
 #include "graphic/gl/draw_line_program.h"
 #include "graphic/gl/fields_to_draw.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/world/terrain_description.h"
 
 class DitherProgram;
@@ -117,7 +117,7 @@
 		int gametime = 0;
 		int renderbuffer_width = 0;
 		int renderbuffer_height = 0;
-		const DescriptionMaintainer<Widelands::TerrainDescription>* terrains = nullptr;
+		const Widelands::DescriptionMaintainer<Widelands::TerrainDescription>* terrains = nullptr;
 		const FieldsToDraw* fields_to_draw = nullptr;
 		float scale = 1.f;
 		Rectf destination_rect = Rectf(0.f, 0.f, 0.f, 0.f);

=== modified file 'src/logic/CMakeLists.txt'
--- src/logic/CMakeLists.txt	2019-02-27 17:19:00 +0000
+++ src/logic/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -13,6 +13,17 @@
     widelands_geometry.h
 )
 
+wl_library(logic_widelands_geometry_io
+  SRCS
+    widelands_geometry_io.cc
+    widelands_geometry_io.h
+  DEPENDS
+    io_fileread
+    io_stream
+    logic_constants
+    logic_widelands_geometry
+)
+
 wl_library(logic_game_settings
   SRCS
     game_settings.cc
@@ -22,6 +33,7 @@
     io_filesystem
     logic_constants
     logic_tribe_basic_info
+    logic_map_objects
     notifications
     scripting_lua_interface
     scripting_lua_table
@@ -36,6 +48,7 @@
     base_exceptions
     base_i18n
     logic_game_settings
+    logic_map_objects
     logic_tribe_basic_info
 )
 
@@ -49,6 +62,7 @@
   DEPENDS
     ai
     logic
+    logic_commands
     logic_constants
     logic_game_settings
     profile
@@ -69,6 +83,7 @@
 
 wl_library(logic_constants
   SRCS
+    roadtype.h
     widelands.cc
     widelands.h
   DEPENDS
@@ -81,18 +96,6 @@
     filesystem_constants.cc
 )
 
-wl_library(logic_tribe_basic_info
-  SRCS
-    map_objects/tribes/tribe_basic_info.cc
-    map_objects/tribes/tribe_basic_info.h
-  DEPENDS
-    base_i18n
-    logic_exceptions
-    scripting_lua_table
-    scripting_lua_interface
-
-)
-
 wl_library(logic_generic_save_handler
   SRCS
     generic_save_handler.h
@@ -105,38 +108,11 @@
     logic_filesystem_constants
 )
 
-wl_library(logic
+wl_library(logic_map
   SRCS
-    ai_dna_handler.cc
-    ai_dna_handler.h
-    backtrace.cc
-    backtrace.h
-    cmd_calculate_statistics.cc
-    cmd_calculate_statistics.h
-    cmd_delete_message.cc
-    cmd_delete_message.h
-    cmd_incorporate.cc
-    cmd_incorporate.h
-    cmd_luacoroutine.cc
-    cmd_luacoroutine.h
-    cmd_luascript.cc
-    cmd_luascript.h
-    cmd_queue.cc
-    cmd_queue.h
     cookie_priority_queue.h
-    description_maintainer.h
-    editor_game_base.cc
-    editor_game_base.h
     field.cc
     field.h
-    findbob.cc
-    findbob.h
-    findimmovable.cc
-    findimmovable.h
-    findnode.cc
-    findnode.h
-    game.cc
-    game.h
     map.cc
     map.h
     map_revision.cc
@@ -152,130 +128,105 @@
     mapregion.h
     maptriangleregion.cc
     maptriangleregion.h
-    message.h
-    message_id.h
-    message_queue.h
     nodecaps.h
-    objective.h
     path.cc
     path.h
     pathfield.cc
     pathfield.h
+  DEPENDS
+    base_exceptions
+    base_i18n
+    base_log
+    base_macros
+    build_info
+    economy
+    editor # TODO(GunChleoc): Circular dependency
+    graphic_playercolor
+    io_fileread
+    io_filesystem
+    logic # TODO(GunChleoc): Circular
+    logic_constants
+    logic_filesystem_constants
+    logic_map_objects
+    logic_widelands_geometry
+    logic_widelands_geometry_io
+    map_io_map_loader
+    notifications
+    random
+    wui_mapview_pixelfunctions # TODO(GunChleoc): Circular dependency
+)
+
+wl_library(logic_commands
+  SRCS
+    cmd_calculate_statistics.cc
+    cmd_calculate_statistics.h
+    cmd_delete_message.cc
+    cmd_delete_message.h
+    cmd_incorporate.cc
+    cmd_incorporate.h
+    cmd_luacoroutine.cc
+    cmd_luacoroutine.h
+    cmd_luascript.cc
+    cmd_luascript.h
+    cmd_queue.cc
+    cmd_queue.h
+    queue_cmd_factory.cc
+    queue_cmd_factory.h
+    queue_cmd_ids.h
+    playercommand.cc
+    playercommand.h
+  DEPENDS
+    base_exceptions
+    base_i18n
+    base_log
+    base_macros
+    economy # TODO(GunChleoc): Circular dependency
+    io_fileread
+    io_stream
+    logic # TODO(GunChleoc): Circular dependency
+    logic_game_controller
+    logic_map
+    logic_map_objects
+    logic_widelands_geometry_io
+    map_io
+    scripting_coroutine
+    scripting_logic # TODO(GunChleoc): Circular dependency
+    scripting_lua_table
+)
+
+wl_library(logic
+  SRCS
+    ai_dna_handler.cc
+    ai_dna_handler.h
+    editor_game_base.cc
+    editor_game_base.h
+    game.cc
+    game.h
+    message.h
+    message_id.h
+    message_queue.h
+    objective.h
     player.cc
     player.h
     player_area.h
-    playercommand.cc
-    playercommand.h
     playersmanager.cc
     playersmanager.h
-    queue_cmd_factory.cc
-    queue_cmd_factory.h
-    queue_cmd_ids.h
     replay.cc
     replay.h
-    roadtype.h
     save_handler.cc
     save_handler.h
     see_unsee_node.h
     trade_agreement.h
-    widelands_geometry_io.cc
-    widelands_geometry_io.h
-    map_objects/bob.cc
-    map_objects/bob.h
-    map_objects/buildcost.cc
-    map_objects/buildcost.h
-    map_objects/checkstep.cc
-    map_objects/checkstep.h
-    map_objects/draw_text.h
-    map_objects/immovable.cc
-    map_objects/immovable.h
-    map_objects/immovable_program.h
-    map_objects/map_object.cc
-    map_objects/map_object.h
-    map_objects/terrain_affinity.cc
-    map_objects/terrain_affinity.h
-    map_objects/tribes/attack_target.h
-    map_objects/tribes/battle.cc
-    map_objects/tribes/battle.h
-    map_objects/tribes/bill_of_materials.h
-    map_objects/tribes/building.cc
-    map_objects/tribes/building.h
-    map_objects/tribes/carrier.cc
-    map_objects/tribes/carrier.h
-    map_objects/tribes/constructionsite.cc
-    map_objects/tribes/constructionsite.h
-    map_objects/tribes/dismantlesite.cc
-    map_objects/tribes/dismantlesite.h
-    map_objects/tribes/market.cc
-    map_objects/tribes/market.h
-    map_objects/tribes/militarysite.cc
-    map_objects/tribes/militarysite.h
-    map_objects/tribes/partially_finished_building.cc
-    map_objects/tribes/partially_finished_building.h
-    map_objects/tribes/production_program.cc
-    map_objects/tribes/production_program.h
-    map_objects/tribes/productionsite.cc
-    map_objects/tribes/productionsite.h
-    map_objects/tribes/program_result.h
-    map_objects/tribes/requirements.cc
-    map_objects/tribes/requirements.h
-    map_objects/tribes/road_textures.cc
-    map_objects/tribes/road_textures.h
-    map_objects/tribes/ship.cc
-    map_objects/tribes/ship.h
-    map_objects/tribes/soldier.cc
-    map_objects/tribes/soldier.h
-    map_objects/tribes/soldiercontrol.h
-    map_objects/tribes/training_attribute.h
-    map_objects/tribes/trainingsite.cc
-    map_objects/tribes/trainingsite.h
-    map_objects/tribes/tribe_descr.cc
-    map_objects/tribes/tribe_descr.h
-    map_objects/tribes/tribes.cc
-    map_objects/tribes/tribes.h
-    map_objects/tribes/ware_descr.cc
-    map_objects/tribes/ware_descr.h
-    map_objects/tribes/warehouse.cc
-    map_objects/tribes/warehouse.h
-    map_objects/tribes/warelist.cc
-    map_objects/tribes/warelist.h
-    map_objects/tribes/wareworker.h
-    map_objects/tribes/workarea_info.h
-    map_objects/tribes/worker.cc
-    map_objects/tribes/worker.h
-    map_objects/tribes/worker_descr.cc
-    map_objects/tribes/worker_descr.h
-    map_objects/tribes/worker_program.cc
-    map_objects/tribes/worker_program.h
-    map_objects/walkingdir.cc
-    map_objects/walkingdir.h
-    map_objects/world/critter.cc
-    map_objects/world/critter.h
-    map_objects/world/critter_program.h
-    map_objects/world/editor_category.cc
-    map_objects/world/editor_category.h
-    map_objects/world/map_gen.cc
-    map_objects/world/map_gen.h
-    map_objects/world/resource_description.cc
-    map_objects/world/resource_description.h
-    map_objects/world/terrain_description.cc
-    map_objects/world/terrain_description.h
-    map_objects/world/world.cc
-    map_objects/world/world.h
   # TODO(sirver): Uses SDL2 only on WIN32 for a dirty hack.
   USES_SDL2
   DEPENDS
-    ai
     base_exceptions
-    base_geometry
     base_i18n
     base_log
     base_macros
-    base_math
     base_md5
     base_scoped_timer
     base_time_string
-    build_info
     economy
     game_io
     graphic
@@ -283,34 +234,31 @@
     graphic_fonthandler
     graphic_image_io
     graphic_playercolor
-    graphic_surface
-    graphic_text_constants
-    graphic_text_layout
-    helper
     io_fileread
     io_filesystem
     io_stream
+    logic_commands
     logic_constants
     logic_exceptions
     logic_filesystem_constants
     logic_game_controller
     logic_game_settings
     logic_generic_save_handler
+    logic_map
+    logic_map_objects
     logic_tribe_basic_info
     logic_widelands_geometry
-    map_io
     map_io_map_loader
-    network
+    network # TODO(GunChleoc): Circular dependency
     note_sound
     notifications
     profile
     random
-    scripting_coroutine
-    scripting_logic
+    scripting_logic # TODO(GunChleoc): Circular dependency
     scripting_lua_interface
     scripting_lua_table
-    sound
     ui_basic
-    wui
-    wui_mapview_pixelfunctions
+    wui # TODO(GunChleoc): Circular dependency
 )
+
+add_subdirectory(map_objects)

=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc	2019-03-19 21:33:01 +0000
+++ src/logic/editor_game_base.cc	2019-04-20 05:49:35 +0000
@@ -32,9 +32,9 @@
 #include "economy/road.h"
 #include "graphic/color.h"
 #include "logic/filesystem_constants.h"
-#include "logic/findimmovable.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
+#include "logic/map_objects/findimmovable.h"
 #include "logic/map_objects/map_object.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/building.h"

=== modified file 'src/logic/game_controller.h'
--- src/logic/game_controller.h	2019-02-23 11:00:49 +0000
+++ src/logic/game_controller.h	2019-04-20 05:49:35 +0000
@@ -23,7 +23,6 @@
 #include <string>
 
 #include "logic/player_end_result.h"
-#include "logic/widelands.h"
 
 namespace Widelands {
 class Game;

=== modified file 'src/logic/map.cc'
--- src/logic/map.cc	2019-03-24 13:16:11 +0000
+++ src/logic/map.cc	2019-04-20 05:49:35 +0000
@@ -36,9 +36,9 @@
 #include "io/filesystem/filesystem_exceptions.h"
 #include "io/filesystem/layered_filesystem.h"
 #include "logic/filesystem_constants.h"
-#include "logic/findimmovable.h"
-#include "logic/findnode.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findimmovable.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/soldier.h"
 #include "logic/map_objects/tribes/tribe_basic_info.h"
 #include "logic/map_objects/world/terrain_description.h"

=== modified file 'src/logic/map.h'
--- src/logic/map.h	2019-03-24 13:16:11 +0000
+++ src/logic/map.h	2019-04-20 05:49:35 +0000
@@ -29,9 +29,8 @@
 
 #include "base/i18n.h"
 #include "economy/itransport_cost_calculator.h"
-#include "logic/description_maintainer.h"
 #include "logic/field.h"
-#include "logic/findimmovable.h"
+#include "logic/map_objects/findimmovable.h"
 #include "logic/map_objects/walkingdir.h"
 #include "logic/map_revision.h"
 #include "logic/objective.h"

=== added file 'src/logic/map_objects/CMakeLists.txt'
--- src/logic/map_objects/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ src/logic/map_objects/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -0,0 +1,148 @@
+wl_library(logic_map_objects_description_maintainer
+  SRCS
+    description_maintainer.cc
+    description_maintainer.h
+  DEPENDS
+    base_exceptions
+    logic_constants
+)
+
+wl_library(logic_tribe_basic_info
+  SRCS
+    tribes/tribe_basic_info.cc
+    tribes/tribe_basic_info.h
+  DEPENDS
+    base_i18n
+    logic_exceptions
+    scripting_lua_table
+    scripting_lua_interface
+
+)
+
+wl_library(logic_map_objects
+  SRCS
+    backtrace.cc
+    backtrace.h
+    bob.cc
+    bob.h
+    buildcost.cc
+    buildcost.h
+    checkstep.cc
+    checkstep.h
+    findbob.cc
+    findbob.h
+    findimmovable.cc
+    findimmovable.h
+    findnode.cc
+    findnode.h
+    immovable.cc
+    immovable.h
+    immovable_program.h
+    map_object.cc
+    map_object.h
+    terrain_affinity.cc
+    terrain_affinity.h
+    tribes/attack_target.h
+    tribes/battle.cc
+    tribes/battle.h
+    tribes/bill_of_materials.h
+    tribes/building.cc
+    tribes/building.h
+    tribes/carrier.cc
+    tribes/carrier.h
+    tribes/constructionsite.cc
+    tribes/constructionsite.h
+    tribes/dismantlesite.cc
+    tribes/dismantlesite.h
+    tribes/market.cc
+    tribes/market.h
+    tribes/militarysite.cc
+    tribes/militarysite.h
+    tribes/partially_finished_building.cc
+    tribes/partially_finished_building.h
+    tribes/production_program.cc
+    tribes/production_program.h
+    tribes/productionsite.cc
+    tribes/productionsite.h
+    tribes/program_result.h
+    tribes/requirements.cc
+    tribes/requirements.h
+    tribes/road_textures.cc
+    tribes/road_textures.h
+    tribes/ship.cc
+    tribes/ship.h
+    tribes/soldier.cc
+    tribes/soldier.h
+    tribes/soldiercontrol.h
+    tribes/training_attribute.h
+    tribes/trainingsite.cc
+    tribes/trainingsite.h
+    tribes/tribe_descr.cc
+    tribes/tribe_descr.h
+    tribes/tribes.cc
+    tribes/tribes.h
+    tribes/ware_descr.cc
+    tribes/ware_descr.h
+    tribes/warehouse.cc
+    tribes/warehouse.h
+    tribes/warelist.cc
+    tribes/warelist.h
+    tribes/wareworker.h
+    tribes/workarea_info.h
+    tribes/worker.cc
+    tribes/worker.h
+    tribes/worker_descr.cc
+    tribes/worker_descr.h
+    tribes/worker_program.cc
+    tribes/worker_program.h
+    walkingdir.cc
+    walkingdir.h
+    world/critter.cc
+    world/critter.h
+    world/critter_program.h
+    world/editor_category.cc
+    world/editor_category.h
+    world/map_gen.cc
+    world/map_gen.h
+    world/resource_description.cc
+    world/resource_description.h
+    world/terrain_description.cc
+    world/terrain_description.h
+    world/world.cc
+    world/world.h
+  DEPENDS
+    ai
+    base_exceptions
+    base_geometry
+    base_i18n
+    base_log
+    base_macros
+    base_math
+    economy
+    graphic
+    graphic_color
+    graphic_fonthandler
+    graphic_image_io
+    graphic_surface
+    graphic_text_constants
+    graphic_text_layout
+    helper
+    io_fileread
+    io_filesystem
+    logic # TODO(GunChleoc): Circular dependency
+    logic_commands # TODO(GunChleoc): Circular dependency
+    logic_constants
+    logic_game_controller
+    logic_map # TODO(GunChleoc): Circular dependency
+    logic_map_objects_description_maintainer
+    logic_widelands_geometry
+    logic_widelands_geometry_io
+    map_io
+    note_sound
+    notifications
+    scripting_lua_interface
+    scripting_lua_table
+    sound
+    ui_basic
+    wui_mapview_pixelfunctions
+)

=== renamed file 'src/logic/backtrace.cc' => 'src/logic/map_objects/backtrace.cc'
--- src/logic/backtrace.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/backtrace.cc	2019-04-20 05:49:35 +0000
@@ -17,7 +17,7 @@
  *
  */
 
-#include "logic/backtrace.h"
+#include "logic/map_objects/backtrace.h"
 
 #ifndef _WIN32
 #ifndef __APPLE__

=== renamed file 'src/logic/backtrace.h' => 'src/logic/map_objects/backtrace.h'
--- src/logic/backtrace.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/backtrace.h	2019-04-20 05:49:35 +0000
@@ -17,11 +17,11 @@
  *
  */
 
-#ifndef WL_LOGIC_BACKTRACE_H
-#define WL_LOGIC_BACKTRACE_H
+#ifndef WL_LOGIC_MAP_OBJECTS_BACKTRACE_H
+#define WL_LOGIC_MAP_OBJECTS_BACKTRACE_H
 
 #include <string>
 
 std::string get_backtrace();
 
-#endif  // end of include guard: WL_LOGIC_BACKTRACE_H
+#endif  // end of include guard: WL_LOGIC_MAP_OBJECTS_BACKTRACE_H

=== modified file 'src/logic/map_objects/bob.cc'
--- src/logic/map_objects/bob.cc	2019-04-09 16:43:49 +0000
+++ src/logic/map_objects/bob.cc	2019-04-20 05:49:35 +0000
@@ -32,11 +32,11 @@
 #include "graphic/rendertarget.h"
 #include "io/fileread.h"
 #include "io/filewrite.h"
-#include "logic/backtrace.h"
-#include "logic/findbob.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
+#include "logic/map_objects/backtrace.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findbob.h"
 #include "logic/map_objects/tribes/ship.h"
 #include "logic/map_objects/tribes/soldier.h"
 #include "logic/map_objects/tribes/tribe_descr.h"

=== added file 'src/logic/map_objects/description_maintainer.cc'
--- src/logic/map_objects/description_maintainer.cc	1970-01-01 00:00:00 +0000
+++ src/logic/map_objects/description_maintainer.cc	2019-04-20 05:49:35 +0000
@@ -0,0 +1,1 @@
+// Dummy to make CMake happy

=== renamed file 'src/logic/description_maintainer.h' => 'src/logic/map_objects/description_maintainer.h'
--- src/logic/description_maintainer.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/description_maintainer.h	2019-04-20 05:49:35 +0000
@@ -17,8 +17,8 @@
  *
  */
 
-#ifndef WL_LOGIC_DESCRIPTION_MAINTAINER_H
-#define WL_LOGIC_DESCRIPTION_MAINTAINER_H
+#ifndef WL_LOGIC_MAP_OBJECTS_DESCRIPTION_MAINTAINER_H
+#define WL_LOGIC_MAP_OBJECTS_DESCRIPTION_MAINTAINER_H
 
 #include <cassert>
 #include <map>
@@ -29,7 +29,9 @@
 #include "base/wexception.h"
 #include "logic/widelands.h"
 
-// Used to have a typesafe maintainer for description classes.
+namespace Widelands {
+
+// Used for having a typesafe maintainer for description classes.
 template <typename T> struct DescriptionMaintainer {
 	// Adds the 'entry', will assert() if it is already registered. Returns the
 	// index of the entry. Ownership is taken.
@@ -77,7 +79,7 @@
 		throw wexception("Tried to add %s twice.", item->name().c_str());
 	}
 	int32_t index = items_.size();
-	assert(index < (Widelands::INVALID_INDEX - 2));  // allowing for kInvalidIndex
+	assert(index < (Widelands::INVALID_INDEX - 2));  // allowing for INVALID_INDEX
 	items_.emplace_back(item);
 	name_to_index_[item->name()] = index;
 	return index;
@@ -90,4 +92,6 @@
 	return items_[index].get();
 }
 
-#endif  // end of include guard: WL_LOGIC_DESCRIPTION_MAINTAINER_H
+} // namespace Widelands
+
+#endif  // end of include guard: WL_LOGIC_MAP_OBJECTS_DESCRIPTION_MAINTAINER_H

=== renamed file 'src/logic/findbob.cc' => 'src/logic/map_objects/findbob.cc'
--- src/logic/findbob.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findbob.cc	2019-04-20 05:49:35 +0000
@@ -17,7 +17,7 @@
  *
  */
 
-#include "logic/findbob.h"
+#include "logic/map_objects/findbob.h"
 
 #include "base/macros.h"
 #include "logic/map_objects/tribes/soldier.h"

=== renamed file 'src/logic/findbob.h' => 'src/logic/map_objects/findbob.h'
--- src/logic/findbob.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findbob.h	2019-04-20 05:49:35 +0000
@@ -17,8 +17,8 @@
  *
  */
 
-#ifndef WL_LOGIC_FINDBOB_H
-#define WL_LOGIC_FINDBOB_H
+#ifndef WL_LOGIC_MAP_OBJECTS_FINDBOB_H
+#define WL_LOGIC_MAP_OBJECTS_FINDBOB_H
 
 #include "logic/map.h"
 
@@ -60,4 +60,4 @@
 
 }  // namespace Widelands
 
-#endif  // end of include guard: WL_LOGIC_FINDBOB_H
+#endif  // end of include guard: WL_LOGIC_MAP_OBJECTS_FINDBOB_H

=== renamed file 'src/logic/findimmovable.cc' => 'src/logic/map_objects/findimmovable.cc'
--- src/logic/findimmovable.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findimmovable.cc	2019-04-20 05:49:35 +0000
@@ -17,7 +17,7 @@
  *
  */
 
-#include "logic/findimmovable.h"
+#include "logic/map_objects/findimmovable.h"
 
 #include "base/macros.h"
 #include "economy/flag.h"

=== renamed file 'src/logic/findimmovable.h' => 'src/logic/map_objects/findimmovable.h'
--- src/logic/findimmovable.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findimmovable.h	2019-04-20 05:49:35 +0000
@@ -17,8 +17,8 @@
  *
  */
 
-#ifndef WL_LOGIC_FINDIMMOVABLE_H
-#define WL_LOGIC_FINDIMMOVABLE_H
+#ifndef WL_LOGIC_MAP_OBJECTS_FINDIMMOVABLE_H
+#define WL_LOGIC_MAP_OBJECTS_FINDIMMOVABLE_H
 
 #include <stdint.h>
 
@@ -164,4 +164,4 @@
 
 }  // namespace Widelands
 
-#endif  // end of include guard: WL_LOGIC_FINDIMMOVABLE_H
+#endif  // end of include guard: WL_LOGIC_MAP_OBJECTS_FINDIMMOVABLE_H

=== renamed file 'src/logic/findnode.cc' => 'src/logic/map_objects/findnode.cc'
--- src/logic/findnode.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findnode.cc	2019-04-20 05:49:35 +0000
@@ -17,7 +17,7 @@
  *
  */
 
-#include "logic/findnode.h"
+#include "logic/map_objects/findnode.h"
 
 #include "base/wexception.h"
 #include "logic/field.h"

=== renamed file 'src/logic/findnode.h' => 'src/logic/map_objects/findnode.h'
--- src/logic/findnode.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/findnode.h	2019-04-20 05:49:35 +0000
@@ -17,8 +17,8 @@
  *
  */
 
-#ifndef WL_LOGIC_FINDNODE_H
-#define WL_LOGIC_FINDNODE_H
+#ifndef WL_LOGIC_MAP_OBJECTS_FINDNODE_H
+#define WL_LOGIC_MAP_OBJECTS_FINDNODE_H
 
 #include <vector>
 

=== modified file 'src/logic/map_objects/terrain_affinity.cc'
--- src/logic/map_objects/terrain_affinity.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/terrain_affinity.cc	2019-04-20 05:49:35 +0000
@@ -21,10 +21,10 @@
 
 #include <vector>
 
-#include "logic/description_maintainer.h"
 #include "logic/field.h"
 #include "logic/game_data_error.h"
 #include "logic/map.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/world/terrain_description.h"
 #include "logic/widelands_geometry.h"
 #include "scripting/lua_table.h"

=== modified file 'src/logic/map_objects/terrain_affinity.h'
--- src/logic/map_objects/terrain_affinity.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/terrain_affinity.h	2019-04-20 05:49:35 +0000
@@ -23,7 +23,7 @@
 #include <string>
 
 #include "base/macros.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 
 class LuaTable;
 

=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc	2019-04-09 16:43:49 +0000
+++ src/logic/map_objects/tribes/building.cc	2019-04-20 05:49:35 +0000
@@ -56,9 +56,9 @@
 BuildingDescr::BuildingDescr(const std::string& init_descname,
                              const MapObjectType init_type,
                              const LuaTable& table,
-                             const EditorGameBase& egbase)
+                             const Tribes& tribes)
    : MapObjectDescr(init_type, table.get_string("name"), init_descname, table),
-     egbase_(egbase),
+     tribes_(tribes),
      buildable_(table.has_key("buildcost")),
      can_be_dismantled_(table.has_key("return_on_dismantle") ||
                         table.has_key("return_on_dismantle_on_enhanced")),
@@ -115,13 +115,13 @@
 		if (enh == name()) {
 			throw wexception("enhancement to same type");
 		}
-		DescriptionIndex const en_i = egbase_.tribes().building_index(enh);
-		if (egbase_.tribes().building_exists(en_i)) {
+		DescriptionIndex const en_i = tribes_.building_index(enh);
+		if (tribes_.building_exists(en_i)) {
 			enhancement_ = en_i;
 
 			//  Merge the enhancements workarea info into this building's
 			//  workarea info.
-			const BuildingDescr* tmp_enhancement = egbase_.tribes().get_building_descr(en_i);
+			const BuildingDescr* tmp_enhancement = tribes_.get_building_descr(en_i);
 			for (auto area : tmp_enhancement->workarea_info_) {
 				std::set<std::string>& strs = workarea_info_[area.first];
 				for (std::string str : area.second)
@@ -139,14 +139,14 @@
 	// However, we support "return_on_dismantle" without "buildable", because this is used by custom
 	// scenario buildings.
 	if (table.has_key("return_on_dismantle")) {
-		return_dismantle_ = Buildcost(table.get_table("return_on_dismantle"), egbase_.tribes());
+		return_dismantle_ = Buildcost(table.get_table("return_on_dismantle"), tribes_);
 	}
 	if (table.has_key("buildcost")) {
 		if (!table.has_key("return_on_dismantle")) {
 			throw wexception(
 			   "The building '%s' has a \"buildcost\" but no \"return_on_dismantle\"", name().c_str());
 		}
-		buildcost_ = Buildcost(table.get_table("buildcost"), egbase_.tribes());
+		buildcost_ = Buildcost(table.get_table("buildcost"), tribes_);
 	}
 
 	if (table.has_key("enhancement_cost")) {
@@ -156,9 +156,9 @@
 			                 "\"return_on_dismantle_on_enhanced\"",
 			                 name().c_str());
 		}
-		enhance_cost_ = Buildcost(table.get_table("enhancement_cost"), egbase_.tribes());
+		enhance_cost_ = Buildcost(table.get_table("enhancement_cost"), tribes_);
 		return_enhanced_ =
-		   Buildcost(table.get_table("return_on_dismantle_on_enhanced"), egbase_.tribes());
+		   Buildcost(table.get_table("return_on_dismantle_on_enhanced"), tribes_);
 	}
 
 	needs_seafaring_ = table.has_key("needs_seafaring") ? table.get_bool("needs_seafaring") : false;
@@ -229,7 +229,7 @@
 */
 Building& BuildingDescr::create_constructionsite() const {
 	BuildingDescr const* const descr =
-	   egbase_.tribes().get_building_descr(egbase_.tribes().safe_building_index("constructionsite"));
+	   tribes_.get_building_descr(tribes_.safe_building_index("constructionsite"));
 	ConstructionSite& csite = dynamic_cast<ConstructionSite&>(descr->create_object());
 	csite.set_building(*this);
 

=== modified file 'src/logic/map_objects/tribes/building.h'
--- src/logic/map_objects/tribes/building.h	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/building.h	2019-04-20 05:49:35 +0000
@@ -36,7 +36,6 @@
 #include "logic/map_objects/tribes/wareworker.h"
 #include "logic/map_objects/tribes/workarea_info.h"
 #include "logic/message.h"
-#include "logic/widelands.h"
 #include "notifications/notifications.h"
 #include "scripting/lua_table.h"
 
@@ -66,7 +65,7 @@
 	BuildingDescr(const std::string& init_descname,
 	              MapObjectType type,
 	              const LuaTable& t,
-	              const EditorGameBase& egbase);
+	              const Tribes& tribes);
 	~BuildingDescr() override {
 	}
 
@@ -172,9 +171,9 @@
 protected:
 	virtual Building& create_object() const = 0;
 	Building& create_constructionsite() const;
-	const EditorGameBase& egbase_;
 
 private:
+	const Tribes& tribes_;
 	const bool buildable_;          // the player can build this himself
 	const bool can_be_dismantled_;  // the player can dismantle this building
 	const bool destructible_;       // the player can destruct this himself

=== modified file 'src/logic/map_objects/tribes/carrier.cc'
--- src/logic/map_objects/tribes/carrier.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/carrier.cc	2019-04-20 05:49:35 +0000
@@ -569,8 +569,8 @@
 
 CarrierDescr::CarrierDescr(const std::string& init_descname,
                            const LuaTable& table,
-                           const EditorGameBase& egbase)
-   : WorkerDescr(init_descname, MapObjectType::CARRIER, table, egbase) {
+                           const Tribes& tribes)
+   : WorkerDescr(init_descname, MapObjectType::CARRIER, table, tribes) {
 }
 
 /**

=== modified file 'src/logic/map_objects/tribes/carrier.h'
--- src/logic/map_objects/tribes/carrier.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/carrier.h	2019-04-20 05:49:35 +0000
@@ -29,7 +29,7 @@
 public:
 	CarrierDescr(const std::string& init_descname,
 	             const LuaTable& table,
-	             const EditorGameBase& egbase);
+	             const Tribes& tribes);
 	~CarrierDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/constructionsite.cc'
--- src/logic/map_objects/tribes/constructionsite.cc	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/constructionsite.cc	2019-04-20 05:49:35 +0000
@@ -77,8 +77,8 @@
  */
 ConstructionSiteDescr::ConstructionSiteDescr(const std::string& init_descname,
                                              const LuaTable& table,
-                                             const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, MapObjectType::CONSTRUCTIONSITE, table, egbase) {
+                                             const Tribes& tribes)
+   : BuildingDescr(init_descname, MapObjectType::CONSTRUCTIONSITE, table, tribes) {
 	add_attribute(MapObject::CONSTRUCTIONSITE);
 }
 

=== modified file 'src/logic/map_objects/tribes/constructionsite.h'
--- src/logic/map_objects/tribes/constructionsite.h	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/constructionsite.h	2019-04-20 05:49:35 +0000
@@ -72,7 +72,7 @@
 public:
 	ConstructionSiteDescr(const std::string& init_descname,
 	                      const LuaTable& t,
-	                      const EditorGameBase& egbase);
+	                      const Tribes& tribes);
 	~ConstructionSiteDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/dismantlesite.cc'
--- src/logic/map_objects/tribes/dismantlesite.cc	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/dismantlesite.cc	2019-04-20 05:49:35 +0000
@@ -44,8 +44,8 @@
 
 DismantleSiteDescr::DismantleSiteDescr(const std::string& init_descname,
                                        const LuaTable& table,
-                                       const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, MapObjectType::DISMANTLESITE, table, egbase) {
+                                       const Tribes& tribes)
+   : BuildingDescr(init_descname, MapObjectType::DISMANTLESITE, table, tribes) {
 	add_attribute(MapObject::Attribute::CONSTRUCTIONSITE);  // Yep, this is correct.
 }
 

=== modified file 'src/logic/map_objects/tribes/dismantlesite.h'
--- src/logic/map_objects/tribes/dismantlesite.h	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/dismantlesite.h	2019-04-20 05:49:35 +0000
@@ -47,7 +47,7 @@
 public:
 	DismantleSiteDescr(const std::string& init_descname,
 	                   const LuaTable& t,
-	                   const EditorGameBase& egbase);
+	                   const Tribes& tribes);
 	~DismantleSiteDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/market.cc'
--- src/logic/map_objects/tribes/market.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/market.cc	2019-04-20 05:49:35 +0000
@@ -29,12 +29,12 @@
 
 MarketDescr::MarketDescr(const std::string& init_descname,
                          const LuaTable& table,
-                         const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, MapObjectType::MARKET, table, egbase) {
+                         const Tribes& tribes)
+   : BuildingDescr(init_descname, MapObjectType::MARKET, table, tribes) {
 	i18n::Textdomain td("tribes");
 
-	DescriptionIndex const woi = egbase.tribes().worker_index(table.get_string("carrier"));
-	if (!egbase.tribes().worker_exists(woi)) {
+	DescriptionIndex const woi = tribes.worker_index(table.get_string("carrier"));
+	if (!tribes.worker_exists(woi)) {
 		throw wexception("The tribe does not define the worker in 'carrier'.");
 	}
 	carrier_ = woi;

=== modified file 'src/logic/map_objects/tribes/market.h'
--- src/logic/map_objects/tribes/market.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/market.h	2019-04-20 05:49:35 +0000
@@ -30,7 +30,7 @@
 
 class MarketDescr : public BuildingDescr {
 public:
-	MarketDescr(const std::string& init_descname, const LuaTable& t, const EditorGameBase& egbase);
+	MarketDescr(const std::string& init_descname, const LuaTable& t, const Tribes& tribes);
 	~MarketDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
--- src/logic/map_objects/tribes/militarysite.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/militarysite.cc	2019-04-20 05:49:35 +0000
@@ -32,8 +32,8 @@
 #include "economy/request.h"
 #include "graphic/text_constants.h"
 #include "logic/editor_game_base.h"
-#include "logic/findbob.h"
 #include "logic/game.h"
+#include "logic/map_objects/findbob.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/soldier.h"
 #include "logic/map_objects/tribes/tribe_descr.h"
@@ -295,8 +295,8 @@
  */
 MilitarySiteDescr::MilitarySiteDescr(const std::string& init_descname,
                                      const LuaTable& table,
-                                     const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, MapObjectType::MILITARYSITE, table, egbase),
+                                     const Tribes& tribes)
+   : BuildingDescr(init_descname, MapObjectType::MILITARYSITE, table, tribes),
      conquer_radius_(0),
      num_soldiers_(0),
      heal_per_second_(0) {

=== modified file 'src/logic/map_objects/tribes/militarysite.h'
--- src/logic/map_objects/tribes/militarysite.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/militarysite.h	2019-04-20 05:49:35 +0000
@@ -44,7 +44,7 @@
 public:
 	MilitarySiteDescr(const std::string& init_descname,
 	                  const LuaTable& t,
-	                  const EditorGameBase& egbase);
+	                  const Tribes& tribes);
 	~MilitarySiteDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc	2019-04-11 05:45:55 +0000
+++ src/logic/map_objects/tribes/production_program.cc	2019-04-20 05:49:35 +0000
@@ -34,11 +34,11 @@
 #include "economy/input_queue.h"
 #include "helper.h"
 #include "io/filesystem/layered_filesystem.h"
-#include "logic/findimmovable.h"
-#include "logic/findnode.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findimmovable.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/productionsite.h"
 #include "logic/map_objects/tribes/soldier.h"
 #include "logic/map_objects/tribes/soldiercontrol.h"
@@ -1616,7 +1616,7 @@
 ProductionProgram::ProductionProgram(const std::string& init_name,
                                      const std::string& init_descname,
                                      std::unique_ptr<LuaTable> actions_table,
-                                     const EditorGameBase& egbase,
+                                     const Tribes& tribes, const World& world,
                                      ProductionSiteDescr* building)
    : name_(init_name), descname_(init_descname) {
 
@@ -1633,7 +1633,7 @@
 
 		if (boost::iequals(parts[0], "return")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActReturn(arguments.get(), *building, egbase.tribes())));
+			   new ActReturn(arguments.get(), *building, tribes)));
 		} else if (boost::iequals(parts[0], "call")) {
 			actions_.push_back(
 			   std::unique_ptr<ProductionProgram::Action>(new ActCall(arguments.get(), *building)));
@@ -1645,19 +1645,19 @@
 			   std::unique_ptr<ProductionProgram::Action>(new ActAnimate(arguments.get(), building)));
 		} else if (boost::iequals(parts[0], "consume")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActConsume(arguments.get(), *building, egbase.tribes())));
+			   new ActConsume(arguments.get(), *building, tribes)));
 		} else if (boost::iequals(parts[0], "produce")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActProduce(arguments.get(), *building, egbase.tribes())));
+			   new ActProduce(arguments.get(), *building, tribes)));
 		} else if (boost::iequals(parts[0], "recruit")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActRecruit(arguments.get(), *building, egbase.tribes())));
+			   new ActRecruit(arguments.get(), *building, tribes)));
 		} else if (boost::iequals(parts[0], "callworker")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActCallWorker(arguments.get(), name(), building, egbase.tribes())));
+			   new ActCallWorker(arguments.get(), name(), building, tribes)));
 		} else if (boost::iequals(parts[0], "mine")) {
 			actions_.push_back(std::unique_ptr<ProductionProgram::Action>(
-			   new ActMine(arguments.get(), egbase.world(), name(), building)));
+			   new ActMine(arguments.get(), world, name(), building)));
 		} else if (boost::iequals(parts[0], "checksoldier")) {
 			actions_.push_back(
 			   std::unique_ptr<ProductionProgram::Action>(new ActCheckSoldier(arguments.get())));

=== modified file 'src/logic/map_objects/tribes/production_program.h'
--- src/logic/map_objects/tribes/production_program.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/production_program.h	2019-04-20 05:49:35 +0000
@@ -31,11 +31,11 @@
 
 #include "base/log.h"
 #include "base/macros.h"
-#include "logic/editor_game_base.h"
 #include "logic/map_objects/tribes/bill_of_materials.h"
+#include "logic/map_objects/buildcost.h"
 #include "logic/map_objects/tribes/program_result.h"
 #include "logic/map_objects/tribes/training_attribute.h"
-#include "logic/widelands.h"
+#include "logic/map_objects/tribes/wareworker.h"
 #include "scripting/lua_table.h"
 
 namespace Widelands {
@@ -45,6 +45,7 @@
 class ProductionSiteDescr;
 class ProductionSite;
 class TribeDescr;
+class Tribes;
 class Worker;
 class World;
 
@@ -538,7 +539,7 @@
 	ProductionProgram(const std::string& init_name,
 	                  const std::string& init_descname,
 	                  std::unique_ptr<LuaTable> actions_table,
-	                  const EditorGameBase& egbase,
+	                  const Tribes& tribes, const World& world,
 	                  ProductionSiteDescr* building);
 
 	const std::string& name() const;

=== modified file 'src/logic/map_objects/tribes/productionsite.cc'
--- src/logic/map_objects/tribes/productionsite.cc	2019-04-09 17:16:11 +0000
+++ src/logic/map_objects/tribes/productionsite.cc	2019-04-20 05:49:35 +0000
@@ -53,7 +53,7 @@
 // Parses the descriptions of the working positions from 'items_table' and
 // fills in 'working_positions'. Throws an error if the table contains invalid
 // values.
-void parse_working_positions(const EditorGameBase& egbase,
+void parse_working_positions(const Tribes& tribes,
                              LuaTable* items_table,
                              BillOfMaterials* working_positions) {
 	for (const std::string& worker_name : items_table->keys<std::string>()) {
@@ -62,8 +62,8 @@
 			if (amount < 1 || 255 < amount) {
 				throw wexception("count is out of range 1 .. 255");
 			}
-			DescriptionIndex const woi = egbase.tribes().worker_index(worker_name);
-			if (!egbase.tribes().worker_exists(woi)) {
+			DescriptionIndex const woi = tribes.worker_index(worker_name);
+			if (!tribes.worker_exists(woi)) {
 				throw wexception("invalid");
 			}
 			working_positions->push_back(std::pair<DescriptionIndex, uint32_t>(woi, amount));
@@ -91,8 +91,9 @@
                                          const std::string& msgctxt,
                                          MapObjectType init_type,
                                          const LuaTable& table,
-                                         const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, init_type, table, egbase),
+                                         const Tribes& tribes,
+                                         const World& world)
+   : BuildingDescr(init_descname, init_type, table, tribes),
      out_of_resource_productivity_threshold_(100) {
 	if (msgctxt.empty()) {
 		throw Widelands::GameDataError(
@@ -121,15 +122,15 @@
 	if (table.has_key("outputs")) {
 		for (const std::string& output : table.get_table("outputs")->array_entries<std::string>()) {
 			try {
-				DescriptionIndex idx = egbase.tribes().ware_index(output);
-				if (egbase.tribes().ware_exists(idx)) {
+				DescriptionIndex idx = tribes.ware_index(output);
+				if (tribes.ware_exists(idx)) {
 					if (output_ware_types_.count(idx)) {
 						throw wexception("this ware type has already been declared as an output");
 					}
 					output_ware_types_.insert(idx);
 				} else {
-					idx = egbase.tribes().worker_index(output);
-					if (egbase.tribes().worker_exists(idx)) {
+					idx = tribes.worker_index(output);
+					if (tribes.worker_exists(idx)) {
 						if (output_worker_types_.count(idx)) {
 							throw wexception("this worker type has already been declared as an output");
 						}
@@ -154,8 +155,8 @@
 				if (amount < 1 || 255 < amount) {
 					throw wexception("amount is out of range 1 .. 255");
 				}
-				DescriptionIndex idx = egbase.tribes().ware_index(ware_name);
-				if (egbase.tribes().ware_exists(idx)) {
+				DescriptionIndex idx = tribes.ware_index(ware_name);
+				if (tribes.ware_exists(idx)) {
 					for (const auto& temp_inputs : input_wares()) {
 						if (temp_inputs.first == idx) {
 							throw wexception("duplicated");
@@ -163,8 +164,8 @@
 					}
 					input_wares_.push_back(WareAmount(idx, amount));
 				} else {
-					idx = egbase.tribes().worker_index(ware_name);
-					if (egbase.tribes().worker_exists(idx)) {
+					idx = tribes.worker_index(ware_name);
+					if (tribes.worker_exists(idx)) {
 						for (const auto& temp_inputs : input_workers()) {
 							if (temp_inputs.first == idx) {
 								throw wexception("duplicated");
@@ -181,7 +182,7 @@
 		}
 	}
 
-	parse_working_positions(egbase, table.get_table("working_positions").get(), &working_positions_);
+	parse_working_positions(tribes, table.get_table("working_positions").get(), &working_positions_);
 
 	// Get programs
 	items_table = table.get_table("programs");
@@ -201,7 +202,7 @@
 				program_descname = pgettext_expr(msgctxt_char, program_descname_unlocalized.c_str());
 			}
 			programs_[program_name] = std::unique_ptr<ProductionProgram>(new ProductionProgram(
-			   program_name, program_descname, program_table->get_table("actions"), egbase, this));
+			   program_name, program_descname, program_table->get_table("actions"), tribes, world, this));
 		} catch (const std::exception& e) {
 			throw wexception("program %s: %s", program_name.c_str(), e.what());
 		}
@@ -209,12 +210,12 @@
 
 	// Verify that any map resource collected is valid
 	if (!hints().collects_ware_from_map().empty()) {
-		if (!(egbase_.tribes().ware_exists(hints().collects_ware_from_map()))) {
+		if (!(tribes.ware_exists(hints().collects_ware_from_map()))) {
 			throw GameDataError("ai_hints for building %s collects nonexistent ware %s from map",
 			                    name().c_str(), hints().collects_ware_from_map().c_str());
 		}
 		const DescriptionIndex collects_index =
-		   egbase_.tribes().safe_ware_index(hints().collects_ware_from_map());
+		   tribes.safe_ware_index(hints().collects_ware_from_map());
 		if (!is_output_ware_type(collects_index)) {
 			throw GameDataError("ai_hints for building %s collects ware %s from map, but it's not "
 			                    "listed in the building's output",
@@ -226,8 +227,8 @@
 ProductionSiteDescr::ProductionSiteDescr(const std::string& init_descname,
                                          const std::string& msgctxt,
                                          const LuaTable& table,
-                                         const EditorGameBase& egbase)
-   : ProductionSiteDescr(init_descname, msgctxt, MapObjectType::PRODUCTIONSITE, table, egbase) {
+                                         const Tribes& tribes, const World& world)
+   : ProductionSiteDescr(init_descname, msgctxt, MapObjectType::PRODUCTIONSITE, table, tribes, world) {
 }
 
 /**

=== modified file 'src/logic/map_objects/tribes/productionsite.h'
--- src/logic/map_objects/tribes/productionsite.h	2019-04-11 05:45:55 +0000
+++ src/logic/map_objects/tribes/productionsite.h	2019-04-20 05:49:35 +0000
@@ -63,11 +63,12 @@
 	                    const std::string& msgctxt,
 	                    MapObjectType type,
 	                    const LuaTable& t,
-	                    const EditorGameBase& egbase);
+	                    const Tribes& tribes, const World& world);
 	ProductionSiteDescr(const std::string& init_descname,
 	                    const std::string& msgctxt,
 	                    const LuaTable& t,
-	                    const EditorGameBase& egbase);
+	                    const Tribes& tribes,
+	                    const World& world);
 
 	Building& create_object() const override;
 

=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/ship.cc	2019-04-20 05:49:35 +0000
@@ -34,10 +34,10 @@
 #include "graphic/text_constants.h"
 #include "io/fileread.h"
 #include "io/filewrite.h"
-#include "logic/findbob.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
 #include "logic/map.h"
+#include "logic/map_objects/findbob.h"
 #include "logic/map_objects/tribes/constructionsite.h"
 #include "logic/map_objects/tribes/tribe_descr.h"
 #include "logic/map_objects/tribes/warehouse.h"

=== modified file 'src/logic/map_objects/tribes/soldier.cc'
--- src/logic/map_objects/tribes/soldier.cc	2019-02-28 12:22:36 +0000
+++ src/logic/map_objects/tribes/soldier.cc	2019-04-20 05:49:35 +0000
@@ -36,13 +36,13 @@
 #include "io/fileread.h"
 #include "io/filewrite.h"
 #include "logic/editor_game_base.h"
-#include "logic/findbob.h"
-#include "logic/findimmovable.h"
-#include "logic/findnode.h"
 #include "logic/game.h"
 #include "logic/game_controller.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findbob.h"
+#include "logic/map_objects/findimmovable.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/building.h"
 #include "logic/map_objects/tribes/militarysite.h"
@@ -63,8 +63,8 @@
 
 SoldierDescr::SoldierDescr(const std::string& init_descname,
                            const LuaTable& table,
-                           const EditorGameBase& egbase)
-   : WorkerDescr(init_descname, MapObjectType::SOLDIER, table, egbase),
+                           const Tribes& tribes)
+   : WorkerDescr(init_descname, MapObjectType::SOLDIER, table, tribes),
      health_(table.get_table("health")),
      attack_(table.get_table("attack")),
      defense_(table.get_table("defense")),

=== modified file 'src/logic/map_objects/tribes/soldier.h'
--- src/logic/map_objects/tribes/soldier.h	2019-02-27 17:19:00 +0000
+++ src/logic/map_objects/tribes/soldier.h	2019-04-20 05:49:35 +0000
@@ -41,7 +41,7 @@
 public:
 	friend class Economy;
 
-	SoldierDescr(const std::string& init_descname, const LuaTable& t, const EditorGameBase& egbase);
+	SoldierDescr(const std::string& init_descname, const LuaTable& t, const Tribes& tribes);
 	~SoldierDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/trainingsite.cc'
--- src/logic/map_objects/tribes/trainingsite.cc	2019-04-08 06:17:54 +0000
+++ src/logic/map_objects/tribes/trainingsite.cc	2019-04-20 05:49:35 +0000
@@ -48,8 +48,8 @@
 TrainingSiteDescr::TrainingSiteDescr(const std::string& init_descname,
                                      const std::string& msgctxt,
                                      const LuaTable& table,
-                                     const EditorGameBase& egbase)
-   : ProductionSiteDescr(init_descname, msgctxt, MapObjectType::TRAININGSITE, table, egbase),
+                                     const Tribes& tribes, const World& world)
+   : ProductionSiteDescr(init_descname, msgctxt, MapObjectType::TRAININGSITE, table, tribes, world),
      num_soldiers_(table.get_int("soldier_capacity")),
      max_stall_(table.get_int("trainer_patience")),
 

=== modified file 'src/logic/map_objects/tribes/trainingsite.h'
--- src/logic/map_objects/tribes/trainingsite.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/trainingsite.h	2019-04-20 05:49:35 +0000
@@ -36,7 +36,7 @@
 	TrainingSiteDescr(const std::string& init_descname,
 	                  const std::string& msgctxt,
 	                  const LuaTable& table,
-	                  const EditorGameBase& egbase);
+	                  const Tribes& tribes, const World& world);
 	~TrainingSiteDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/tribe_descr.cc'
--- src/logic/map_objects/tribes/tribe_descr.cc	2019-04-09 16:43:49 +0000
+++ src/logic/map_objects/tribes/tribe_descr.cc	2019-04-20 05:49:35 +0000
@@ -31,7 +31,6 @@
 #include "base/wexception.h"
 #include "graphic/graphic.h"
 #include "io/filesystem/layered_filesystem.h"
-#include "logic/editor_game_base.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/immovable.h"

=== modified file 'src/logic/map_objects/tribes/tribe_descr.h'
--- src/logic/map_objects/tribes/tribe_descr.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/tribe_descr.h	2019-04-20 05:49:35 +0000
@@ -26,8 +26,6 @@
 
 #include "base/macros.h"
 #include "graphic/animation.h"
-#include "logic/description_maintainer.h"
-#include "logic/editor_game_base.h"
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/tribes/building.h"
 #include "logic/map_objects/tribes/road_textures.h"
@@ -36,10 +34,10 @@
 #include "logic/map_objects/tribes/tribes.h"
 #include "logic/map_objects/tribes/ware_descr.h"
 #include "logic/map_objects/tribes/worker.h"
+#include "logic/widelands.h"
 
 namespace Widelands {
 
-class EditorGameBase;
 class ResourceDescription;
 class WareDescr;
 class Warehouse;

=== modified file 'src/logic/map_objects/tribes/tribes.cc'
--- src/logic/map_objects/tribes/tribes.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/tribes.cc	2019-04-20 05:49:35 +0000
@@ -37,55 +37,55 @@
      tribes_(new DescriptionMaintainer<TribeDescr>()) {
 }
 
-void Tribes::add_constructionsite_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_constructionsite_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	buildings_->add(new ConstructionSiteDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_dismantlesite_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_dismantlesite_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	buildings_->add(new DismantleSiteDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_militarysite_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_militarysite_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	buildings_->add(new MilitarySiteDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_productionsite_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_productionsite_type(const LuaTable& table, const World& world) {
 	i18n::Textdomain td("tribes");
 	const std::string msgctxt = table.get_string("msgctxt");
 	buildings_->add(
 	   new ProductionSiteDescr(pgettext_expr(msgctxt.c_str(), table.get_string("descname").c_str()),
-	                           msgctxt, table, egbase));
+	                           msgctxt, table, *this, world));
 }
 
-void Tribes::add_trainingsite_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_trainingsite_type(const LuaTable& table, const World& world) {
 	i18n::Textdomain td("tribes");
 	const std::string msgctxt = table.get_string("msgctxt");
 	buildings_->add(
 	   new TrainingSiteDescr(pgettext_expr(msgctxt.c_str(), table.get_string("descname").c_str()),
-	                         msgctxt, table, egbase));
+	                         msgctxt, table, *this, world));
 }
 
-void Tribes::add_warehouse_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_warehouse_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	buildings_->add(new WarehouseDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_market_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_market_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	buildings_->add(new MarketDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
 void Tribes::add_immovable_type(const LuaTable& table) {
@@ -107,31 +107,31 @@
 	   table));
 }
 
-void Tribes::add_carrier_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_carrier_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	workers_->add(new CarrierDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_soldier_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_soldier_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	workers_->add(new SoldierDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_worker_type(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_worker_type(const LuaTable& table) {
 	i18n::Textdomain td("tribes");
 	workers_->add(new WorkerDescr(
 	   pgettext_expr(table.get_string("msgctxt").c_str(), table.get_string("descname").c_str()),
-	   table, egbase));
+	   table, *this));
 }
 
-void Tribes::add_tribe(const LuaTable& table, const EditorGameBase& egbase) {
+void Tribes::add_tribe(const LuaTable& table) {
 	const std::string name = table.get_string("name");
 	if (Widelands::tribe_exists(name)) {
-		tribes_->add(new TribeDescr(table, Widelands::get_tribeinfo(name), egbase.tribes()));
+		tribes_->add(new TribeDescr(table, Widelands::get_tribeinfo(name), *this));
 	} else {
 		throw GameDataError("The tribe '%s'' has no preload file.", name.c_str());
 	}

=== modified file 'src/logic/map_objects/tribes/tribes.h'
--- src/logic/map_objects/tribes/tribes.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/tribes.h	2019-04-20 05:49:35 +0000
@@ -24,7 +24,7 @@
 
 #include "base/macros.h"
 #include "graphic/texture.h"
-#include "logic/description_maintainer.h"
+#include "logic/map_objects/description_maintainer.h"
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/tribes/carrier.h"
 #include "logic/map_objects/tribes/constructionsite.h"
@@ -53,25 +53,25 @@
 	}
 
 	/// Adds this building type to the tribe description.
-	void add_constructionsite_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_dismantlesite_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_militarysite_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_productionsite_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_trainingsite_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_warehouse_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this building type to the tribe description.
-	void add_market_type(const LuaTable& table, const EditorGameBase& egbase);
+	void add_constructionsite_type(const LuaTable& table);
+
+	/// Adds this building type to the tribe description.
+	void add_dismantlesite_type(const LuaTable& table);
+
+	/// Adds this building type to the tribe description.
+	void add_militarysite_type(const LuaTable& table);
+
+	/// Adds this building type to the tribe description.
+	void add_productionsite_type(const LuaTable& table, const World& world);
+
+	/// Adds this building type to the tribe description.
+	void add_trainingsite_type(const LuaTable& table, const World& world);
+
+	/// Adds this building type to the tribe description.
+	void add_warehouse_type(const LuaTable& table);
+
+	/// Adds this building type to the tribe description.
+	void add_market_type(const LuaTable& table);
 
 	/// Adds this immovable type to the tribe description.
 	void add_immovable_type(const LuaTable& table);
@@ -83,16 +83,16 @@
 	void add_ware_type(const LuaTable& table);
 
 	/// Adds this worker type to the tribe description.
-	void add_carrier_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this worker type to the tribe description.
-	void add_soldier_type(const LuaTable& table, const EditorGameBase& egbase);
-
-	/// Adds this worker type to the tribe description.
-	void add_worker_type(const LuaTable& table, const EditorGameBase& egbase);
+	void add_carrier_type(const LuaTable& table);
+
+	/// Adds this worker type to the tribe description.
+	void add_soldier_type(const LuaTable& table);
+
+	/// Adds this worker type to the tribe description.
+	void add_worker_type(const LuaTable& table);
 
 	/// Adds a specific tribe's configuration.
-	void add_tribe(const LuaTable& table, const EditorGameBase& egbase);
+	void add_tribe(const LuaTable& table);
 
 	void add_custom_building(const LuaTable& table);
 

=== modified file 'src/logic/map_objects/tribes/warehouse.cc'
--- src/logic/map_objects/tribes/warehouse.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/warehouse.cc	2019-04-20 05:49:35 +0000
@@ -37,9 +37,9 @@
 #include "economy/warehousesupply.h"
 #include "economy/wares_queue.h"
 #include "logic/editor_game_base.h"
-#include "logic/findbob.h"
-#include "logic/findnode.h"
 #include "logic/game.h"
+#include "logic/map_objects/findbob.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/tribes/battle.h"
 #include "logic/map_objects/tribes/carrier.h"
 #include "logic/map_objects/tribes/requirements.h"
@@ -292,8 +292,8 @@
  */
 WarehouseDescr::WarehouseDescr(const std::string& init_descname,
                                const LuaTable& table,
-                               const EditorGameBase& egbase)
-   : BuildingDescr(init_descname, MapObjectType::WAREHOUSE, table, egbase),
+                               const Tribes& tribes)
+   : BuildingDescr(init_descname, MapObjectType::WAREHOUSE, table, tribes),
      conquers_(0),
      heal_per_second_(0) {
 	heal_per_second_ = table.get_int("heal_per_second");

=== modified file 'src/logic/map_objects/tribes/warehouse.h'
--- src/logic/map_objects/tribes/warehouse.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/warehouse.h	2019-04-20 05:49:35 +0000
@@ -50,7 +50,7 @@
 public:
 	WarehouseDescr(const std::string& init_descname,
 	               const LuaTable& t,
-	               const EditorGameBase& egbase);
+	               const Tribes& tribes);
 	~WarehouseDescr() override {
 	}
 

=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2019-04-09 16:43:49 +0000
+++ src/logic/map_objects/tribes/worker.cc	2019-04-20 05:49:35 +0000
@@ -39,13 +39,13 @@
 #include "io/fileread.h"
 #include "io/filewrite.h"
 #include "logic/cmd_incorporate.h"
-#include "logic/findbob.h"
-#include "logic/findimmovable.h"
-#include "logic/findnode.h"
 #include "logic/game.h"
 #include "logic/game_controller.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findbob.h"
+#include "logic/map_objects/findimmovable.h"
+#include "logic/map_objects/findnode.h"
 #include "logic/map_objects/terrain_affinity.h"
 #include "logic/map_objects/tribes/carrier.h"
 #include "logic/map_objects/tribes/dismantlesite.h"

=== modified file 'src/logic/map_objects/tribes/worker_descr.cc'
--- src/logic/map_objects/tribes/worker_descr.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/worker_descr.cc	2019-04-20 05:49:35 +0000
@@ -37,7 +37,7 @@
 WorkerDescr::WorkerDescr(const std::string& init_descname,
                          MapObjectType init_type,
                          const LuaTable& table,
-                         const EditorGameBase& egbase)
+                         const Tribes& tribes)
    : BobDescr(init_descname, init_type, MapObjectDescr::OwnerType::kTribe, table),
      ware_hotspot_(table.has_key("ware_hotspot") ?
                       table.get_vector<std::string, int>("ware_hotspot") :
@@ -50,10 +50,10 @@
      // other key must be there too. So, we cross the checks to trigger an exception if this is
      // violated.
      becomes_(table.has_key("experience") ?
-                 egbase.tribes().safe_worker_index(table.get_string("becomes")) :
+                 tribes.safe_worker_index(table.get_string("becomes")) :
                  INVALID_INDEX),
      needed_experience_(table.has_key("becomes") ? table.get_int("experience") : INVALID_INDEX),
-     egbase_(egbase) {
+     tribes_(tribes) {
 	if (helptext_script().empty()) {
 		throw GameDataError("Worker %s has no helptext script", name().c_str());
 	}
@@ -64,7 +64,6 @@
 	std::unique_ptr<LuaTable> items_table;
 
 	if (table.has_key("buildcost")) {
-		const Tribes& tribes = egbase_.tribes();
 		items_table = table.get_table("buildcost");
 		for (const std::string& key : items_table->keys<std::string>()) {
 			try {
@@ -113,7 +112,7 @@
 					throw wexception("this program has already been declared");
 
 				programs_[program_name] = std::unique_ptr<WorkerProgram>(
-				   new WorkerProgram(program_name, *this, egbase_.tribes()));
+				   new WorkerProgram(program_name, *this, tribes_));
 				programs_[program_name]->parse(*programs_table->get_table(program_name));
 			} catch (const std::exception& e) {
 				throw wexception("program %s: %s", program_name.c_str(), e.what());
@@ -124,8 +123,8 @@
 
 WorkerDescr::WorkerDescr(const std::string& init_descname,
                          const LuaTable& table,
-                         const EditorGameBase& egbase)
-   : WorkerDescr(init_descname, MapObjectType::WORKER, table, egbase) {
+                         const Tribes& tribes)
+   : WorkerDescr(init_descname, MapObjectType::WORKER, table, tribes) {
 }
 
 WorkerDescr::~WorkerDescr() {
@@ -173,19 +172,19 @@
  * check if worker can be substitute for a requested worker type
  */
 bool WorkerDescr::can_act_as(DescriptionIndex const index) const {
-	assert(egbase_.tribes().worker_exists(index));
+	assert(tribes_.worker_exists(index));
 	if (index == worker_index()) {
 		return true;
 	}
 
 	// if requested worker type can be promoted, compare with that type
-	const WorkerDescr& descr = *egbase_.tribes().get_worker_descr(index);
+	const WorkerDescr& descr = *tribes_.get_worker_descr(index);
 	DescriptionIndex const becomes_index = descr.becomes();
 	return becomes_index != INVALID_INDEX ? can_act_as(becomes_index) : false;
 }
 
 DescriptionIndex WorkerDescr::worker_index() const {
-	return egbase_.tribes().worker_index(name());
+	return tribes_.worker_index(name());
 }
 
 void WorkerDescr::add_employer(const DescriptionIndex& building_index) {

=== modified file 'src/logic/map_objects/tribes/worker_descr.h'
--- src/logic/map_objects/tribes/worker_descr.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/worker_descr.h	2019-04-20 05:49:35 +0000
@@ -48,8 +48,8 @@
 	WorkerDescr(const std::string& init_descname,
 	            MapObjectType type,
 	            const LuaTable& table,
-	            const EditorGameBase& egbase);
-	WorkerDescr(const std::string& init_descname, const LuaTable& t, const EditorGameBase& egbase);
+	            const Tribes& tribes);
+	WorkerDescr(const std::string& init_descname, const LuaTable& t, const Tribes& tribes);
 	~WorkerDescr() override;
 
 	Bob& create_object() const override;
@@ -144,8 +144,8 @@
 	/// Buildings where this worker can work
 	std::set<DescriptionIndex> employers_;
 
-	const EditorGameBase& egbase_;
-
+private:
+	const Tribes& tribes_;
 	DISALLOW_COPY_AND_ASSIGN(WorkerDescr);
 };
 }  // namespace Widelands

=== modified file 'src/logic/map_objects/tribes/worker_program.cc'
--- src/logic/map_objects/tribes/worker_program.cc	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/tribes/worker_program.cc	2019-04-20 05:49:35 +0000
@@ -24,8 +24,8 @@
 
 #include "base/log.h"
 #include "helper.h"
-#include "logic/findnode.h"
 #include "logic/game_data_error.h"
+#include "logic/map_objects/findnode.h"
 #include "sound/sound_handler.h"
 
 namespace Widelands {

=== modified file 'src/logic/map_objects/world/world.h'
--- src/logic/map_objects/world/world.h	2019-02-23 11:00:49 +0000
+++ src/logic/map_objects/world/world.h	2019-04-20 05:49:35 +0000
@@ -23,8 +23,7 @@
 #include <memory>
 
 #include "base/macros.h"
-#include "logic/description_maintainer.h"
-#include "logic/widelands.h"
+#include "logic/map_objects/description_maintainer.h"
 
 class LuaInterface;
 class LuaTable;
@@ -33,7 +32,6 @@
 
 struct CritterDescr;
 class EditorCategory;
-class EditorGameBase;
 class ImmovableDescr;
 class ResourceDescription;
 class TerrainDescription;

=== modified file 'src/logic/player.cc'
--- src/logic/player.cc	2019-04-09 16:43:49 +0000
+++ src/logic/player.cc	2019-04-20 05:49:35 +0000
@@ -39,10 +39,10 @@
 #include "io/filewrite.h"
 #include "logic/cmd_delete_message.h"
 #include "logic/cmd_luacoroutine.h"
-#include "logic/findimmovable.h"
 #include "logic/game.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findimmovable.h"
 #include "logic/map_objects/tribes/building.h"
 #include "logic/map_objects/tribes/constructionsite.h"
 #include "logic/map_objects/tribes/militarysite.h"

=== modified file 'src/logic/player_area.h'
--- src/logic/player_area.h	2019-02-23 11:00:49 +0000
+++ src/logic/player_area.h	2019-04-20 05:49:35 +0000
@@ -20,7 +20,6 @@
 #ifndef WL_LOGIC_PLAYER_AREA_H
 #define WL_LOGIC_PLAYER_AREA_H
 
-#include "logic/widelands.h"
 #include "logic/widelands_geometry.h"
 
 namespace Widelands {

=== modified file 'src/logic/widelands.h'
--- src/logic/widelands.h	2019-02-23 11:00:49 +0000
+++ src/logic/widelands.h	2019-04-20 05:49:35 +0000
@@ -63,7 +63,7 @@
  */
 using DescriptionIndex = uint8_t;
 
-constexpr uint8_t INVALID_INDEX = std::numeric_limits<uint8_t>::max();
+constexpr DescriptionIndex INVALID_INDEX = std::numeric_limits<uint8_t>::max();
 constexpr DescriptionIndex kInvalidWare = INVALID_INDEX - 1;
 constexpr DescriptionIndex kNoResource = INVALID_INDEX - 1;
 

=== modified file 'src/map_io/CMakeLists.txt'
--- src/map_io/CMakeLists.txt	2019-03-09 10:01:09 +0000
+++ src/map_io/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -14,7 +14,10 @@
     io_fileread
     io_filesystem
     logic
+    logic_constants
     logic_filesystem_constants
+    logic_map
+    logic_map_objects
     map_io
     scripting_lua_interface
 )
@@ -107,7 +110,10 @@
     logic
     logic_constants
     logic_exceptions
+    logic_map
+    logic_map_objects
     logic_widelands_geometry
+    logic_widelands_geometry_io
     profile
     scripting_logic
 )

=== modified file 'src/map_io/map_elemental_packet.cc'
--- src/map_io/map_elemental_packet.cc	2019-02-23 11:00:49 +0000
+++ src/map_io/map_elemental_packet.cc	2019-04-20 05:49:35 +0000
@@ -25,7 +25,6 @@
 #include "logic/editor_game_base.h"
 #include "logic/game_data_error.h"
 #include "logic/map.h"
-#include "logic/widelands.h"
 #include "profile/profile.h"
 
 namespace Widelands {

=== modified file 'src/map_io/map_object_loader.h'
--- src/map_io/map_object_loader.h	2019-02-23 11:00:49 +0000
+++ src/map_io/map_object_loader.h	2019-04-20 05:49:35 +0000
@@ -28,7 +28,6 @@
 #include "base/macros.h"
 #include "logic/game_data_error.h"
 #include "logic/map_objects/map_object.h"
-#include "logic/widelands.h"
 
 namespace Widelands {
 class Bob;

=== modified file 'src/network/CMakeLists.txt'
--- src/network/CMakeLists.txt	2017-12-18 10:42:40 +0000
+++ src/network/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -49,10 +49,11 @@
     io_filesystem
     io_stream
     logic
-    logic_constants
+    logic_commands
     logic_filesystem_constants
     logic_game_controller
     logic_game_settings
+    logic_map_objects
     logic_tribe_basic_info
     map_io_map_loader
     profile

=== modified file 'src/network/gamehost.h'
--- src/network/gamehost.h	2019-02-23 11:00:49 +0000
+++ src/network/gamehost.h	2019-04-20 05:49:35 +0000
@@ -23,7 +23,6 @@
 #include "logic/game_controller.h"
 #include "logic/game_settings.h"
 #include "logic/player_end_result.h"
-#include "logic/widelands.h"
 #include "network/nethost_interface.h"
 #include "network/network.h"
 #include "ui_basic/unique_window.h"

=== modified file 'src/network/network_player_settings_backend.h'
--- src/network/network_player_settings_backend.h	2019-02-23 11:00:49 +0000
+++ src/network/network_player_settings_backend.h	2019-04-20 05:49:35 +0000
@@ -21,7 +21,6 @@
 #define WL_NETWORK_NETWORK_PLAYER_SETTINGS_BACKEND_H
 
 #include "logic/game_settings.h"
-#include "logic/widelands.h"
 
 struct NetworkPlayerSettingsBackend {
 

=== modified file 'src/scripting/CMakeLists.txt'
--- src/scripting/CMakeLists.txt	2018-09-14 08:44:42 +0000
+++ src/scripting/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -110,10 +110,13 @@
     io_filesystem
     logic
     logic_campaign_visibility
+    logic_commands
     logic_constants
     logic_filesystem_constants
     logic_game_controller
     logic_game_settings
+    logic_map
+    logic_map_objects
     logic_tribe_basic_info
     logic_widelands_geometry
     map_io

=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc	2019-04-09 16:43:49 +0000
+++ src/scripting/lua_map.cc	2019-04-20 05:49:35 +0000
@@ -27,8 +27,8 @@
 #include "base/macros.h"
 #include "base/wexception.h"
 #include "economy/input_queue.h"
-#include "logic/findimmovable.h"
 #include "logic/map_objects/checkstep.h"
+#include "logic/map_objects/findimmovable.h"
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/terrain_affinity.h"
 #include "logic/map_objects/tribes/carrier.h"

=== modified file 'src/scripting/lua_root.cc'
--- src/scripting/lua_root.cc	2019-02-23 11:00:49 +0000
+++ src/scripting/lua_root.cc	2019-04-20 05:49:35 +0000
@@ -24,9 +24,9 @@
 #include <boost/format.hpp>
 
 #include "logic/cmd_luacoroutine.h"
-#include "logic/findimmovable.h"
 #include "logic/game.h"
 #include "logic/game_controller.h"
+#include "logic/map_objects/findimmovable.h"
 #include "logic/map_objects/immovable.h"
 #include "logic/map_objects/tribes/tribe_descr.h"
 #include "logic/map_objects/tribes/tribes.h"
@@ -586,8 +586,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_constructionsite_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_constructionsite_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -610,8 +609,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_dismantlesite_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_dismantlesite_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -634,8 +632,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_militarysite_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_militarysite_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -659,7 +656,7 @@
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
 		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_productionsite_type(table, egbase);
+		egbase.mutable_tribes()->add_productionsite_type(table, egbase.world());
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -683,7 +680,7 @@
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
 		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_trainingsite_type(table, egbase);
+		egbase.mutable_tribes()->add_trainingsite_type(table, egbase.world());
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -706,8 +703,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_warehouse_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_warehouse_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -731,8 +727,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_market_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_market_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -823,8 +818,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_carrier_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_carrier_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -846,8 +840,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_soldier_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_soldier_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -869,8 +862,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_worker_type(table, egbase);
+		get_egbase(L).mutable_tribes()->add_worker_type(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}
@@ -893,8 +885,7 @@
 
 	try {
 		LuaTable table(L);  // Will pop the table eventually.
-		EditorGameBase& egbase = get_egbase(L);
-		egbase.mutable_tribes()->add_tribe(table, egbase);
+		get_egbase(L).mutable_tribes()->add_tribe(table);
 	} catch (std::exception& e) {
 		report_error(L, "%s", e.what());
 	}

=== modified file 'src/ui_fsmenu/CMakeLists.txt'
--- src/ui_fsmenu/CMakeLists.txt	2018-02-13 16:52:12 +0000
+++ src/ui_fsmenu/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -162,6 +162,16 @@
     base_macros
     graphic
     graphic_text_constants
+    helper
+    io_filesystem
+    logic
+    logic_campaign_visibility
+    logic_filesystem_constants
+    logic_game_controller
+    logic_game_settings
+    logic_map
+    logic_map_objects
+    map_io_map_loader
     network
     profile
     random

=== modified file 'src/website/CMakeLists.txt'
--- src/website/CMakeLists.txt	2018-09-02 15:09:05 +0000
+++ src/website/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -27,6 +27,7 @@
     io_filesystem
     json
     logic
+    logic_map
     map_io_map_loader
     website_common
 )
@@ -43,6 +44,8 @@
     io_filesystem
     json
     logic
+    logic_map_objects
     logic_tribe_basic_info
+    sound
     website_common
 )

=== modified file 'src/wui/CMakeLists.txt'
--- src/wui/CMakeLists.txt	2018-11-13 12:18:10 +0000
+++ src/wui/CMakeLists.txt	2019-04-20 05:49:35 +0000
@@ -32,6 +32,8 @@
     economy
     graphic
     logic
+    logic_commands
+    logic_map_objects
     notifications
     ui_basic
     wui_waresdisplay
@@ -45,7 +47,7 @@
     mapviewpixelfunctions.h
   DEPENDS
     base_geometry
-    logic
+    logic_map
     logic_widelands_geometry
 )
 
@@ -105,8 +107,10 @@
     io_filesystem
     logic
     logic_constants
+    logic_filesystem_constants
     logic_game_controller
     logic_game_settings
+    logic_map
     map_io_map_loader
     ui_basic
     wui_common_suggested_teams
@@ -132,7 +136,7 @@
     graphic
     graphic_fields_to_draw
     graphic_game_renderer
-    logic
+    logic_map
     logic_widelands_geometry
     profile
     ui_basic
@@ -151,6 +155,7 @@
     graphic_fonthandler
     graphic_text_layout
     logic
+    logic_map_objects
     ui_basic
 )
 
@@ -281,10 +286,13 @@
     io_filesystem
     logic
     logic_constants
+    logic_commands
     logic_filesystem_constants
     logic_game_controller
     logic_game_settings
     logic_generic_save_handler
+    logic_map
+    logic_map_objects
     logic_tribe_basic_info
     logic_widelands_geometry
     network

=== modified file 'src/wui/building_statistics_menu.h'
--- src/wui/building_statistics_menu.h	2019-02-23 11:00:49 +0000
+++ src/wui/building_statistics_menu.h	2019-04-20 05:49:35 +0000
@@ -24,7 +24,6 @@
 
 #include "graphic/color.h"
 #include "logic/map_objects/tribes/building.h"
-#include "logic/widelands.h"
 #include "ui_basic/box.h"
 #include "ui_basic/button.h"
 #include "ui_basic/editbox.h"

=== modified file 'src/wui/debugconsole.cc'
--- src/wui/debugconsole.cc	2019-02-23 11:00:49 +0000
+++ src/wui/debugconsole.cc	2019-04-20 05:49:35 +0000
@@ -25,7 +25,6 @@
 
 #include "base/log.h"
 #include "chat/chat.h"
-#include "logic/widelands.h"
 
 namespace DebugConsole {
 

=== modified file 'src/wui/gamedetails.h'
--- src/wui/gamedetails.h	2019-02-23 11:00:49 +0000
+++ src/wui/gamedetails.h	2019-04-20 05:49:35 +0000
@@ -24,6 +24,7 @@
 
 #include "graphic/image.h"
 #include "logic/game_controller.h"
+#include "logic/widelands.h"
 #include "ui_basic/box.h"
 #include "ui_basic/icon.h"
 #include "ui_basic/multilinetextarea.h"

=== modified file 'src/wui/interactive_gamebase.cc'
--- src/wui/interactive_gamebase.cc	2019-03-01 16:24:48 +0000
+++ src/wui/interactive_gamebase.cc	2019-04-20 05:49:35 +0000
@@ -28,10 +28,10 @@
 #include "graphic/rendertarget.h"
 #include "graphic/text_constants.h"
 #include "graphic/text_layout.h"
-#include "logic/findbob.h"
 #include "logic/game.h"
 #include "logic/game_controller.h"
 #include "logic/map.h"
+#include "logic/map_objects/findbob.h"
 #include "logic/map_objects/tribes/ship.h"
 #include "logic/player.h"
 #include "network/gamehost.h"

=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc	2019-02-23 11:00:49 +0000
+++ src/wui/multiplayersetupgroup.cc	2019-04-20 05:49:35 +0000
@@ -37,7 +37,6 @@
 #include "logic/game_settings.h"
 #include "logic/map_objects/tribes/tribe_basic_info.h"
 #include "logic/player.h"
-#include "logic/widelands.h"
 #include "ui_basic/button.h"
 #include "ui_basic/dropdown.h"
 #include "ui_basic/mouse_constants.h"


Follow ups