//===========================================================================//
// File:	rp4lbe4.hh                                                          //
// Project: MUNGA           Brick: Red Planet LBE Application					  //
// Contents: 																					  //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
//                                            										  //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc.                     //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#if !defined(RPL4PB_HPP)
#	define RPL4PB_HPP

#	if !defined(RPL4APP_HPP)
#		include <rpl4app.hpp>
#	endif

#	if !defined(L4SPLR_HPP)
#		include <l4splr.hpp>
#	endif

	//##########################################################################
	//#######################    RPSpoolerTask    ##############################
	//##########################################################################

	class RPSpoolerTask:
		public SpoolerTask
	{
	public:
		RPSpoolerTask();
		~RPSpoolerTask();

		void
			DispatchPacket(NetworkPacket *packet);
		long
			GetTimeBias();
	};

	//##########################################################################
	//####################    RPPlaybackApplication    ##########################
	//##########################################################################

	class RPL4PlaybackApplication:
		public RPL4Application
	{
	public:
		RPL4PlaybackApplication(
			ResourceFile *resource,
			SpoolFile *spool_file = NULL
		);
		~RPL4PlaybackApplication();

		Logical
      	TestInstance() const;

		void
			SetSpoolFile(SpoolFile *spool_file)
				{spoolFile = spool_file;}

		MissionReviewApplicationManager*
			GetApplicationManager()
				{
					return
						(MissionReviewApplicationManager*)
							Application::GetApplicationManager();
				}

		long
			GetTimeBias()
				{return timeBias;}

		void
			DispatchPacket(NetworkPacket *packet);

	protected:
		NetworkManager*
			MakeNetworkManager();

		long
			timeBias;

		void
			Initialize();
		void
			LoadBackgroundTasks();
		Logical
			ExecuteForeground(
				Time start_of_frame,
				Scalar frame_duration
			);
		void
			ExecuteBackgroundTask();

		static const HandlerEntry
			MessageHandlerEntries[];
		static MessageHandlerSet
			MessageHandlers;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Shared Data Support
	//
	public:
		static Derivation ClassDerivations;
		static SharedData DefaultData;

		void
			RunMissionMessageHandler(RunMissionMessage *message);
		void
			StopMissionMessageHandler(StopMissionMessage *message);
	};

#endif
