Shared AND/C2C Debug codes

I added a new struct, CvLandmarkData to store the 3 landmark fields in CvPlot with the goal of saving 8 bytes per CvPlot instance, but I have issues retaining save compatibility with the changes. I tried to read the data into fields with the same names as the old fields but I am clearly doing something wrong, because the data mismatches and is not loaded.

Here is a diff of my changes: https://dl.dropboxusercontent.com/u/49805/CvLandmark.patch
 
Sorry for the late answer, i changed the three marked lines and it's working.


Code:
	[B][COLOR="Red"]CvWString m_szLandmarkMessage;
	CvWString m_szLandmarkName;[/COLOR][/B]
	if (GC.getLoadedInitCore().getGameSaveSvnRev() <= 782)
	{
		WRAPPER_READ_STRING(wrapper, "CvPlot", m_szLandmarkMessage);
		WRAPPER_READ_STRING(wrapper, "CvPlot", m_szLandmarkName);
	}

	WRAPPER_READ(wrapper, "CvPlot", &m_eClaimingOwner);
	if (GC.getLoadedInitCore().getGameSaveSvnRev() <= 782)
	{
		[B][COLOR="Red"]LandmarkTypes m_eLandmarkType = NO_LANDMARK;[/COLOR][/B]
		WRAPPER_READ(wrapper, "CvPlot", (int*)&m_eLandmarkType);

		m_pLandmark = NULL;
		if (m_eLandmarkType != NO_LANDMARK)
		{
			m_pLandmark = new CvLandmarkData;
			m_pLandmark->eLandmark = m_eLandmarkType;
			m_pLandmark->szLandmarkMessage = m_szLandmarkMessage;
			m_pLandmark->szLandmarkName = m_szLandmarkName;
		}
	}
 
Well done Afforess! We'll have to adapt that in as soon as we can find the time to do so. Excellent work :D

On further reflection since last night, I am leaning towards suggesting altering the zobrist plot cache to be serialized in game saves in addition to the async change. If the cache is created in an async manner, it may cause clients to go OOS because it will break the deterministic nature of the game (each client will have a separate and distinct and unique cache, and the interactions of their game state and the cache may cause slight differences in game behavior over the course of the game, which will create a *very* hard to debug OOS). It seems easier to sidestep this entire possibility by serializing the cache to saves, and by extension, MP sessions. This eliminates the possibility of future OOS issues from cache differences.

When I write this up, I will create a diff for you.
 
Back
Top Bottom