GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1543944-suggested-teams into lp:widelands.
Commit message: - Fixed indexing error in SuggestedTeamsBox that would cause a crash - Added Widelands version to log output - Added map names to scoped timer for map loading/saving. Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1543944 in widelands: "Error in widelands:free(): invalid pointer" https://bugs.launchpad.net/widelands/+bug/1543944 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1543944-suggested-teams/+merge/285654 - Fixed indexing error in SuggestedTeamsBox that would cause a crash - Added Widelands version to log output - Added map names to scoped timer for map loading/saving. The attached bug has 2 bugs in it, so let's leave the bug report open when merging this. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1543944-suggested-teams into lp:widelands.
=== modified file 'src/logic/map.h' --- src/logic/map.h 2016-02-05 20:07:10 +0000 +++ src/logic/map.h 2016-02-10 20:59:09 +0000 @@ -147,7 +147,7 @@ using PortSpacesSet = std::set<Coords, Coords::OrderingFunctor>; using Objectives = std::map<std::string, std::unique_ptr<Objective>>; - using SuggestedTeam = std::vector<uint16_t>; // Players in a team + using SuggestedTeam = std::vector<PlayerNumber>; // Players in a team using SuggestedTeamLineup = std::vector<SuggestedTeam>; // Recommended teams to play against each other === modified file 'src/main.cc' --- src/main.cc 2016-02-06 11:11:24 +0000 +++ src/main.cc 2016-02-10 20:59:09 +0000 @@ -41,6 +41,8 @@ */ int main(int argc, char * argv[]) { + log("This is Widelands Version %s (%s)\n", build_id().c_str(), build_type().c_str()); + WLApplication * g_app = nullptr; try { g_app = WLApplication::get(argc, const_cast<char const * *>(argv)); === modified file 'src/map_io/map_elemental_packet.cc' --- src/map_io/map_elemental_packet.cc 2015-10-24 15:42:37 +0000 +++ src/map_io/map_elemental_packet.cc 2016-02-10 20:59:09 +0000 @@ -25,6 +25,7 @@ #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 { @@ -83,7 +84,7 @@ boost::split(players_string, team_string, boost::is_any_of(",")); for (const std::string& player: players_string) { - uint16_t player_number = static_cast<uint16_t>(atoi(player.c_str())); + PlayerNumber player_number = static_cast<PlayerNumber>(atoi(player.c_str())); assert(player_number < MAX_PLAYERS); team.push_back(player_number); } === modified file 'src/map_io/map_saver.cc' --- src/map_io/map_saver.cc 2016-01-29 15:49:40 +0000 +++ src/map_io/map_saver.cc 2016-02-10 20:59:09 +0000 @@ -71,7 +71,10 @@ void MapSaver::save() { - ScopedTimer timer("MapSaver::save() took %ums"); + std::string timer_message = "MapSaver::save() for '"; + timer_message += m_egbase.map().get_name(); + timer_message += "' took %ums"; + ScopedTimer timer(timer_message); delete m_mos; m_mos = new MapObjectSaver(); === modified file 'src/map_io/s2map.cc' --- src/map_io/s2map.cc 2016-01-29 13:43:56 +0000 +++ src/map_io/s2map.cc 2016-02-10 20:59:09 +0000 @@ -361,7 +361,10 @@ int32_t S2MapLoader::load_map_complete (Widelands::EditorGameBase& egbase, MapLoader::LoadType) { - ScopedTimer timer("S2MapLoader::load_map_complete() took %ums"); + std::string timer_message = "S2MapLoader::load_map_complete() for '"; + timer_message += m_map.get_name(); + timer_message += "' took %ums"; + ScopedTimer timer(timer_message); load_s2mf(egbase); === modified file 'src/map_io/widelands_map_loader.cc' --- src/map_io/widelands_map_loader.cc 2016-01-29 15:25:58 +0000 +++ src/map_io/widelands_map_loader.cc 2016-02-10 20:59:09 +0000 @@ -108,7 +108,10 @@ int32_t WidelandsMapLoader::load_map_complete (EditorGameBase & egbase, MapLoader::LoadType load_type) { - ScopedTimer timer("WidelandsMapLoader::load_map_complete() took %ums"); + std::string timer_message = "WidelandsMapLoader::load_map_complete() for '"; + timer_message += m_map.get_name(); + timer_message += "' took %ums"; + ScopedTimer timer(timer_message); bool is_game = load_type == MapLoader::LoadType::kGame; === modified file 'src/wui/suggested_teams_box.cc' --- src/wui/suggested_teams_box.cc 2016-01-29 08:37:22 +0000 +++ src/wui/suggested_teams_box.cc 2016-02-10 20:59:09 +0000 @@ -123,9 +123,9 @@ } is_first = false; - for (uint16_t player : team) { + for (Widelands::PlayerNumber player : team) { assert(player < MAX_PLAYERS); - const Image* player_image = g_gr->images().get(player_pictures_small[++player]); + const Image* player_image = g_gr->images().get(player_pictures_small[player]); assert(player_image); player_icon = new UI::Icon(lineup_box_, 0, 0, 20, 20, player_image); player_icon->set_visible(true);
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp