Page MenuHomeWildfire Games

Rallypoint color after deserialization
ClosedPublic

Authored by elexis on Aug 22 2017, 7:41 PM.

Details

Summary

As reported by mimo in rP19957, if we set a rallypoint, write a savegame and load that, the rallypoint will be black.

The rallypoint renderer simulation component doesn't serialize anything, so Init just resets all numbers to the default constructor values.

Doing anything on deserialize (like UpdateLineColor + ConstructAllOverlayLines) can't work, because the dependent components (Player, Ownership) are deserialized after this component.

Not the first time that we run into this init order problem (RangeVisualization.OnDeserialized from rP19861 relies on the init order being this way (alphabetic)) and would bug if the component had a different name.

Test Plan

Set a rallypoint, write a savegame and load that, the rallypoint will be black. Unless applying the patch.
Add debug_printf to figure out the init order.

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.Aug 22 2017, 7:41 PM
Vulcan added a subscriber: Vulcan.Aug 22 2017, 7:54 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/430/ for more details.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

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

mimo added a subscriber: mimo.Aug 23 2017, 7:27 PM

I've tested the patch, and it works as expected.
But concerning the order, i'm wondering if we could do it in two groups (keeping the alphabetical order in each group): first the non-renderer ones and then the renderer ones? that would solve that kind of issues.
(note that this is only a question as i don't know that part of the code).

This revision was automatically updated to reflect the committed changes.