[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands
Toni Förster has proposed merging lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands. Commit message: - macOS: set build target to 10.9 if macOS 10.9 or newer is found. - macOS: append macOS target version to dmg filename. Requested reviews: SirVer (sirver) Related bugs: Bug #1817607 in widelands: "macOS: 2 builds for Release" https://bugs.launchpad.net/widelands/+bug/1817607 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1817607-macos-build/+merge/364204 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1817607-macos-build. === modified file 'utils/macos/build_app.sh' --- utils/macos/build_app.sh 2018-12-13 21:27:09 + +++ utils/macos/build_app.sh 2019-03-09 10:20:12 + @@ -62,9 +62,14 @@ # If not, use the one for the installed macOS Version OSX_MIN_VERSION="10.7" SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_MIN_VERSION.sdk" + +OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) +OSX_MINOR=$(sw_vers -productVersion | cut -d . -f 2) + if [ ! -d "$SDK_DIRECTORY" ]; then - OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) - OSX_MIN_VERSION=$OSX_VERSION + if [ "$OSX_MINOR" -ge 9 ]; then + OSX_MIN_VERSION="10.9" + fi SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk" if [ ! -d "$SDK_DIRECTORY" ]; then # If the SDK for the current macOS Version can't be found, use whatever is linked to MacOSX.sdk @@ -86,7 +91,8 @@ echo " Version: $WLVERSION" echo " Destination: $DESTINATION" echo " Type:$TYPE" -echo " macOS: $OSX_MIN_VERSION" +echo " macOS: $OSX_VERSION" +echo " Target: $OSX_MIN_VERSION" echo " Compiler:$COMPILER" echo "" @@ -102,9 +108,9 @@ echo "Creating DMG ..." if [ "$TYPE" == "Release" ]; then - hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_64bit_$WLVERSION.dmg" + hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_${OSX_MIN_VERSION}_$WLVERSION.dmg" elif [ "$TYPE" == "Debug" ]; then - hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_64bit_${WLVERSION}_${TYPE}.dmg" + hdiutil create -fs HFS+ -volname "Widelands $WLVERSION" -srcfolder "$DESTINATION" "$UP/widelands_${OSX_MIN_VERSION}_${WLVERSION}_${TYPE}.dmg" fi } ___ 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
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/speedup_saveloading into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/speedup_saveloading into lp:widelands. Commit message: Tweak performance for saveloading and introduce an optional "init" function for winconditions with costly calculations - Affected win conditions: Artifacts, Wood Gnome, Territorial Time, Territorial Lord. - Saveload long lists of fields via C++ because Lua persistence is very expensive - Use map index for iteration when writing - Write map resources packet as string - Clean up writing CmdFlagAction - Bulk skip all commands with greater duetime when writing command queue packet Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1818402 in widelands: "Move territorial calculations to the init screen" https://bugs.launchpad.net/widelands/+bug/1818402 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/speedup_saveloading/+merge/364205 We will need either this branch in Build 20 or a separate branch to fix Artifacts, because we broke it. I'd like this branch for its performance improvements, but it is big, so I can be convinced otherwise. Some stats for the big map "Magic Mountain" with Territorial Time: This branch: Writing Wincondition Data: 146ms Writing Scripting Data: 25ms Sum 171ms Reading Wincondition Data: 997ms Reading Scripting Data: 5ms Sum 1 002ms Trunk: Writing Scripting Data: 32 218ms Reading Scripting Data: 4 116ms Writing speed factor: ca. 188x Reading speed factor: ca. 4x -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/speedup_saveloading into lp:widelands. === modified file 'data/scripting/win_conditions/territorial_functions.lua' --- data/scripting/win_conditions/territorial_functions.lua 2019-02-21 08:39:13 + +++ data/scripting/win_conditions/territorial_functions.lua 2019-03-09 11:05:59 + @@ -7,45 +7,13 @@ set_textdomain("win_conditions") include "scripting/richtext.lua" +include "scripting/win_conditions/win_condition_functions.lua" include "scripting/win_conditions/win_condition_texts.lua" local team_str = _"Team %i" local wc_has_territory = _"%1$s has %2$3.0f%% of the land (%3$i of %4$i)." local wc_had_territory = _"%1$s had %2$3.0f%% of the land (%3$i of %4$i)." --- RST --- .. function:: count_owned_fields_for_all_players(fields, players) --- ---Counts all owned fields for each player. --- ---:arg fields: Table of all buildable fields ---:arg players: Table of all players --- ---:returns: a table with ``playernumber = count_of_owned_fields`` entries --- -local function count_owned_fields_for_all_players(fields, players) - local owned_fields = {} - -- init the landsizes for each player - for idx,plr in ipairs(players) do - owned_fields[plr.number] = 0 - end - - for idx,f in ipairs(fields) do - -- check if field is owned by a player - local owner = f.owner - if owner then - local owner_number = owner.number - if owned_fields[owner_number] == nil then --- In case player was defeated and lost all their warehouses, make sure they don't count -owned_fields[owner_number] = -1 - elseif owned_fields[owner_number] >= 0 then -owned_fields[owner_number] = owned_fields[owner_number] + 1 - end - end - end - return owned_fields -end - -- Used by calculate_territory_points keep track of when the winner changes local winning_players = {} local winning_teams = {} @@ -91,7 +59,7 @@ --First checks if a player was defeated, then fills the ``territory_points`` table --with current data. -- ---:arg fields: Table of all buildable fields +--:arg fields: Number of all valuable fields --:arg players: Table of all players --:arg wc_descname: String with the win condition's descname --:arg wc_version: Number with the win condition's descname @@ -100,12 +68,12 @@ local points = {} -- tracking points of teams and players without teams local territory_was_kept = false - territory_points.all_player_points = count_owned_fields_for_all_players(fields, players) + territory_points.all_player_points = count_owned_valuable_fields_for_all_players(players) local ranked_players = rank_players(territory_points.all_player_points, players) -- Check if we have a winner. The table was sorted, so we can simply grab the first entry. local winning_points = -1 - if ranked_players[1].points > ( #fields / 2 ) then + if ranked_players[1].points > ( fields / 2 ) then winning_points = ranked_players[1].points end @@ -161,7 +129,7 @@ --Returns a string containing the current land percentages of players/teams --for messages to the players -- ---:arg fields: Table of all buildable fields +--:arg fields: Number of all valuable fields --:arg has_had: Use "has" for an interim message, "ha
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/speedup_saveloading into lp:widelands
Review: Approve tested Tested this, also with old savegames. Works like a charm. Tremendously speeds up the saving and loading (territorial & woodgnome). -- https://code.launchpad.net/~widelands-dev/widelands/speedup_saveloading/+merge/364205 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/speedup_saveloading. ___ 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
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1818909-web-encyclopedia into lp:widelands
If you can come up with a better name for the variable, I'm all ears :) Thanks for the review! Input queue test timeout again @bunnybot merge force -- https://code.launchpad.net/~widelands-dev/widelands/bug-1818909-web-encyclopedia/+merge/364141 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1818909-web-encyclopedia. ___ 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
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands
1 general nitpick. I don't know anything about MacOS - has this been tested with both older and newer Macs? Diff comments: > === modified file 'utils/macos/build_app.sh' > --- utils/macos/build_app.sh 2018-12-13 21:27:09 + > +++ utils/macos/build_app.sh 2019-03-09 10:20:12 + > @@ -62,9 +62,14 @@ > # If not, use the one for the installed macOS Version > OSX_MIN_VERSION="10.7" > > SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_MIN_VERSION.sdk" > + > +OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) > +OSX_MINOR=$(sw_vers -productVersion | cut -d . -f 2) > + > if [ ! -d "$SDK_DIRECTORY" ]; then > - OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) > - OSX_MIN_VERSION=$OSX_VERSION Did you remove this on purpose? The variable is no longer initialized. > + if [ "$OSX_MINOR" -ge 9 ]; then > + OSX_MIN_VERSION="10.9" > + fi > > SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk" > if [ ! -d "$SDK_DIRECTORY" ]; then ># If the SDK for the current macOS Version can't be found, use > whatever is linked to MacOSX.sdk -- https://code.launchpad.net/~widelands-dev/widelands/bug-1817607-macos-build/+merge/364204 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1817607-macos-build. ___ 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
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands
I can only test this with a newer Mac. SirVer needs to test this on his old one, though. For the nit see inline. Diff comments: > === modified file 'utils/macos/build_app.sh' > --- utils/macos/build_app.sh 2018-12-13 21:27:09 + > +++ utils/macos/build_app.sh 2019-03-09 10:20:12 + > @@ -62,9 +62,14 @@ > # If not, use the one for the installed macOS Version > OSX_MIN_VERSION="10.7" OSX_MIN_VERSION gets initialized here. > > SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_MIN_VERSION.sdk" > + > +OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) > +OSX_MINOR=$(sw_vers -productVersion | cut -d . -f 2) > + > if [ ! -d "$SDK_DIRECTORY" ]; then > - OSX_VERSION=$(sw_vers -productVersion | cut -d . -f 1,2) > - OSX_MIN_VERSION=$OSX_VERSION > + if [ "$OSX_MINOR" -ge 9 ]; then > + OSX_MIN_VERSION="10.9" > + fi > > SDK_DIRECTORY="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk" > if [ ! -d "$SDK_DIRECTORY" ]; then ># If the SDK for the current macOS Version can't be found, use > whatever is linked to MacOSX.sdk -- https://code.launchpad.net/~widelands-dev/widelands/bug-1817607-macos-build/+merge/364204 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1817607-macos-build. ___ 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
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands
Review: Approve OK, I overlooked that. Code is good to go. -- https://code.launchpad.net/~widelands-dev/widelands/bug-1817607-macos-build/+merge/364204 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1817607-macos-build. ___ 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
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1818909-web-encyclopedia into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/bug-1818909-web-encyclopedia into lp:widelands has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1818909-web-encyclopedia/+merge/364141 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1818909-web-encyclopedia. ___ 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
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1817607-macos-build into lp:widelands
Continuous integration builds have changed state: Travis build 4571. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/503973556. Appveyor build 4358. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1817607_macos_build-4358. -- https://code.launchpad.net/~widelands-dev/widelands/bug-1817607-macos-build/+merge/364204 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1817607-macos-build. ___ 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
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/speedup_saveloading into lp:widelands
Continuous integration builds have changed state: Travis build 4572. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/503990492. Appveyor build 4359. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_speedup_saveloading-4359. -- https://code.launchpad.net/~widelands-dev/widelands/speedup_saveloading/+merge/364205 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/speedup_saveloading. ___ 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
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1818494-reset-zoom-crash into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1818494-reset-zoom-crash into lp:widelands. Commit message: Fix/catch some memory issues - Limit the editor undo stack to 500 items - In fields_to_draw, make sure not to resize the vector to more memory than available, because this can crash when zooming out. Simply skip the unavailable bottom fields when drawing and log it. Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1818494 in widelands: "Crash on "Reset zoom" bzr9005-201903031251 (Release)" https://bugs.launchpad.net/widelands/+bug/1818494 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1818494-reset-zoom-crash/+merge/364208 This should help with a crash that a user experienced when using the editor for a long time or playing long games, then zooming out. The problem is that Widelands doesn't have enough memory allocated to grow the vector to the required size in fields_to_draw.reset(). So, I have added a safeguard there which will log to console when there isn't enough memory and then simply not update the additional fields. The user will see fields not properly drawn/updated at the bottom of the screen then. The problem happens only after a long time -> I found that the editor's "Undo" stack is unlimited, so I have putting an arbitrary cap on that. No solution for the in-game memory consumption yet. We do have steadily growing containers there which are the statistics, but that can't be helped. There might be others that we haven't found yet though. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1818494-reset-zoom-crash into lp:widelands. === modified file 'src/editor/tools/history.cc' --- src/editor/tools/history.cc 2019-02-23 11:00:49 + +++ src/editor/tools/history.cc 2019-03-10 07:49:40 + @@ -27,6 +27,9 @@ // === EditorActionArgs === // +constexpr size_t kMaximumUndoActions = 500; +constexpr size_t kTooManyUndoActionsDeleteBatch = 50; + EditorActionArgs::EditorActionArgs(EditorInteractive& base) : sel_radius(base.get_sel_radius()), change_by(0), @@ -115,6 +118,11 @@ undo_stack_.push_front(ac); undo_button_.set_enabled(true); redo_button_.set_enabled(false); + if (undo_stack_.size() > kMaximumUndoActions) { + for (size_t i = 0; i < kTooManyUndoActionsDeleteBatch; ++i) { +undo_stack_.pop_back(); + } + } } return tool.handle_click(ind, world, center, parent, ac.args, &map); } === modified file 'src/graphic/gl/fields_to_draw.cc' --- src/graphic/gl/fields_to_draw.cc 2019-02-23 11:00:49 + +++ src/graphic/gl/fields_to_draw.cc 2019-03-10 07:49:40 + @@ -106,7 +106,17 @@ w_ = max_fx_ - min_fx_ + 1; h_ = max_fy_ - min_fy_ + 1; - const size_t dimension = w_ * h_; + assert(w_ > 0); + assert(h_ > 0); + + // Ensure that there is enough memory for the resize operation + size_t dimension = w_ * h_; + const size_t max_dimension = fields_.max_size(); + if (dimension > max_dimension) { + log("WARNING: Not enough memory allocated to redraw the whole map!\nWe recommend that you restart Widelands\n"); + dimension = max_dimension; + } + // Now resize the vector if (fields_.size() != dimension) { fields_.resize(dimension); } ___ 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