From e6dafe9efc6d748db77294ee184fa2cb31802f64 Mon Sep 17 00:00:00 2001 From: elexis Date: Fri, 16 Jun 2017 19:39:30 +0000 Subject: [PATCH] Fix a map exploration OOS on rejoin when starting with territory at the map boundaries. 6aeb5c64de forgot to add a LosIsOffWorld check in ExploreTerritories (aka UpdateTerritoriesLos) and thus marked tiles outside of the world as explored. f5e60157bf transformed the bug into a non-simulation desynchronization, causing rejoined players to see a different score, as they excluded off-world tiles when filling the cache in ResetDerivedData upon rejoin. 4a0673e44e transformed the bug into an actual simulation OOS by serializing that map exploration percentage based on that cache. Also tiles at the map border in square maps are not rendered as expected, so this commit hides refs #4267. Differential Revision: https://code.wildfiregames.com/D630 Fixes #4598 Proofread by: Itms Tested By: Imarok This was SVN commit r19790. --- source/simulation2/components/CCmpRangeManager.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/simulation2/components/CCmpRangeManager.cpp b/source/simulation2/components/CCmpRangeManager.cpp index 47024efe11..6502e8b14c 100644 --- a/source/simulation2/components/CCmpRangeManager.cpp +++ b/source/simulation2/components/CCmpRangeManager.cpp @@ -1917,13 +1917,16 @@ public: if (p > 0 && p <= MAX_LOS_PLAYER_ID) { u32& explored = m_ExploredVertices.at(p); - for (int dj = 0; dj <= scale; ++dj) - for (int di = 0; di <= scale; ++di) + for (int tj = j * scale; tj <= (j+1) * scale; ++tj) + for (int ti = i * scale; ti <= (i+1) * scale; ++ti) { - u32& losState = m_LosState[(i*scale+di) + (j*scale+dj)*m_TerrainVerticesPerSide]; + if (LosIsOffWorld(ti, tj)) + continue; + + u32& losState = m_LosState[ti + tj * m_TerrainVerticesPerSide]; if (!(losState & (LOS_EXPLORED << (2*(p-1))))) { - explored++; + ++explored; losState |= (LOS_EXPLORED << (2*(p-1))); } }