//===========================================================================//
// File:	Truck.hpp											
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 09/09/98  JSE  Inital base class based off of Shadowrun/Adept
//---------------------------------------------------------------------------//
// Copyright (C) 1998, Fasa Interactive										 //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#pragma once

#include "MW4.hpp"
#include "Vehicle.hpp"

namespace MechWarrior4
{	
	//##########################################################################
	//############################    Truck    ###############################
	//##########################################################################

	//-------------------------------------------------------------------------
	// The following helper classes must always be typedef'd or overriden by an
	// inheritor
	//
	typedef Vehicle__GameModel				Truck__GameModel;
	typedef Vehicle__Message				Truck__Message;
	typedef Vehicle__UpdateMessage			Truck__UpdateMessage;
	typedef Vehicle__CreateMessage			Truck__CreateMessage;
	typedef Vehicle__ClassData				Truck__ClassData;
	typedef Vehicle__ExecutionStateEngine	Truck__ExecutionStateEngine;

	extern DWORD Executed_Truck_Count;

	//-----------------------  End of inheritance stuff ------------------------

	class Truck:
		public Vehicle
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		typedef Vehicle BaseClass;

	//##########################################################################
	// Inheritance support
	//
	public:
		typedef Truck__ClassData				ClassData;
		typedef Truck__GameModel				GameModel;
		typedef Truck__Message					Message;
		typedef Truck__ExecutionStateEngine		ExecutionStateEngine;
		typedef Truck__CreateMessage			CreateMessage;
	
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Run-time Construction and Destruction Support
	//
	public:
		static Truck*
			Make(
				CreateMessage *message,
				ReplicatorID *base_id
			);

		void
			SaveInstanceText(Stuff::Page *page);

	protected:
		Truck(
			ClassData *class_data,
			CreateMessage *message,
			ReplicatorID *base_id,
			ElementRenderer::Element *element
		);
		
		void
			Respawn(Adept::Entity::CreateMessage *message);
		void
			CommonCreation(CreateMessage *message);

		void
			Reuse(
				const CreateMessage *message,
				ReplicatorID *base_id
			);

		~Truck();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Class Data support
	//
	public:
		static ClassData
			*DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Game Model Support
	//
	public:
		const GameModel*
			GetGameModel()
				{
					Check_Object(this);
					return Cast_Pointer(const GameModel*,gameModelResource.GetPointer());
				}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Execution Support
	//
	public:
		void
			TurnOn();
		void
			PreCollisionExecute(Stuff::Time till);
		void PostCollisionExecute (Stuff::Time time);

		void ReactToDestruction(int damage_mode, int damage_type);

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Test Support
	//
	public:
		void
      		TestInstance() const;
	};

}
