#3378 closed defect (fixed)
Crash on rejoin (percentage of map controlled)
Reported by: | elexis | Owned by: | Itms |
---|---|---|---|
Priority: | Release Blocker | Milestone: | Alpha 19 |
Component: | Core engine | Keywords: | patch |
Cc: | Itms | Patch: |
Description (last modified by )
If you start a multiplayergame on the skirmish map "Northern Island (2)" or "Neareastern Badlands (4)" and then rejoin with the other client, you get this crash:
CCmpTerritoryManager.cpp(538): Assertion failed: "m_TerritoryTotalPassableCellCount > 0" Assertion failed: "m_TerritoryTotalPassableCellCount > 0" Location: CCmpTerritoryManager.cpp:538 (GetTerritoryPercentage)
That commit initially sets m_TerritoryTotalPassableCellCount = 0;
but requires ENSURE(m_TerritoryTotalPassableCellCount > 0);
in the according line.
Sounds like that value should either be serialized or computed again when rejoining.
The serializationtest doesn't fail.
Attachments (2)
Change History (7)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
by , 9 years ago
Attachment: | 3378_v1.patch added |
---|
comment:2 by , 9 years ago
CCmpTerritoryManager
is not serialized at all - to quote the in-script comment:
Territory state can be recomputed as required, so we don't need to serialize any of it.
So upon rejoin, the territories must be recalculated. The same function that calculates territories also sets m_TerritoryTotalPassableCellCount
.
But... something is calling GetTerritoryPercentage()
before CalculateTerritories()
has a chance to run. And the only thing that currently uses it is the player (JS) component StatisticsTracker
.
Anyhow, attached patch makes sure that CalculateTerritories()
runs before m_TerritoryTotalPassableCellCount
is used.
comment:3 by , 9 years ago
Keywords: | patch review added |
---|
comment:5 by , 9 years ago
Keywords: | review removed |
---|
Thanks for the fix. The comment wasn't really necessary, and I fixed a mistake I hadn't seen in the original patch.
If you wonder, my change <= 0
to == 0
is intentional, as it's better to actually crash if the variable is badly initialized.
Proposed fix.