SirVer has proposed merging
lp:~widelands-dev/widelands/wood_gnome_infinite_trees into lp:widelands.
Commit message:
When a player is defeated, it is removed from the 'plrs' array by the
'check_player_defeated'. This lead to this players points not being reset on
recalculation, ergo on each calculation the player gained the number of trees
currently on its terrain as points.
A classical CS bug: Cache invalidation errors.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/wood_gnome_infinite_trees/+merge/313397
When a player is defeated, it is removed from the 'plrs' array by the
'check_player_defeated'. This lead to this players points not being reset on
recalculation, ergo on each calculation the player gained the number of trees
currently on its terrain as points.
--
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/wood_gnome_infinite_trees into lp:widelands.
=== modified file 'data/scripting/win_conditions/wood_gnome.lua'
--- data/scripting/win_conditions/wood_gnome.lua 2016-09-17 11:29:34 +0000
+++ data/scripting/win_conditions/wood_gnome.lua 2016-12-15 21:01:46 +0000
@@ -57,10 +57,16 @@
return _plrpoints
end
- -- init the playerpoints for each player
+ -- clear out the table. We count afresh.
+ for k,v in pairs(_plrpoints) do
+ _plrpoints[k] = nil
+ end
+
+ -- Insert all players who are still in the game.
for idx,plr in ipairs(plrs) do
_plrpoints[plr.number] = 0
end
+
for idf,f in ipairs(fields) do
-- check if field is owned by a player
local owner = f.owner
@@ -110,6 +116,7 @@
pic = "images/wui/stats/genstats_trees.png",
calculator = function(p)
local pts = _calc_points(p)
+ print(("p.number: %q, pts: %q"):format(p.number, pts[p.number]))
return pts[p.number]
end,
}
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp