widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #11608
[Merge] lp:~widelands-dev/widelands/tribe_basic_info into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/tribe_basic_info into lp:widelands.
Commit message:
Reduce dependencies on liblogic
- Shifted stand-alone tribe functions to tribe_basic_info.h
- Moved type definitions for suggected teams to widelands.h
- New CMake library logic_exceptions
- Refactored CMake libraries for ui_fsmenu and wui_common
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/tribe_basic_info/+merge/333974
This should speed up compile time when some logic headers change.
No code changes except for moving stuff around.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/tribe_basic_info into lp:widelands.
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2017-11-05 20:06:36 +0000
+++ src/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -114,6 +114,7 @@
helper
io_filesystem
logic
+ logic_exceptions
logic_filesystem_constants
logic_game_controller
logic_game_settings
@@ -123,7 +124,12 @@
profile
sound
ui_basic
- ui_fsmenu
+ ui_fsmenu_gameloading
+ ui_fsmenu_loading_common
+ ui_fsmenu_main
+ ui_fsmenu_maploading
+ ui_fsmenu_misc
+ ui_fsmenu_network
ui_fsmenu_options
wui
)
=== modified file 'src/economy/CMakeLists.txt'
--- src/economy/CMakeLists.txt 2017-03-02 12:21:57 +0000
+++ src/economy/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -53,6 +53,7 @@
io_fileread
logic
logic_constants
+ logic_exceptions
logic_widelands_geometry
map_io
notifications
=== modified file 'src/editor/CMakeLists.txt'
--- src/editor/CMakeLists.txt 2017-11-05 20:06:36 +0000
+++ src/editor/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -98,6 +98,7 @@
logic
logic_constants
logic_filesystem_constants
+ logic_tribe_basic_info
logic_widelands_geometry
map_io
map_io_map_loader
@@ -108,6 +109,6 @@
scripting_lua_table
ui_basic
wui
- wui_common
+ wui_common_mapdetails
wui_mapview_pixelfunctions
)
=== modified file 'src/editor/ui_menus/player_menu.cc'
--- src/editor/ui_menus/player_menu.cc 2017-09-13 07:27:00 +0000
+++ src/editor/ui_menus/player_menu.cc 2017-11-20 15:51:52 +0000
@@ -27,8 +27,7 @@
#include "editor/tools/set_starting_pos_tool.h"
#include "graphic/graphic.h"
#include "logic/map.h"
-#include "logic/map_objects/tribes/tribes.h"
-#include "logic/map_objects/tribes/warehouse.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "ui_basic/editbox.h"
#include "ui_basic/messagebox.h"
=== modified file 'src/game_io/CMakeLists.txt'
--- src/game_io/CMakeLists.txt 2016-10-22 18:19:22 +0000
+++ src/game_io/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -8,7 +8,7 @@
game_interactive_player_packet.cc
game_interactive_player_packet.h
game_player_ai_persistent_packet.cc
- game_player_ai_persistent_packet.h
+ game_player_ai_persistent_packet.h
game_loader.cc
game_loader.h
game_map_packet.cc
@@ -35,6 +35,7 @@
io_fileread
io_filesystem
logic
+ logic_exceptions
logic_game_controller
map_io
map_io_map_loader
=== modified file 'src/logic/CMakeLists.txt'
--- src/logic/CMakeLists.txt 2017-11-06 09:27:20 +0000
+++ src/logic/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -1,3 +1,13 @@
+wl_library(logic_exceptions
+ SRCS
+ game_data_error.cc
+ game_data_error.h
+ DEPENDS
+ base_exceptions
+ base_i18n
+)
+
+
wl_library(logic_widelands_geometry
SRCS
widelands_geometry.cc
@@ -11,8 +21,8 @@
player_end_result.h
DEPENDS
io_filesystem
- logic
logic_constants
+ logic_tribe_basic_info
notifications
scripting_lua_interface
scripting_lua_table
@@ -25,8 +35,9 @@
DEPENDS
ai
base_exceptions
- logic
+ base_i18n
logic_game_settings
+ logic_tribe_basic_info
)
wl_library(logic_game_controller
@@ -70,6 +81,17 @@
filesystem_constants.h
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
SRCS
@@ -103,8 +125,6 @@
findnode.h
game.cc
game.h
- game_data_error.cc
- game_data_error.h
map.cc
map.h
map_revision.cc
@@ -196,8 +216,6 @@
map_objects/tribes/training_attribute.h
map_objects/tribes/trainingsite.cc
map_objects/tribes/trainingsite.h
- map_objects/tribes/tribe_basic_info.cc
- map_objects/tribes/tribe_basic_info.h
map_objects/tribes/tribe_descr.cc
map_objects/tribes/tribe_descr.h
map_objects/tribes/tribes.cc
@@ -261,9 +279,11 @@
io_filesystem
io_stream
logic_constants
+ logic_exceptions
logic_filesystem_constants
logic_game_controller
logic_game_settings
+ logic_tribe_basic_info
logic_widelands_geometry
map_io
map_io_map_loader
=== modified file 'src/logic/game_settings.h'
--- src/logic/game_settings.h 2017-08-18 10:23:45 +0000
+++ src/logic/game_settings.h 2017-11-20 15:51:52 +0000
@@ -157,7 +157,7 @@
bool savegame;
/// List of tribes that players are allowed to choose
- std::vector<TribeBasicInfo> tribes;
+ std::vector<Widelands::TribeBasicInfo> tribes;
/// Player configuration, with 0-based indices for players
std::vector<PlayerSettings> players;
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2017-11-05 19:59:33 +0000
+++ src/logic/map.cc 2017-11-20 15:51:52 +0000
@@ -39,7 +39,7 @@
#include "logic/findnode.h"
#include "logic/map_objects/checkstep.h"
#include "logic/map_objects/tribes/soldier.h"
-#include "logic/map_objects/tribes/tribe_descr.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/map_objects/world/terrain_description.h"
#include "logic/map_objects/world/world.h"
#include "logic/mapfringeregion.h"
=== modified file 'src/logic/map.h'
--- src/logic/map.h 2017-11-04 18:18:07 +0000
+++ src/logic/map.h 2017-11-20 15:51:52 +0000
@@ -36,6 +36,7 @@
#include "logic/map_revision.h"
#include "logic/objective.h"
#include "logic/widelands_geometry.h"
+#include "logic/widelands.h"
#include "notifications/note_ids.h"
#include "notifications/notifications.h"
#include "random/random.h"
@@ -132,9 +133,6 @@
using PortSpacesSet = std::set<Coords>;
using Objectives = std::map<std::string, std::unique_ptr<Objective>>;
- using SuggestedTeam = std::vector<PlayerNumber>; // Players in a team
- using SuggestedTeamLineup =
- std::vector<SuggestedTeam>; // Recommended teams to play against each other
enum { // flags for findpath()
=== modified file 'src/logic/map_objects/tribes/tribe_basic_info.cc'
--- src/logic/map_objects/tribes/tribe_basic_info.cc 2017-01-25 18:55:59 +0000
+++ src/logic/map_objects/tribes/tribe_basic_info.cc 2017-11-20 15:51:52 +0000
@@ -25,6 +25,8 @@
#include "logic/game_data_error.h"
#include "scripting/lua_interface.h"
+namespace Widelands {
+
TribeBasicInfo::TribeBasicInfo(std::unique_ptr<LuaTable> table) {
try {
i18n::Textdomain td("tribes");
@@ -47,3 +49,47 @@
"reading basic info for tribe \"%s\": %s", name.c_str(), e.what());
}
}
+
+std::vector<std::string> get_all_tribenames() {
+ std::vector<std::string> tribenames;
+ LuaInterface lua;
+ std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua"));
+ for (const int key : table->keys<int>()) {
+ std::unique_ptr<LuaTable> info = table->get_table(key);
+ info->do_not_warn_about_unaccessed_keys();
+ tribenames.push_back(info->get_string("name"));
+ }
+ return tribenames;
+}
+
+std::vector<TribeBasicInfo> get_all_tribeinfos() {
+ std::vector<TribeBasicInfo> tribeinfos;
+ LuaInterface lua;
+ std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua"));
+ for (const int key : table->keys<int>()) {
+ tribeinfos.push_back(TribeBasicInfo(table->get_table(key)));
+ }
+ return tribeinfos;
+}
+
+TribeBasicInfo get_tribeinfo(const std::string& tribename) {
+ if (Widelands::tribe_exists(tribename)) {
+ for (const TribeBasicInfo& info : Widelands::get_all_tribeinfos()) {
+ if (info.name == tribename) {
+ return info;
+ }
+ }
+ }
+ throw GameDataError("The tribe '%s'' does not exist.", tribename.c_str());
+}
+
+bool tribe_exists(const std::string& tribename) {
+ for (const std::string& name : get_all_tribenames()) {
+ if (name == tribename) {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace Widelands
=== modified file 'src/logic/map_objects/tribes/tribe_basic_info.h'
--- src/logic/map_objects/tribes/tribe_basic_info.h 2017-06-26 11:27:27 +0000
+++ src/logic/map_objects/tribes/tribe_basic_info.h 2017-11-20 15:51:52 +0000
@@ -28,6 +28,8 @@
#include "scripting/lua_table.h"
+namespace Widelands {
+
/// Basic information about the tribe that is determined only from the conf
/// file and needed before the actual game.
struct TribeBasicInfo {
@@ -60,4 +62,18 @@
std::vector<Initialization> initializations;
};
+/// Returns a string vector with the names of all tribes.
+std::vector<std::string> get_all_tribenames();
+
+/// Returns a vector with the basic info for all tribes.
+std::vector<TribeBasicInfo> get_all_tribeinfos();
+
+/// Returns the basic preload info for a tribe.
+TribeBasicInfo get_tribeinfo(const std::string& tribename);
+
+/// Returns whether this tribe is listed in tribes/preload.lua.
+bool tribe_exists(const std::string& tribename);
+
+} // namespace Widelands
+
#endif // end of include guard: WL_LOGIC_MAP_OBJECTS_TRIBES_TRIBE_BASIC_INFO_H
=== modified file 'src/logic/map_objects/tribes/tribe_descr.cc'
--- src/logic/map_objects/tribes/tribe_descr.cc 2017-07-19 20:40:32 +0000
+++ src/logic/map_objects/tribes/tribe_descr.cc 2017-11-20 15:51:52 +0000
@@ -55,7 +55,7 @@
* The contents of 'table' are documented in
* /data/tribes/atlanteans.lua
*/
-TribeDescr::TribeDescr(const LuaTable& table, const TribeBasicInfo& info, const Tribes& init_tribes)
+TribeDescr::TribeDescr(const LuaTable& table, const Widelands::TribeBasicInfo& info, const Tribes& init_tribes)
: name_(table.get_string("name")), descname_(info.descname), tribes_(init_tribes) {
try {
=== modified file 'src/logic/map_objects/tribes/tribe_descr.h'
--- src/logic/map_objects/tribes/tribe_descr.h 2017-07-19 20:40:32 +0000
+++ src/logic/map_objects/tribes/tribe_descr.h 2017-11-20 15:51:52 +0000
@@ -58,7 +58,7 @@
*/
class TribeDescr {
public:
- TribeDescr(const LuaTable& table, const TribeBasicInfo& info, const Tribes& init_tribes);
+ TribeDescr(const LuaTable& table, const Widelands::TribeBasicInfo& info, const Tribes& init_tribes);
const std::string& name() const;
const std::string& descname() const;
@@ -131,7 +131,7 @@
const ResourceAmount amount) const;
// Returns the initalization at 'index' (which must not be out of bounds).
- const TribeBasicInfo::Initialization& initialization(const uint8_t index) const {
+ const Widelands::TribeBasicInfo::Initialization& initialization(const uint8_t index) const {
return initializations_.at(index);
}
@@ -204,7 +204,7 @@
WaresOrder workers_order_;
WaresOrderCoords workers_order_coords_;
- std::vector<TribeBasicInfo::Initialization> initializations_;
+ std::vector<Widelands::TribeBasicInfo::Initialization> initializations_;
DISALLOW_COPY_AND_ASSIGN(TribeDescr);
};
=== modified file 'src/logic/map_objects/tribes/tribes.cc'
--- src/logic/map_objects/tribes/tribes.cc 2017-09-22 19:54:27 +0000
+++ src/logic/map_objects/tribes/tribes.cc 2017-11-20 15:51:52 +0000
@@ -25,51 +25,9 @@
#include "graphic/graphic.h"
#include "logic/game_data_error.h"
#include "logic/map_objects/tribes/market.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
namespace Widelands {
-
-std::vector<std::string> get_all_tribenames() {
- std::vector<std::string> tribenames;
- LuaInterface lua;
- std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua"));
- for (const int key : table->keys<int>()) {
- std::unique_ptr<LuaTable> info = table->get_table(key);
- info->do_not_warn_about_unaccessed_keys();
- tribenames.push_back(info->get_string("name"));
- }
- return tribenames;
-}
-
-std::vector<TribeBasicInfo> get_all_tribeinfos() {
- std::vector<TribeBasicInfo> tribeinfos;
- LuaInterface lua;
- std::unique_ptr<LuaTable> table(lua.run_script("tribes/preload.lua"));
- for (const int key : table->keys<int>()) {
- tribeinfos.push_back(TribeBasicInfo(table->get_table(key)));
- }
- return tribeinfos;
-}
-
-TribeBasicInfo get_tribeinfo(const std::string& tribename) {
- if (Widelands::tribe_exists(tribename)) {
- for (const TribeBasicInfo& info : Widelands::get_all_tribeinfos()) {
- if (info.name == tribename) {
- return info;
- }
- }
- }
- throw GameDataError("The tribe '%s'' does not exist.", tribename.c_str());
-}
-
-bool tribe_exists(const std::string& tribename) {
- for (const std::string& name : get_all_tribenames()) {
- if (name == tribename) {
- return true;
- }
- }
- return false;
-}
-
Tribes::Tribes()
: buildings_(new DescriptionMaintainer<BuildingDescr>()),
immovables_(new DescriptionMaintainer<ImmovableDescr>()),
=== modified file 'src/logic/map_objects/tribes/tribes.h'
--- src/logic/map_objects/tribes/tribes.h 2017-09-22 19:54:27 +0000
+++ src/logic/map_objects/tribes/tribes.h 2017-11-20 15:51:52 +0000
@@ -46,18 +46,6 @@
class WareDescr;
class WorkerDescr;
-/// Returns a string vector with the names of all tribes.
-std::vector<std::string> get_all_tribenames();
-
-/// Returns a vector with the basic info for all tribes.
-std::vector<TribeBasicInfo> get_all_tribeinfos();
-
-/// Returns the basic preload info for a tribe.
-TribeBasicInfo get_tribeinfo(const std::string& tribename);
-
-/// Returns whether this tribe is listed in tribes/preload.lua.
-bool tribe_exists(const std::string& tribename);
-
class Tribes {
public:
Tribes();
=== modified file 'src/logic/player.cc'
--- src/logic/player.cc 2017-11-18 10:11:54 +0000
+++ src/logic/player.cc 2017-11-20 15:51:52 +0000
@@ -47,7 +47,7 @@
#include "logic/map_objects/tribes/soldier.h"
#include "logic/map_objects/tribes/soldiercontrol.h"
#include "logic/map_objects/tribes/trainingsite.h"
-#include "logic/map_objects/tribes/tribe_descr.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/map_objects/tribes/warehouse.h"
#include "logic/playercommand.h"
#include "scripting/lua_table.h"
@@ -190,7 +190,7 @@
void Player::create_default_infrastructure() {
const Map& map = egbase().map();
if (map.get_starting_pos(player_number_)) {
- const TribeBasicInfo::Initialization& initialization =
+ const Widelands::TribeBasicInfo::Initialization& initialization =
tribe().initialization(initialization_index_);
Game& game = dynamic_cast<Game&>(egbase());
=== modified file 'src/logic/single_player_game_settings_provider.cc'
--- src/logic/single_player_game_settings_provider.cc 2017-08-18 10:23:45 +0000
+++ src/logic/single_player_game_settings_provider.cc 2017-11-20 15:51:52 +0000
@@ -22,8 +22,9 @@
#include <boost/format.hpp>
#include "ai/computer_player.h"
+#include "base/i18n.h"
#include "base/wexception.h"
-#include "logic/map_objects/tribes/tribes.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
SinglePlayerGameSettingsProvider::SinglePlayerGameSettingsProvider() {
s.tribes = Widelands::get_all_tribeinfos();
@@ -167,7 +168,7 @@
actual_tribe = s.tribes.at(random).name;
}
- for (const TribeBasicInfo& tmp_tribe : s.tribes) {
+ for (const Widelands::TribeBasicInfo& tmp_tribe : s.tribes) {
if (tmp_tribe.name == player.tribe) {
s.players[number].tribe = actual_tribe;
if (tmp_tribe.initializations.size() <= player.initialization_index) {
@@ -181,7 +182,7 @@
if (number >= s.players.size())
return;
- for (const TribeBasicInfo& tmp_tribe : s.tribes) {
+ for (const Widelands::TribeBasicInfo& tmp_tribe : s.tribes) {
if (tmp_tribe.name == s.players[number].tribe) {
if (index < tmp_tribe.initializations.size())
s.players[number].initialization_index = index;
=== modified file 'src/logic/widelands.h'
--- src/logic/widelands.h 2017-01-25 18:55:59 +0000
+++ src/logic/widelands.h 2017-11-20 15:51:52 +0000
@@ -23,6 +23,7 @@
#include <cassert>
#include <cstddef>
#include <limits>
+#include <vector>
#include <stdint.h>
@@ -101,6 +102,11 @@
}
};
+// For suggested teams info during map preload
+using SuggestedTeam = std::vector<PlayerNumber>; // Players in a team
+// Recommended teams to play against each other
+using SuggestedTeamLineup = std::vector<SuggestedTeam>;
+
} // namespace Widelands
#endif // end of include guard: WL_LOGIC_WIDELANDS_H
=== modified file 'src/map_io/CMakeLists.txt'
--- src/map_io/CMakeLists.txt 2017-11-05 20:06:36 +0000
+++ src/map_io/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -104,6 +104,7 @@
io_filesystem
logic
logic_constants
+ logic_exceptions
logic_widelands_geometry
profile
scripting_logic
=== modified file 'src/map_io/map_elemental_packet.cc'
--- src/map_io/map_elemental_packet.cc 2017-08-19 22:22:20 +0000
+++ src/map_io/map_elemental_packet.cc 2017-11-20 15:51:52 +0000
@@ -73,14 +73,14 @@
while (Section* teamsection = prof.get_section(teamsection_key.c_str())) {
// A lineup is made up of teams
- Map::SuggestedTeamLineup lineup;
+ SuggestedTeamLineup lineup;
uint16_t team_number = 1;
std::string team_key = (boost::format("team%i") % team_number).str().c_str();
std::string team_string = teamsection->get_string(team_key.c_str(), "");
while (!team_string.empty()) {
// A team is made up of players
- Map::SuggestedTeam team;
+ SuggestedTeam team;
std::vector<std::string> players_string;
boost::split(players_string, team_string, boost::is_any_of(","));
@@ -142,11 +142,11 @@
global_section.set_string("tags", boost::algorithm::join(map.get_tags(), ","));
int counter = 0;
- for (Widelands::Map::SuggestedTeamLineup lineup : map.get_suggested_teams()) {
+ for (Widelands::SuggestedTeamLineup lineup : map.get_suggested_teams()) {
Section& teams_section =
prof.create_section((boost::format("teams%02d") % counter++).str().c_str());
int lineup_counter = 0;
- for (Widelands::Map::SuggestedTeam team : lineup) {
+ for (Widelands::SuggestedTeam team : lineup) {
std::string section_contents;
for (std::vector<PlayerNumber>::const_iterator it = team.begin(); it != team.end(); ++it) {
if (it == team.begin()) {
=== modified file 'src/network/CMakeLists.txt'
--- src/network/CMakeLists.txt 2017-11-05 20:06:36 +0000
+++ src/network/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -44,12 +44,13 @@
logic_filesystem_constants
logic_game_controller
logic_game_settings
+ logic_tribe_basic_info
map_io_map_loader
profile
scripting_lua_interface
scripting_lua_table
ui_basic
- ui_fsmenu
+ ui_fsmenu_gameloading
widelands_ball_of_mud
wui
)
=== modified file 'src/network/gameclient.cc'
--- src/network/gameclient.cc 2017-11-05 19:59:33 +0000
+++ src/network/gameclient.cc 2017-11-20 15:51:52 +0000
@@ -35,7 +35,7 @@
#include "io/filewrite.h"
#include "logic/filesystem_constants.h"
#include "logic/game.h"
-#include "logic/map_objects/tribes/tribes.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "logic/playercommand.h"
#include "logic/playersmanager.h"
@@ -732,7 +732,7 @@
case NETCMD_SETTING_TRIBES: {
d->settings.tribes.clear();
for (uint8_t i = packet.unsigned_8(); i; --i) {
- TribeBasicInfo info = Widelands::get_tribeinfo(packet.string());
+ Widelands::TribeBasicInfo info = Widelands::get_tribeinfo(packet.string());
// Get initializations (we have to do this locally, for translations)
LuaInterface lua;
@@ -741,7 +741,7 @@
std::string const initialization_script = packet.string();
std::unique_ptr<LuaTable> t = lua.run_script(initialization_script);
t->do_not_warn_about_unaccessed_keys();
- info.initializations.push_back(TribeBasicInfo::Initialization(
+ info.initializations.push_back(Widelands::TribeBasicInfo::Initialization(
initialization_script, t->get_string("descname"), t->get_string("tooltip")));
}
d->settings.tribes.push_back(info);
=== modified file 'src/network/gamehost.cc'
--- src/network/gamehost.cc 2017-11-12 13:34:46 +0000
+++ src/network/gamehost.cc 2017-11-20 15:51:52 +0000
@@ -44,7 +44,7 @@
#include "io/filesystem/layered_filesystem.h"
#include "logic/filesystem_constants.h"
#include "logic/game.h"
-#include "logic/map_objects/tribes/tribes.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "logic/playercommand.h"
#include "logic/playersmanager.h"
@@ -1172,7 +1172,7 @@
actual_tribe = d->settings.tribes.at(random).name;
}
- for (const TribeBasicInfo& temp_tribeinfo : d->settings.tribes) {
+ for (const Widelands::TribeBasicInfo& temp_tribeinfo : d->settings.tribes) {
if (temp_tribeinfo.name == player.tribe) {
player.tribe = actual_tribe;
if (temp_tribeinfo.initializations.size() <= player.initialization_index)
@@ -1199,7 +1199,7 @@
if (player.initialization_index == index)
return;
- for (const TribeBasicInfo& temp_tribeinfo : d->settings.tribes) {
+ for (const Widelands::TribeBasicInfo& temp_tribeinfo : d->settings.tribes) {
if (temp_tribeinfo.name == player.tribe) {
if (index < temp_tribeinfo.initializations.size()) {
player.initialization_index = index;
@@ -1605,11 +1605,11 @@
s.reset();
s.unsigned_8(NETCMD_SETTING_TRIBES);
s.unsigned_8(d->settings.tribes.size());
- for (const TribeBasicInfo& tribe : d->settings.tribes) {
+ for (const Widelands::TribeBasicInfo& tribe : d->settings.tribes) {
s.string(tribe.name);
size_t const nr_initializations = tribe.initializations.size();
s.unsigned_8(nr_initializations);
- for (const TribeBasicInfo::Initialization& init : tribe.initializations)
+ for (const Widelands::TribeBasicInfo::Initialization& init : tribe.initializations)
s.string(init.script);
}
d->net->send(client.sock_id, s);
=== modified file 'src/scripting/CMakeLists.txt'
--- src/scripting/CMakeLists.txt 2017-06-05 07:48:28 +0000
+++ src/scripting/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -112,6 +112,7 @@
logic_constants
logic_game_controller
logic_game_settings
+ logic_tribe_basic_info
logic_widelands_geometry
map_io
scripting_base
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2017-11-10 09:31:46 +0000
+++ src/scripting/lua_map.cc 2017-11-20 15:51:52 +0000
@@ -36,6 +36,7 @@
#include "logic/map_objects/tribes/market.h"
#include "logic/map_objects/tribes/ship.h"
#include "logic/map_objects/tribes/soldier.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/map_objects/tribes/tribes.h"
#include "logic/map_objects/tribes/warelist.h"
#include "logic/map_objects/world/editor_category.h"
=== modified file 'src/ui_fsmenu/CMakeLists.txt'
--- src/ui_fsmenu/CMakeLists.txt 2017-11-05 20:09:44 +0000
+++ src/ui_fsmenu/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -17,26 +17,79 @@
scripting_lua_interface
scripting_lua_table
ui_basic
- ui_fsmenu
+ ui_fsmenu_base
profile
sound
widelands_ball_of_mud
)
-wl_library(ui_fsmenu
+wl_library(ui_fsmenu_base
SRCS
- about.cc
- about.h
base.cc
base.h
- campaign_select.cc
- campaign_select.h
+ DEPENDS
+ ui_basic
+)
+
+wl_library(ui_fsmenu_helpwindow
+ SRCS
helpwindow.cc
helpwindow.h
- internet_lobby.cc
- internet_lobby.h
- intro.cc
- intro.h
+ DEPENDS
+ base_i18n
+ graphic
+ scripting_coroutine
+ scripting_lua_table
+ scripting_lua_interface
+ ui_basic
+)
+
+
+wl_library(ui_fsmenu_main
+ SRCS
+ main.cc
+ main.h
+ DEPENDS
+ base_i18n
+ build_info
+ graphic
+ ui_basic
+ ui_fsmenu_main_menu
+)
+
+wl_library(ui_fsmenu_main_menu
+ SRCS
+ main_menu.cc
+ main_menu.h
+ DEPENDS
+ ui_basic
+ ui_fsmenu_base
+)
+
+wl_library(ui_fsmenu_loading_common
+ SRCS
+ load_map_or_game.cc
+ load_map_or_game.h
+ multiplayer.cc
+ multiplayer.h
+ singleplayer.cc
+ singleplayer.h
+ DEPENDS
+ base_i18n
+ graphic
+ graphic_text_constants
+ io_filesystem
+ profile
+ network
+ ui_basic
+ ui_fsmenu_base
+ ui_fsmenu_main_menu
+ wui_common_mapdetails
+ wui
+)
+
+wl_library(ui_fsmenu_gameloading
+ SRCS
launch_game.cc
launch_game.h
launch_mpg.cc
@@ -45,45 +98,87 @@
launch_spg.h
loadgame.cc
loadgame.h
- load_map_or_game.cc
- load_map_or_game.h
- main.cc
- main.h
- main_menu.cc
- main_menu.h
+ DEPENDS
+ base_exceptions
+ base_i18n
+ graphic
+ graphic_playercolor
+ graphic_text_constants
+ helper
+ io_filesystem
+ logic
+ logic_game_controller
+ logic_game_settings
+ logic_tribe_basic_info
+ map_io_map_loader
+ profile
+ scripting_lua_interface
+ scripting_lua_table
+ ui_basic
+ ui_fsmenu_base
+ ui_fsmenu_helpwindow
+ ui_fsmenu_loading_common
+ ui_fsmenu_maploading
+ wui
+ wui_chat_ui
+ wui_common_gamedetails
+ wui_common_suggested_teams
+)
+
+wl_library(ui_fsmenu_maploading
+ SRCS
+ campaign_select.cc
+ campaign_select.h
mapselect.cc
mapselect.h
- multiplayer.cc
- multiplayer.h
+ DEPENDS
+ base_exceptions
+ base_i18n
+ base_log
+ graphic
+ graphic_fonthandler
+ graphic_text_constants
+ io_filesystem
+ logic_campaign_visibility
+ logic_filesystem_constants
+ logic_game_controller
+ logic_game_settings
+ map_io_map_loader
+ profile
+ ui_basic
+ ui_fsmenu_base
+ ui_fsmenu_loading_common
+ wui_common_mapdetails
+)
+
+wl_library(ui_fsmenu_network
+ SRCS
+ internet_lobby.cc
+ internet_lobby.h
netsetup_lan.cc
netsetup_lan.h
- singleplayer.cc
- singleplayer.h
DEPENDS
- base_exceptions
base_i18n
base_log
base_macros
- build_info
graphic
- graphic_fonthandler
- graphic_playercolor
graphic_text_constants
- helper
- io_filesystem
- logic
- logic_campaign_visibility
- logic_filesystem_constants
- logic_game_controller
- logic_game_settings
- map_io_map_loader
network
profile
- scripting_coroutine
- scripting_lua_interface
- scripting_lua_table
ui_basic
- wui
+ ui_fsmenu_base
wui_chat_ui
- wui_common
+)
+
+wl_library(ui_fsmenu_misc
+ SRCS
+ about.cc
+ about.h
+ intro.cc
+ intro.h
+ DEPENDS
+ base_i18n
+ graphic
+ ui_basic
+ ui_fsmenu_base
)
=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc 2017-09-02 21:48:44 +0000
+++ src/ui_fsmenu/launch_mpg.cc 2017-11-20 15:51:52 +0000
@@ -34,6 +34,7 @@
#include "logic/game_settings.h"
#include "logic/map.h"
#include "logic/map_objects/map_object.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "map_io/map_loader.h"
#include "profile/profile.h"
@@ -515,7 +516,7 @@
settings_->set_player_tribe(i - 1, player_save_tribe[i - 1]);
// get translated tribename
- for (const TribeBasicInfo& tribeinfo : settings_->settings().tribes) {
+ for (const Widelands::TribeBasicInfo& tribeinfo : settings_->settings().tribes) {
if (tribeinfo.name == player_save_tribe[i - 1]) {
i18n::Textdomain td("tribes"); // for translated initialisation
player_save_tribe[i - 1] = _(tribeinfo.descname);
=== modified file 'src/website/CMakeLists.txt'
--- src/website/CMakeLists.txt 2016-05-14 07:35:39 +0000
+++ src/website/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -26,5 +26,6 @@
io_fileread
io_filesystem
logic
+ logic_tribe_basic_info
sound
)
=== modified file 'src/website/map_object_info.cc'
--- src/website/map_object_info.cc 2017-09-15 12:33:58 +0000
+++ src/website/map_object_info.cc 2017-11-20 15:51:52 +0000
@@ -33,6 +33,7 @@
#include "io/filesystem/layered_filesystem.h"
#include "io/filewrite.h"
#include "logic/editor_game_base.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/map_objects/tribes/tribes.h"
#include "logic/map_objects/world/world.h"
#include "sound/sound_handler.h"
@@ -461,7 +462,7 @@
==========================================================
*/
-void add_tribe_info(const TribeBasicInfo& tribe_info, JSONFileWrite* fw) {
+void add_tribe_info(const Widelands::TribeBasicInfo& tribe_info, JSONFileWrite* fw) {
fw->write_key_value_string("name", tribe_info.name);
fw->close_element();
fw->write_key_value_string("descname", tribe_info.descname);
@@ -482,9 +483,9 @@
egbase.mutable_tribes()->postload(); // Make sure that all values have been set.
const Tribes& tribes = egbase.tribes();
- std::vector<TribeBasicInfo> tribeinfos = Widelands::get_all_tribeinfos();
+ std::vector<Widelands::TribeBasicInfo> tribeinfos = Widelands::get_all_tribeinfos();
for (size_t tribe_index = 0; tribe_index < tribeinfos.size(); ++tribe_index) {
- const TribeBasicInfo& tribe_info = tribeinfos[tribe_index];
+ const Widelands::TribeBasicInfo& tribe_info = tribeinfos[tribe_index];
log("\n\n=========================\nWriting tribe: %s\n=========================\n",
tribe_info.name.c_str());
=== modified file 'src/wui/CMakeLists.txt'
--- src/wui/CMakeLists.txt 2017-11-05 20:06:36 +0000
+++ src/wui/CMakeLists.txt 2017-11-20 15:51:52 +0000
@@ -49,12 +49,45 @@
logic_widelands_geometry
)
-wl_library(wui_common
+wl_library(wui_common_suggested_teams
+ SRCS
+ suggested_teams_box.cc
+ suggested_teams_box.h
+ DEPENDS
+ base_i18n
+ graphic
+ graphic_playercolor
+ logic_constants
+ ui_basic
+)
+
+wl_library(wui_common_gamedetails
SRCS
gamedetails.cc
gamedetails.h
load_or_save_game.cc
load_or_save_game.h
+ DEPENDS
+ base_i18n
+ base_log
+ base_time_string
+ helper
+ game_io
+ graphic
+ graphic_fonthandler
+ graphic_image_io
+ graphic_surface
+ graphic_text_constants
+ io_filesystem
+ logic
+ logic_filesystem_constants
+ logic_game_controller
+ logic_game_settings
+ ui_basic
+)
+
+wl_library(wui_common_mapdetails
+ SRCS
mapdetails.cc
mapdetails.h
mapdata.cc
@@ -63,28 +96,21 @@
maptable.h
map_tags.cc
map_tags.h
- suggested_teams_box.cc
- suggested_teams_box.h
DEPENDS
base_exceptions
base_i18n
base_log
- base_time_string
- helper
- game_io
graphic
graphic_fonthandler
- graphic_image_io
- graphic_playercolor
- graphic_surface
graphic_text_constants
io_filesystem
logic
- logic_filesystem_constants
+ logic_constants
logic_game_controller
logic_game_settings
map_io_map_loader
ui_basic
+ wui_common_suggested_teams
)
wl_library(wui_quicknavigation
@@ -253,6 +279,7 @@
logic_filesystem_constants
logic_game_controller
logic_game_settings
+ logic_tribe_basic_info
logic_widelands_geometry
network
note_sound
@@ -264,7 +291,7 @@
sound
ui_basic
wui_chat_ui
- wui_common
+ wui_common_gamedetails
wui_economy_options
wui_mapview
wui_mapview_pixelfunctions
=== modified file 'src/wui/load_or_save_game.cc'
--- src/wui/load_or_save_game.cc 2017-11-06 20:19:56 +0000
+++ src/wui/load_or_save_game.cc 2017-11-20 15:51:52 +0000
@@ -33,7 +33,6 @@
#include "helper.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/filesystem_constants.h"
-#include "logic/game.h"
#include "logic/game_controller.h"
#include "logic/game_settings.h"
#include "logic/replay.h"
=== modified file 'src/wui/mapdata.h'
--- src/wui/mapdata.h 2017-01-25 18:55:59 +0000
+++ src/wui/mapdata.h 2017-11-20 15:51:52 +0000
@@ -30,6 +30,7 @@
#include "base/i18n.h"
#include "io/filesystem/filesystem.h"
#include "logic/map.h"
+#include "logic/widelands.h"
/**
* Author data for a map or scenario.
@@ -109,7 +110,7 @@
uint32_t nrplayers;
uint32_t width;
uint32_t height;
- std::vector<Widelands::Map::SuggestedTeamLineup> suggested_teams;
+ std::vector<Widelands::SuggestedTeamLineup> suggested_teams;
std::set<std::string> tags;
MapData::MapType maptype;
MapData::DisplayType displaytype;
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2017-09-02 21:48:44 +0000
+++ src/wui/multiplayersetupgroup.cc 2017-11-20 15:51:52 +0000
@@ -35,8 +35,7 @@
#include "graphic/text_constants.h"
#include "logic/game.h"
#include "logic/game_settings.h"
-#include "logic/map_objects/tribes/tribe_descr.h"
-#include "logic/map_objects/tribes/tribes.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "logic/widelands.h"
#include "ui_basic/button.h"
@@ -421,7 +420,7 @@
} else {
{
i18n::Textdomain td("tribes");
- for (const TribeBasicInfo& tribeinfo : Widelands::get_all_tribeinfos()) {
+ for (const Widelands::TribeBasicInfo& tribeinfo : Widelands::get_all_tribeinfos()) {
tribes_dropdown_.add(_(tribeinfo.descname), tribeinfo.name,
g_gr->images().get(tribeinfo.icon), false, tribeinfo.tooltip);
}
@@ -478,9 +477,9 @@
} else {
init_dropdown_.set_label("");
i18n::Textdomain td("tribes"); // for translated initialisation
- const TribeBasicInfo tribeinfo = Widelands::get_tribeinfo(player_setting.tribe);
+ const Widelands::TribeBasicInfo tribeinfo = Widelands::get_tribeinfo(player_setting.tribe);
for (size_t i = 0; i < tribeinfo.initializations.size(); ++i) {
- const TribeBasicInfo::Initialization& addme = tribeinfo.initializations[i];
+ const Widelands::TribeBasicInfo::Initialization& addme = tribeinfo.initializations[i];
init_dropdown_.add(_(addme.descname), i, nullptr,
i == player_setting.initialization_index, _(addme.tooltip));
}
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2017-06-15 05:48:10 +0000
+++ src/wui/playerdescrgroup.cc 2017-11-20 15:51:52 +0000
@@ -29,7 +29,7 @@
#include "graphic/graphic.h"
#include "graphic/text_constants.h"
#include "logic/game_settings.h"
-#include "logic/map_objects/tribes/tribe_descr.h"
+#include "logic/map_objects/tribes/tribe_basic_info.h"
#include "logic/player.h"
#include "ui_basic/button.h"
#include "ui_basic/checkbox.h"
@@ -161,7 +161,7 @@
}
d->btnPlayerType->set_title(title);
- TribeBasicInfo info = Widelands::get_tribeinfo(player.tribe);
+ Widelands::TribeBasicInfo info = Widelands::get_tribeinfo(player.tribe);
if (!tribenames_[player.tribe].size()) {
// Tribe's localized name
tribenames_[player.tribe] = info.descname;
@@ -177,7 +177,7 @@
{
i18n::Textdomain td("tribes"); // for translated initialisation
- for (const TribeBasicInfo& tribeinfo : settings.tribes) {
+ for (const Widelands::TribeBasicInfo& tribeinfo : settings.tribes) {
if (tribeinfo.name == player.tribe) {
d->btnPlayerInit->set_title(
_(tribeinfo.initializations.at(player.initialization_index).descname));
@@ -293,7 +293,7 @@
const PlayerSettings& player = settings.players[d->plnum];
- for (const TribeBasicInfo& tribeinfo : settings.tribes) {
+ for (const Widelands::TribeBasicInfo& tribeinfo : settings.tribes) {
if (tribeinfo.name == player.tribe) {
return d->settings->set_player_init(
d->plnum, (player.initialization_index + 1) % tribeinfo.initializations.size());
=== modified file 'src/wui/suggested_teams_box.cc'
--- src/wui/suggested_teams_box.cc 2017-08-19 23:24:28 +0000
+++ src/wui/suggested_teams_box.cc 2017-11-20 15:51:52 +0000
@@ -22,6 +22,7 @@
#include <set>
#include <string>
+#include "base/i18n.h"
#include "graphic/graphic.h"
#include "graphic/playercolor.h"
@@ -76,7 +77,7 @@
}
void SuggestedTeamsBox::show(
- const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams) {
+ const std::vector<Widelands::SuggestedTeamLineup>& suggested_teams) {
hide();
suggested_teams_ = suggested_teams;
@@ -94,7 +95,7 @@
// Parse suggested teams
UI::Icon* player_icon;
UI::Textarea* vs_label;
- for (const Widelands::Map::SuggestedTeamLineup& lineup : suggested_teams_) {
+ for (const Widelands::SuggestedTeamLineup& lineup : suggested_teams_) {
lineup_box_ =
new UI::Box(this, indent_, teamlist_offset + lineup_counter * (label_height_),
@@ -103,7 +104,7 @@
lineup_box_->set_size(get_w(), label_height_);
bool is_first = true;
- for (const Widelands::Map::SuggestedTeam& team : lineup) {
+ for (const Widelands::SuggestedTeam& team : lineup) {
if (!is_first) {
lineup_box_->add_space(padding_);
=== modified file 'src/wui/suggested_teams_box.h'
--- src/wui/suggested_teams_box.h 2017-01-25 18:55:59 +0000
+++ src/wui/suggested_teams_box.h 2017-11-20 15:51:52 +0000
@@ -23,7 +23,7 @@
#include <set>
#include <string>
-#include "logic/map.h"
+#include "logic/widelands.h"
#include "ui_basic/box.h"
#include "ui_basic/icon.h"
#include "ui_basic/textarea.h"
@@ -43,7 +43,7 @@
~SuggestedTeamsBox();
void hide();
- void show(const std::vector<Widelands::Map::SuggestedTeamLineup>& suggested_teams);
+ void show(const std::vector<Widelands::SuggestedTeamLineup>& suggested_teams);
private:
int32_t const padding_;
@@ -53,7 +53,7 @@
UI::Box* lineup_box_;
std::vector<UI::Icon*> player_icons_;
std::vector<UI::Textarea*> vs_labels_;
- std::vector<Widelands::Map::SuggestedTeamLineup> suggested_teams_;
+ std::vector<Widelands::SuggestedTeamLineup> suggested_teams_;
};
}
Follow ups