← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-collectors into lp:widelands

 

Notabilis has proposed merging lp:~widelands-dev/widelands/bug-collectors into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-collectors/+merge/312092

When a game of Collectors ends and the player keeps playing, he can see a status message in his inbox which states: "Game will end in ."
Since the game already ended, no time is printed as part of the sentence.

This branch fixes the issue by printing "Game over" in this last message.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-collectors into lp:widelands.
=== modified file 'data/scripting/win_conditions/collectors.lua'
--- data/scripting/win_conditions/collectors.lua	2016-09-12 09:57:16 +0000
+++ data/scripting/win_conditions/collectors.lua	2016-11-29 20:55:36 +0000
@@ -135,25 +135,31 @@
 
    -- Send all players the momentary game state
    local function _send_state(remaining_time, plrs)
-      set_textdomain("win_conditions")
-      local h = math.floor(remaining_time / 60)
-      local m = remaining_time % 60
-      -- TRANSLATORS: Context: 'The game will end in (2 hours and) 30 minutes.'
-      local time = ""
-      if m > 0 then
-         time = (ngettext("%i minute", "%i minutes", m)):format(m)
-      end
-      if h > 0 then
+      local msg = ""
+      if remaining_time <= 0 then
+         set_textdomain("widelands")
+         msg = p(_"Game over")
+      else
+         set_textdomain("win_conditions")
+         local h = math.floor(remaining_time / 60)
+         local m = remaining_time % 60
+         -- TRANSLATORS: Context: 'The game will end in (2 hours and) 30 minutes.'
+         local time = ""
          if m > 0 then
-            -- TRANSLATORS: Context: 'The game will end in 2 hours and 30 minutes.'
-            time = (ngettext("%1% hour and %2%", "%1% hours and %2%", h)):bformat(h, time)
-         else
-            -- TRANSLATORS: Context: 'The game will end in 2 hours.'
-            time = (ngettext("%1% hour", "%1% hours", h)):bformat(h)
-         end
+            time = (ngettext("%i minute", "%i minutes", m)):format(m)
+         end
+         if h > 0 then
+            if m > 0 then
+               -- TRANSLATORS: Context: 'The game will end in 2 hours and 30 minutes.'
+               time = (ngettext("%1% hour and %2%", "%1% hours and %2%", h)):bformat(h, time)
+            else
+               -- TRANSLATORS: Context: 'The game will end in 2 hours.'
+               time = (ngettext("%1% hour", "%1% hours", h)):bformat(h)
+            end
+         end
+         -- TRANSLATORS: Context: 'The game will end in 2 hours and 30 minutes.'
+         msg = p(_"The game will end in %s."):format(time)
       end
-      -- TRANSLATORS: Context: 'The game will end in 2 hours and 30 minutes.'
-      local msg = p(_"The game will end in %s."):format(time)
 
       -- Points for players without team
       for idx, plr in ipairs(plrs) do


Follow ups