Page MenuHomeWildfire Games

Fix diplomacy dialog when ceasefire ended following an oversight in 19257
ClosedPublic

Authored by elexis on Mar 2 2017, 4:03 PM.

Details

Summary

The diplomacy dialog still displays enemies as neutral since rP19247, because the removed updateDiplomacy() in gui/common/ updated the playerdata too when the ceasefire ended.
I confused the old updateDiplomacy with the new updateDiplomacy when reviewing. I guess one of us should have tested the diff.

The proposed patch adds a new GUI notification that is sent if the ceasefire has ended, so that we and modders could do some arbitrary actions if the ceasefire has ended.
Calling updatePlayerData onSimulationUpdate would work too, but readers would not understand that it's currently only due to the ceasefire in that place when not adding a comment.

Notice there is no race condition, as first all notifications are processed in onSimulationUpdate by calling handleNotifications (diplo, ceasefire, defeat, win),
after that the diplo dialog is updated by calling updateGUIObjects.
So for all current updatePlayerData calls an updateGUIObjects follows.

Test Plan

Start a game with 1 minute ceasefire, open the diplomacy dialog, press F9, type Engine.SetSimRate(20); to fast forward.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Mar 2 2017, 4:03 PM
Vulcan added a subscriber: Vulcan.Mar 2 2017, 4:49 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/449/ for more details.

mimo accepted this revision.Mar 2 2017, 6:54 PM

Thanks for the fix. Code looks good and i've tested that diplomacy window is indeed updated at end of ceasefire.

This revision is now accepted and ready to land.Mar 2 2017, 6:54 PM
This revision was automatically updated to reflect the committed changes.