Example #1
0
CPathManager::CPathManager(): nextPathID(0)
{
	maxResPF = new CPathFinder();
	medResPE = new CPathEstimator(maxResPF,  8, "pe",  mapInfo->map.name);
	lowResPE = new CPathEstimator(maxResPF, 32, "pe2", mapInfo->map.name);

	LOG("[CPathManager] pathing data checksum: %08x", GetPathCheckSum());

	#ifdef SYNCDEBUG
	// clients may have a non-writable cache directory (which causes
	// the estimator path-file checksum to remain zero), so we can't
	// update the sync-checker with this in normal builds
	// NOTE: better to just checksum the in-memory data and broadcast
	// that instead of relying on the zip-file CRC?
	{ SyncedUint tmp(GetPathCheckSum()); }
	#endif
}
Example #2
0
CPathManager::CPathManager()
{
	// Create pathfinder and estimators.
	pf  = new CPathFinder();
	pe  = new CPathEstimator(pf,  8, CMoveMath::BLOCK_STRUCTURE | CMoveMath::BLOCK_TERRAIN, "pe", mapInfo->map.name);
	pe2 = new CPathEstimator(pf, 32, CMoveMath::BLOCK_STRUCTURE | CMoveMath::BLOCK_TERRAIN, "pe2", mapInfo->map.name);

	// Reset id-counter.
	nextPathId = 0;

	logOutput.Print("[CPathManager] pathing data checksum: %08x\n", GetPathCheckSum());

	#ifdef SYNCDEBUG
	// clients may have a non-writable cache directory (which causes
	// the estimator path-file checksum to remain zero), so we can't
	// update the sync-checker with this in normal builds
	// NOTE: better to just checksum the in-memory data and broadcast
	// that instead of relying on the zip-file CRC?
	{ SyncedUint tmp(GetPathCheckSum()); }
	#endif
}
Example #3
0
std::int64_t CPathManager::Finalize() {
	const spring_time t0 = spring_gettime();

	{
		// maxResPF only runs on the main thread, so can be unsafe
		maxResPF = pfMemPool.alloc<CPathFinder>(false);
		medResPE = peMemPool.alloc<CPathEstimator>(maxResPF, MEDRES_PE_BLOCKSIZE, "pe",  mapInfo->map.name);
		lowResPE = peMemPool.alloc<CPathEstimator>(medResPE, LOWRES_PE_BLOCKSIZE, "pe2", mapInfo->map.name);

		// make cached path data checksum part of synced state
		// so that when any client has a corrupted / incorrect
		// cache it desyncs from the start, not minutes later
		{ SyncedUint tmp(GetPathCheckSum()); }
	}

	const spring_time dt = spring_gettime() - t0;
	return (dt.toMilliSecsi());
}