#include "Script.hpp"
//==========================================================================//
// File:	 SurfaceManager.cpp												//
// Project:  GameOS					                                        //
// Contents: Surface Manager routines										//
//--------------------------------------------------------------------------//
// Date      Who    Modification                                            //
// 11/15/97  SP     Created	(was 2DRasterizer)								//
// 12/04/97  JTR    Changed init function.									//
// 12/31/97  JTR    Complete overhaul. Changed from C++ to C. 				//
//					Added Documentation. Added error-checking.				//
// 01/13/98  JTR    Fixed Memory Leak in release of surfaces. 				//
//--------------------------------------------------------------------------//
// Copyright (C) 2000, Microsoft, Inc.										//
// All Rights reserved worldwide                                            //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL              //
//==========================================================================//

extern DWORD g_DDstate;
extern bool g_DDneedsRestore;

void SurfaceManagerInstall()
{
}

void SurfaceManagerUninstall()
{
//
// Debugging information
//
	SPEW(( GROUP_SURFACE, "SurfaceManagerUninstall()" ));

	HGOSSURFACE surf;
	LinkedListIterator<HGOSSURFACE> itr = LinkedListIterator<HGOSSURFACE> (&AllSurfaces);
	surf=itr.Head();
	while((surf=itr.ReadAndNext()) != NULL)
	{
		SPEW(( GROUP_SURFACE, "Deleting Surface %08X, \"%s\"",surf,surf->m_lpPath ));
		delete surf;
	}
//
// Debugging information
//
	SPEW(( GROUP_SURFACE, "SurfaceManagerUninstall() Finished" ));
}

bool IsValidSurface(HGOSSURFACE surf)
{
	// is it a valid gos surface?
	HGOSSURFACE surfchk;
	LinkedListIterator<HGOSSURFACE> itr = LinkedListIterator<HGOSSURFACE> (&AllSurfaces);
	surfchk=itr.Head();
	while((surfchk=itr.ReadAndNext()) != NULL)
	{
		if (surfchk == surf)
		{
			return true;
		}
	}
	return false;
}
