← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/safeguard-multiplayer-messages into lp:widelands

 

Toni Förster has proposed merging lp:~widelands-dev/widelands/safeguard-multiplayer-messages into lp:widelands.

Commit message:
Safeguard to avoid desyncs when using send_message() from ui.lua

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/safeguard-multiplayer-messages/+merge/362942

This should make sure that we don't have desyncs when in multiplayer and sending messages. Could potentially solve some desyncs in smugglers multiplayer campaign.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/safeguard-multiplayer-messages into lp:widelands.
=== modified file 'data/scripting/ui.lua'
--- data/scripting/ui.lua	2019-01-27 18:57:30 +0000
+++ data/scripting/ui.lua	2019-02-09 15:53:48 +0000
@@ -181,8 +181,10 @@
 --    Sleeps while player is in roadbuilding mode.
 --
 function wait_for_roadbuilding()
-   _await_animation()
-   while (wl.ui.MapView().is_building_road) do sleep(2000) end
+   if wl.Game().type == "singleplayer" then
+      _await_animation()
+      while (wl.ui.MapView().is_building_road) do sleep(2000) end
+   end
 end
 
 

=== modified file 'data/scripting/win_conditions/win_condition_functions.lua'
--- data/scripting/win_conditions/win_condition_functions.lua	2019-02-09 07:51:55 +0000
+++ data/scripting/win_conditions/win_condition_functions.lua	2019-02-09 15:53:48 +0000
@@ -108,7 +108,7 @@
 function broadcast(plrs, header, msg, goptions)
    local options = goptions or {}
    for idx, p in ipairs(plrs) do
-      p:send_message(header, msg, options)
+      send_message(p, header, msg, options)
    end
 end
 


Follow ups