← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1815283-nil-value-territorial into lp:widelands

 

Toni Förster has proposed merging lp:~widelands-dev/widelands/bug-1815283-nil-value-territorial into lp:widelands.

Commit message:
add player name to rank_players()

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1815283 in widelands: "Nil value in Territiorial Lord"
  https://bugs.launchpad.net/widelands/+bug/1815283

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1815283-nil-value-territorial/+merge/363079
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1815283-nil-value-territorial into lp:widelands.
=== modified file 'data/scripting/win_conditions/territorial_functions.lua'
--- data/scripting/win_conditions/territorial_functions.lua	2019-01-02 13:47:23 +0000
+++ data/scripting/win_conditions/territorial_functions.lua	2019-02-12 17:47:26 +0000
@@ -153,13 +153,13 @@
             territory_was_kept = winning_players[playerinfo.number] ~= nil
             winning_players[playerinfo.number] = true
             territory_points.last_winning_player = playerinfo.number
-            territory_points.last_winning_player_name = players[playerinfo.number].name
+            territory_points.last_winning_player_name = playerinfo.name
             territory_points.last_winning_team = -1
          else
             winning_players[playerinfo.number] = nil
          end
          if teaminfo.team == 0 then
-            points[#points + 1] = { players[playerinfo.number].name, playerinfo.points }
+            points[#points + 1] = { playerinfo.name, playerinfo.points }
          end
       end
    end

=== modified file 'data/scripting/win_conditions/win_condition_functions.lua'
--- data/scripting/win_conditions/win_condition_functions.lua	2019-02-10 11:36:10 +0000
+++ data/scripting/win_conditions/win_condition_functions.lua	2019-02-12 17:47:26 +0000
@@ -200,7 +200,7 @@
             team = 0,
             points = player_points,
             players = {
-               { number = player.number, points = player_points }
+               { number = player.number, name = player.name, points = player_points }
             }
          }
          table.insert(ranked_players_and_teams, team_table)
@@ -222,7 +222,7 @@
       }
       for idx, player in ipairs(plrs) do
          if player.team == team then
-            table.insert(team_table.players, { number = player.number, points = all_player_points[player.number] })
+            table.insert(team_table.players, { number = player.number, name = player.name, points = all_player_points[player.number] })
          end
       end
       table.insert(ranked_players_and_teams, team_table)


Follow ups