//===========================================================================//
// File:	NetDamage.hpp				
// Contents : All movement messages and rewind capabilites				
//---------------------------------------------------------------------------//
//   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               //
//===========================================================================//



#pragma once

#include "NetConstants.hpp"
#include "NetUpdateManager.hpp"
//#include "Mech.hpp"

namespace MechWarrior4 
{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
	class MechExternalDamageUpdate
	{
	public:

		enum {
			UpdateEntryCount = 0
		};

		enum {
			UpdateType = UpdateManager::MechExternalDamageUpdateID
		};


		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity);
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location);

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};

	};

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


	class MechInternalDamageUpdate
	{
	public:

		enum {
			InternalDamageEntryID = 0,
			UpdateEntryCount
		};

		enum {
			UpdateType = UpdateManager::MechInternalDamageUpdateID
		};


		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity);
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location);

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};

	};

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
	class VehicleDamageUpdate
	{
	public:

		enum {
			UpdateEntryCount = 0
		};

		enum {
			UpdateType = UpdateManager::VehicleDamageUpdateID
		};


		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity);
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location){return true;}

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};

	};

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


	class NearBuildingExternalDamageUpdate
	{
	public:

		enum {
			UpdateEntryCount = 0
		};

		enum {
			UpdateType = UpdateManager::NearBuildingExternalDamageUpdateID
		};


		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity){return -1;};
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location){return true;}

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};

		static void WriteTileBlock(int row, int column,DynamicMemoryStream *memory_stream, int connection);
		static void ReadTileBlock(int row, int column,MemoryStream *memory_stream, int connection, bool skip = false);

		static void WriteTileDamageStream(WORD index, DynamicMemoryStream *mem_stream, int connection);
		static void ReadTileDamageStream(WORD index, MemoryStream *mem_stream, int connection, bool skip = false);



	};

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



	class SecondaryBuildingExternalDamageUpdate
	{
	public:

		enum {
			UpdateEntryCount = 0
		};

		enum {
			UpdateType = UpdateManager::SecondaryBuildingExternalDamageUpdateID
		};


		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity){return -1;};
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location){return true;}

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};


	};

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

	class FarBuildingExternalDamageUpdate
	{
	public:

		enum {
			UpdateEntryCount = 0
		};

		enum {
			UpdateType = UpdateManager::FarBuildingExternalDamageUpdateID
		};

		static void Decode(Entity *entity, MemoryStream *memory_stream, Time till, Scalar packet_latency, int connection, int debug_level, int bandwidth, Scalar rate);
		static void Skip(MemoryStream *memory_stream, int size, Time till, int connection, int debug_level, int bandwidth);
		static void Encode(Entity *entity, DynamicMemoryStream *memory_stream, int connection, int debug_level, int bandwidth);
		static int SizeFunction(Entity *entity){return -1;};
		static int MaxSize(Entity *entity, int debug_level, int bandwidth);
		static bool MaintainActiveFlagFunction(Entity *entity,Point3D cull_location){return true;}

		static int GetUpdateEntryCount(){return UpdateEntryCount;};
		static int GetUpdateEntryType(){return UpdateType;};


	};

};