//===========================================================================//
// File:	NetBitDepts.cpp											
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 01/06/1999  JSE  Inital coding
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Microsoft Corp.										 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//


#include "MW4Headers.hpp"

#include "NetConstants.hpp"
#include "MWEntityManager.hpp"
#include "NetUpdateManager.hpp"
#include "Dictionary.hpp"

void BitDepthManager::InitilizeBitDepths(void)
{

	randomKey = Random::GetInt();

	lowBitDepths = new int *[UpdateManager::GetUpdateCount()];
	medBitDepths = new int *[UpdateManager::GetUpdateCount()];
	highBitDepths = new int *[UpdateManager::GetUpdateCount()];


	updateRates[LowBandwidth] = new UpdateRate [UpdateManager::GetUpdateCount()];
	updateRates[MediumBandwidth] = new UpdateRate [UpdateManager::GetUpdateCount()];
	updateRates[HighBandwidth] = new UpdateRate [UpdateManager::GetUpdateCount()];
	

	for (int i = 0; i < UpdateManager::GetUpdateCount(); ++i)
	{
		Verify(UpdateManager::UpdateEntries[i].GetUpdateID() == i);

		

		if (UpdateManager::GetUpdateEntryCount(i) > 0)
		{
			lowBitDepths[i] = new int[UpdateManager::GetUpdateEntryCount(i)];
			Register_Pointer(lowBitDepths[i]);
			medBitDepths[i] = new int[UpdateManager::GetUpdateEntryCount(i)];
			Register_Pointer(medBitDepths[i]);
			highBitDepths[i] = new int[UpdateManager::GetUpdateEntryCount(i)];
			Register_Pointer(highBitDepths[i]);

			for (int j = 0; j < UpdateManager::GetUpdateEntryCount(i); ++j)
			{
				
				int *current_bit_depth = &lowBitDepths[i][j];
				*current_bit_depth = -1;

				current_bit_depth = &medBitDepths[i][j];
				*current_bit_depth = -1;

				current_bit_depth = &highBitDepths[i][j];
				*current_bit_depth = -1;
			}
		}
	}


	// put in a generic scamble here


	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Mech Full Position
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(MechPositionUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::XPositionUpdateEntryID]=23^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::YAboveTerrainUpdateEntryID]=23^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ZPositionUpdateUpdateEntryID]=23^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentRotationUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoPitchUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoYawUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentSpeedUpdateEntryID]=7^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentXVelocityEntryID]=8^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentYVelocityEntryID]=12^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentZVelocityEntryID]=13^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::RotationDemandUpdateEntryID]=5^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::SpeedDemandUpdateEntryID]=7^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoPichDemandUpdateEntryID]=5^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoYawDemandUpdateEntryID]=5^231;
	lowBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ViewDemandUpdateEntryID]=2^231;
	


	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::XPositionUpdateEntryID]=23^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::YAboveTerrainUpdateEntryID]=23^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ZPositionUpdateUpdateEntryID]=23^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentRotationUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoPitchUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoYawUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentSpeedUpdateEntryID]=7^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentXVelocityEntryID]=16^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentYVelocityEntryID]=24^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentZVelocityEntryID]=24^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::RotationDemandUpdateEntryID]=5^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::SpeedDemandUpdateEntryID]=7^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoPichDemandUpdateEntryID]=5^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoYawDemandUpdateEntryID]=5^231;
	medBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ViewDemandUpdateEntryID]=2^231;
	

	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::XPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::YAboveTerrainUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ZPositionUpdateUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentRotationUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoPitchUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentTorsoYawUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentSpeedUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentXVelocityEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentYVelocityEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::CurrentZVelocityEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::RotationDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::SpeedDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoPichDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::TorsoYawDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::MechPositionUpdateID][MechPositionUpdate::ViewDemandUpdateEntryID]=2^231;



	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Mech Animation
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(MechAnimationUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentSimulationStateUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::AnimationStateUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TransitionStateUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentPositionUpdateEntryID]=4^231;
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TranisitonPositionUpdateEntryID]=4^231;
	lowBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::NewPositionUpdateEntryID]=4^231;

	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentSimulationStateUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::AnimationStateUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TransitionStateUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentPositionUpdateEntryID]=4^231;
	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TranisitonPositionUpdateEntryID]=4^231;
	medBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::NewPositionUpdateEntryID]=4^231;

	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentSimulationStateUpdateEntryID]=6^231;
	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::AnimationStateUpdateEntryID]=6^231;
	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TransitionStateUpdateEntryID]=6^231;
	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::CurrentPositionUpdateEntryID]=4^231;
	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::TranisitonPositionUpdateEntryID]=4^231;
	highBitDepths[UpdateManager::MechAnimationUpdateID][MechAnimationUpdate::NewPositionUpdateEntryID]=4^231;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


	
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// WeaponCommandID
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(WeaponCommand::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetXEntryID]=9^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetYEntryID]=9^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetZEntryID]=7^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainXEntryID]=20^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainZEntryID]=20^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetXEntryID]=20^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetYEntryID]=20^231;
	lowBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetZEntryID]=10^231;

	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetXEntryID]=9^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetYEntryID]=9^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetZEntryID]=7^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainXEntryID]=20^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainZEntryID]=20^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetXEntryID]=20^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetYEntryID]=20^231;
	medBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetZEntryID]=10^231;

	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetXEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetYEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TargetOffsetZEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainXEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::TerrainZEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetXEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetYEntryID]=31^231;
	highBitDepths[UpdateManager::WeaponCommandID][WeaponCommand::NoTargetZEntryID]=31^231;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// MechInternalDamageUpdateID
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(MechInternalDamageUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::MechInternalDamageUpdateID][MechInternalDamageUpdate::InternalDamageEntryID]=5^231;

	medBitDepths[UpdateManager::MechInternalDamageUpdateID][MechInternalDamageUpdate::InternalDamageEntryID]=6^231;

	highBitDepths[UpdateManager::MechInternalDamageUpdateID][MechInternalDamageUpdate::InternalDamageEntryID]=8^231;


	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// MechInternalHeatUpdateID
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(MechInternalHeatUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::HeatEntryID]=4^231;
	lowBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::CoolantEntryID]=4^231;

	medBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::HeatEntryID]=4^231;
	medBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::CoolantEntryID]=4^231;

	highBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::HeatEntryID]=4^231;
	highBitDepths[UpdateManager::MechInternalHeatUpdateID][MechInternalHeatUpdate::CoolantEntryID]=4^231;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  InternalAMSAmmoUpdateID 
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(InternalAMSAmmoUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::InternalAMSAmmoUpdateID][InternalAMSAmmoUpdate::AmmoEntryID]=4^231;

	medBitDepths[UpdateManager::InternalAMSAmmoUpdateID][InternalAMSAmmoUpdate::AmmoEntryID]=4^231;

	highBitDepths[UpdateManager::InternalAMSAmmoUpdateID][InternalAMSAmmoUpdate::AmmoEntryID]=4^231;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  AirMovementUpdateID 
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(AirMovementUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::XPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::ZPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawPositionUpdateEntryID]=16^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchPositionUpdateEntryID]=16^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollPositionUpdateEntryID]=16^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::CurrentSpeedUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::SpeedDemandUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawDemandUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchDemandUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollDemandUpdateEntryID]=6^231;


	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::XPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::ZPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawPositionUpdateEntryID]=16^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchPositionUpdateEntryID]=16^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollPositionUpdateEntryID]=16^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::CurrentSpeedUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::SpeedDemandUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawDemandUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchDemandUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollDemandUpdateEntryID]=6^231;

	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::XPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::ZPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::CurrentSpeedUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::SpeedDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::YawDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::PitchDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::AirMovementUpdateID][AirMovementUpdate::RollDemandUpdateEntryID]=31^231;


	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  GroundMovementUpdateID 
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(GroundMovementUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::XPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::ZPositionUpdateEntryID]=24^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawPositionUpdateEntryID]=16^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::CurrentSpeedUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::SpeedDemandUpdateEntryID]=6^231;
	lowBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawDemandUpdateEntryID]=6^231;

	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::XPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::ZPositionUpdateEntryID]=24^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawPositionUpdateEntryID]=16^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::CurrentSpeedUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::SpeedDemandUpdateEntryID]=6^231;
	medBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawDemandUpdateEntryID]=6^231;


	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::XPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::ZPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::CurrentSpeedUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::SpeedDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::GroundMovementUpdateID][GroundMovementUpdate::YawDemandUpdateEntryID]=31^231;



	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  TorsoMovementUpdateID 
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Verify(TorsoMovementUpdate::GetUpdateEntryCount()>0);
	lowBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoPositionUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoPositionUpdateEntryID]=9^231;
	lowBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoDemandUpdateEntryID]=8^231;
	lowBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoDemandUpdateEntryID]=8^231;

	medBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoPositionUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoPositionUpdateEntryID]=9^231;
	medBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoDemandUpdateEntryID]=8^231;
	medBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoDemandUpdateEntryID]=8^231;

	highBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoPositionUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::PitchTorsoDemandUpdateEntryID]=31^231;
	highBitDepths[UpdateManager::TorsoMovementUpdateID][TorsoMovementUpdate::YawTorsoDemandUpdateEntryID]=31^231;


	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  FlagUpdateID 
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	lowBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::XPositionUpdateEntryID]=20^231;
	lowBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::ZPositionUpdateEntryID]=20^231;
	
	medBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::XPositionUpdateEntryID]=20^231;
	medBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::ZPositionUpdateEntryID]=20^231;

	highBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::XPositionUpdateEntryID]=20^231;
	highBitDepths[UpdateManager::FlagUpdateID][FlagUpdate::ZPositionUpdateEntryID]=20^231;



	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//~~~~~~~~~~~~~      Update Rates                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	

	bitDepths[LowBandwidth] = lowBitDepths;
	bitDepths[MediumBandwidth] = medBitDepths;
	bitDepths[HighBandwidth] = highBitDepths;

	// make sure everything is inited

	// set the update rates...

	int current_update = UpdateManager::MechPositionUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechAnimationUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechMovemntUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechExternalDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechFirstPersonPositionUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechFirstPersonControlUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::WeaponCommandID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MissionObjectiveUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechInternalDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::MechInternalHeatUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::SubsystemUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::FlushUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::SearchLightUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::InternalAMSAmmoUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::ExternalAMSAmmoUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::NearBuildingExternalDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::SecondaryBuildingExternalDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::FarBuildingExternalDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::ExternalJumpJetUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::InternalJumpJetUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::VehicleDamageUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::AirMovementUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::GroundMovementUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::TurretMovementUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::TorsoMovementUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::ThreeHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::SixHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::NavPointUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::EightHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::FlagUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::TwoHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::FourHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::TimeUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::SecurityQueryID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::SecurityResponseID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::OneHzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	current_update = UpdateManager::PingUpdateID;
	updateRates[LowBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_ActiveRate =		DictionaryPage::HalfhzBit;
	updateRates[LowBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;
	updateRates[MediumBandwidth][current_update].m_InactiveRate =	DictionaryPage::HalfhzBit;
	updateRates[HighBandwidth][current_update].m_InactiveRate =		DictionaryPage::HalfhzBit;

	// quickly unscramble it and re-scramble it with a rotating scramble
	// and do the verify
#ifdef _ARMOR
	for (i = 0; i < UpdateManager::GetUpdateCount(); ++i)
	{
		Verify(updateRates[LowBandwidth][i].m_ActiveRate != -1);
		Verify(updateRates[LowBandwidth][i].m_InactiveRate != -1);
		Verify(updateRates[MediumBandwidth][i].m_ActiveRate != -1);
		Verify(updateRates[MediumBandwidth][i].m_InactiveRate != -1);
		Verify(updateRates[HighBandwidth][i].m_ActiveRate != -1);
		Verify(updateRates[HighBandwidth][i].m_InactiveRate != -1);

		if (UpdateManager::GetUpdateEntryCount(i) > 0)
		{		
			for (int j = 0; j < UpdateManager::GetUpdateEntryCount(i); ++j)
			{
				
				


				int current_bit_depth = bitDepths[LowBandwidth][i][j]^231;

				Verify(current_bit_depth > 0);
				Verify(current_bit_depth < 32);

				current_bit_depth = bitDepths[MediumBandwidth][i][j]^231;

				Verify(current_bit_depth > 0);
				Verify(current_bit_depth < 32);

				current_bit_depth = bitDepths[HighBandwidth][i][j]^231;

				Verify(current_bit_depth > 0);
				Verify(current_bit_depth < 32);
			}
		}
	}
#endif


	for (i = 0; i < UpdateManager::GetUpdateCount(); ++i)
	{
		
		if (UpdateManager::GetUpdateEntryCount(i) > 0)
		{		
			for (int j = 0; j < UpdateManager::GetUpdateEntryCount(i); ++j)
			{
				
				


				int current_bit_depth = bitDepths[LowBandwidth][i][j]^231;
				bitDepths[LowBandwidth][i][j] = current_bit_depth ^ randomKey;
			

				current_bit_depth = bitDepths[MediumBandwidth][i][j]^231;
				bitDepths[MediumBandwidth][i][j] = current_bit_depth ^ randomKey;
			

				current_bit_depth = bitDepths[HighBandwidth][i][j]^231;
				bitDepths[HighBandwidth][i][j] = current_bit_depth ^ randomKey;

			
			}
		}
	}

}


void BitDepthManager::TerminateBitDepths(void)
{

	for (int i = 0; i < UpdateManager::GetUpdateCount(); ++i)
	{
		if (UpdateManager::GetUpdateEntryCount(i) > 0)
		{
			Unregister_Pointer(lowBitDepths[i]);
			delete[] lowBitDepths[i];
			Unregister_Pointer(medBitDepths[i]);
			delete[] medBitDepths[i];
			Unregister_Pointer(highBitDepths[i]);
			delete[] highBitDepths[i];
		}
	}
	Unregister_Pointer(lowBitDepths);
	delete[] lowBitDepths;

	Unregister_Pointer(medBitDepths);
	delete[] medBitDepths;
	
	Unregister_Pointer(highBitDepths);
	delete[] highBitDepths;


	delete [] updateRates[LowBandwidth];
	delete [] updateRates[MediumBandwidth];
	delete [] updateRates[HighBandwidth];
	

}


int BitDepthManager::BitDepth( int row, int column, int bit_range)
{

	MWEntityManager *manager = Cast_Object(MWEntityManager*, EntityManager::GetInstance());

	// put in da de-scramble here.

	Verify(bit_range >= 0);
	Verify(bit_range < BandwidthTypeCount);

	return manager->bitManager->bitDepths[bit_range][row][column]^manager->bitManager->randomKey;
	
}

UpdateRate BitDepthManager::GetUpdateRate(int update_type, int bandwidth)
{

	MWEntityManager *manager = Cast_Object(MWEntityManager*, EntityManager::GetInstance());

	return manager->bitManager->updateRates[bandwidth][update_type];
	
}
