changeset 61:1fe27776627e

Added asserts
author koryspansel
date Mon, 03 Oct 2011 15:05:09 -0700
parents b0f642ee22d3
children 6d4437a24aeb
files LightClone/LightClone.vcproj LightClone/Source/ActionPanel.cpp LightClone/Source/ArrayList.h LightClone/Source/Compiler.cpp LightClone/Source/Core.h LightClone/Source/Debug.h LightClone/Source/GraphicsDevice.cpp LightClone/Source/GuiElement.cpp LightClone/Source/GuiInterface.cpp LightClone/Source/GuiRenderContext.cpp LightClone/Source/ResourceManager.cpp LightClone/Source/Trace.cpp LightClone/Source/VirtualMachine.cpp LightClone/Source/World.cpp LightClone/ToDo.txt
diffstat 15 files changed, 73 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/LightClone/LightClone.vcproj	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/LightClone.vcproj	Mon Oct 03 15:05:09 2011 -0700
@@ -444,6 +444,10 @@
 					>
 				</File>
 				<File
+					RelativePath=".\Source\Debug.h"
+					>
+				</File>
+				<File
 					RelativePath=".\Source\FixedString.h"
 					>
 				</File>
@@ -678,7 +682,7 @@
 						<Tool
 							Name="VCCustomBuildTool"
 							Description="Building $(InputName)..."
-							CommandLine="$(SolutionDir)LightTools\Build.py $(InputName).def"
+							CommandLine="$(SolutionDir)LightTools\Build.py $(InputName).def&#x0D;&#x0A;"
 							Outputs="$(SolutionDir)Data\Maps\$(InputName).map"
 						/>
 					</FileConfiguration>
@@ -688,7 +692,7 @@
 						<Tool
 							Name="VCCustomBuildTool"
 							Description="Building $(InputName)..."
-							CommandLine="$(SolutionDir)LightTools\Build.py $(InputName).def"
+							CommandLine="$(SolutionDir)LightTools\Build.py $(InputName).def&#x0D;&#x0A;"
 							Outputs="$(SolutionDir)Data\Maps\$(InputName).map"
 						/>
 					</FileConfiguration>
--- a/LightClone/Source/ActionPanel.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/ActionPanel.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -102,14 +102,11 @@
 void ActionPanel::OnActionDropped(GuiEventArguments& kArguments)
 {
 	ActionSlot* pSlot = (ActionSlot*)kArguments.pSource;
-	//ASSERT(pSlot != NULL);
+	ASSERT(pSlot != NULL);
 
-	const uint32 nIndex = pSlot->GetSlot();
-	//if(nIndex < nActionSlots)
-	{
-		ActionArguments kActionArguments(this, nIndex);
-		Fire(ActionPanel::EventAction, kActionArguments);
-	}
+	ActionArguments kActionArguments(this, pSlot->GetSlot());
+	Fire(ActionPanel::EventAction, kActionArguments);
 
+	//TODO: Needed?
 	Fire(ActionPanel::EventDrop, kArguments);
 }
\ No newline at end of file
--- a/LightClone/Source/ArrayList.h	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/ArrayList.h	Mon Oct 03 15:05:09 2011 -0700
@@ -6,6 +6,7 @@
 #define __ARRAYLIST_H__
 
 #include "Types.h"
+#include "Debug.h"
 
 /*
  * ArrayList
@@ -137,18 +138,18 @@
 	/*
 	 * operator []
 	 */
-	Type& operator[](int nIndex)
+	Type& operator[](uint32 nIndex)
 	{
-		//ASSERT(nIndex < nSize);
+		ASSERT(nIndex < nSize);
 		return pList[nIndex];
 	}
 
 	/*
 	 * operator []
 	 */
-	const Type& operator[](int nIndex) const
+	const Type& operator[](uint32 nIndex) const
 	{
-		//ASSERT(nIndex < nSize);
+		ASSERT(nIndex < nSize);
 		return pList[nIndex];
 	}
 
--- a/LightClone/Source/Compiler.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/Compiler.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -81,7 +81,7 @@
 
 		if(nFunction > 0)
 		{
-			//ASSERT(nFunctionTable[nFunction] > 0);
+			ASSERT(nFunctionTable[nFunction] > 0);
 
 			// fixup address of function call
 			pData[nAddress] = nFunctionTable[nFunction];
--- a/LightClone/Source/Core.h	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/Core.h	Mon Oct 03 15:05:09 2011 -0700
@@ -7,6 +7,7 @@
 
 #include "Types.h"
 #include "Trace.h"
+#include "Debug.h"
 #include <d3d9.h>
 #include <d3dx9.h>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LightClone/Source/Debug.h	Mon Oct 03 15:05:09 2011 -0700
@@ -0,0 +1,26 @@
+/*
+ * Debug
+ */
+
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+#if defined(_DEBUG)
+
+#include <cassert>
+
+/*
+ * ASSERT
+ */
+#define ASSERT assert
+
+#else
+
+/*
+ * ASSERT
+ */
+#define ASSERT(...)
+
+#endif
+
+#endif //__DEBUG_H__
--- a/LightClone/Source/GraphicsDevice.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/GraphicsDevice.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -11,10 +11,10 @@
 GraphicsDevice::GraphicsDevice(IDirect3D9* pContext, IDirect3DDevice9* pInstance, const D3DPRESENT_PARAMETERS& kPresentParameters)
 	: pDirect3D(pContext), pDevice(pInstance), kParameters(kPresentParameters)
 {
-	//ASSERT(pDirect3D);
+	ASSERT(pDirect3D);
 	pDirect3D->AddRef();
 
-	//ASSERT(pDevice);
+	ASSERT(pDevice);
 	pDevice->AddRef();
 }
 
--- a/LightClone/Source/GuiElement.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/GuiElement.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -34,7 +34,7 @@
  */
 ErrorCode GuiElement::Initialize(ResourceManager* pManager)
 {
-	//ASSERT(pManager != NULL);
+	ASSERT(pManager != NULL);
 	pResourceManager = pManager;
 
 	return Error_Success;
--- a/LightClone/Source/GuiInterface.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/GuiInterface.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -31,7 +31,7 @@
 				if(eCode == Error_Success)
 				{
 					pInputManager = pInput;
-					//ASSERT(pInputManager);
+					ASSERT(pInputManager);
 
 					pInputManager->SetBounds(0.0f, 0.0f, (float)ScreenSizeX, (float)ScreenSizeY);
 					pInputManager->SetMouse(0.5f * ScreenSizeX, 0.5f * ScreenSizeY);
@@ -221,7 +221,7 @@
  */
 void GuiInterface::BeginDrag(GuiElement* pSource, uint32 nButton)
 {
-	//ASSERT(pDragElement == NULL);
+	ASSERT(pDragElement == NULL);
 
 	pDragElement	= pSource;
 	nDragButton		= nButton;
--- a/LightClone/Source/GuiRenderContext.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/GuiRenderContext.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -52,7 +52,7 @@
 		uint32 nPasses = 0;			
 
 		D3DXHANDLE kTechnique = pEffect->GetTechniqueByName("Color");
-		//ASSERT(kTechnique != NULL);
+		ASSERT(kTechnique != NULL);
 
 		pEffect->SetTechnique(kTechnique);
 
@@ -80,7 +80,7 @@
 			pVertexBuffer->Unlock();
 
 			D3DXHANDLE kTextureHandle = pEffect->GetParameterByName(NULL, "kTexture");
-			//ASSERT(kTextureHandle != NULL);
+			ASSERT(kTextureHandle != NULL);
 
 			pEffect->SetTexture(kTextureHandle, pTexture);
 			pEffect->CommitChanges();
@@ -114,7 +114,7 @@
 				pVertexBuffer->Unlock();
 
 				D3DXHANDLE kTextureHandle = pEffect->GetParameterByName(NULL, "kTexture");
-				//ASSERT(kTextureHandle != NULL);
+				ASSERT(kTextureHandle != NULL);
 
 				pEffect->SetTexture(kTextureHandle, pTexture);
 				pEffect->CommitChanges();
@@ -168,7 +168,7 @@
 			pVertexBuffer->Unlock();
 
 			D3DXHANDLE kTextureHandle = pEffect->GetParameterByName(NULL, "kTexture");
-			//ASSERT(kTextureHandle != NULL);
+			ASSERT(kTextureHandle != NULL);
 
 			pEffect->SetTexture(kTextureHandle, pTexture);
 			pEffect->CommitChanges();
--- a/LightClone/Source/ResourceManager.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/ResourceManager.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -124,7 +124,7 @@
 				if(pTextureObject)
 				{
 					pInstance = kTextureCache.Add(kPath);
-					//ASSERT(pInstance != NULL);
+					ASSERT(pInstance != NULL);
 
 					*pInstance = pTextureObject;
 				}
@@ -169,7 +169,7 @@
 				if(pEffectObject)
 				{
 					pInstance = kEffectCache.Add(ResourcePath(pName));
-					//ASSERT(pInstance != NULL);
+					ASSERT(pInstance != NULL);
 
 					*pInstance = pEffectObject;
 				}
@@ -214,7 +214,7 @@
 				if(pFontObject)
 				{
 					pInstance = kFontCache.Add(ResourcePath(pName));
-					//ASSERT(pInstace != NULL);
+					ASSERT(pInstance != NULL);
 
 					*pInstance = pFontObject;
 				}
--- a/LightClone/Source/Trace.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/Trace.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -71,7 +71,7 @@
 	FileTraceHandler(const char* pName) : pFile(NULL)
 	{
 		pFile = fopen(pName, "wt");
-		//ASSERT(pFile != NULL);
+		ASSERT(pFile != NULL);
 	}
 
 	/*
--- a/LightClone/Source/VirtualMachine.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/VirtualMachine.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -122,7 +122,7 @@
 			kFrameAllocator.Free(pValue);
 		}
 
-		//ASSERT(pFrame != NULL);
+		ASSERT(pFrame != NULL);
 	}
 	else
 	{
@@ -134,16 +134,6 @@
 		pFrame = pInstance;
 	}
 
-	uint32 nDepth = 0;
-	pInstance = pFrame;
-	while(pInstance)
-	{
-		++nDepth;
-		pInstance = pInstance->pLast;
-	}
-
-	TRACE("Stack Depth: %d\n", nDepth);
-
 	nInstructionPointer = nFunctionAddress;
 }
 
@@ -152,7 +142,7 @@
  */
 void VirtualMachine::PopFrame()
 {
-	//ASSERT(pFrame != NULL);
+	ASSERT(pFrame != NULL);
 	nInstructionPointer = pFrame->nContinuation;
 
 	Frame* pInstance = pFrame;
--- a/LightClone/Source/World.cpp	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/Source/World.cpp	Mon Oct 03 15:05:09 2011 -0700
@@ -24,8 +24,8 @@
  */
 ErrorCode World::Initialize(ResourceManager* pResourceManager, InputManager* pInput)
 {
-	//ASSERT(pResourceManager != NULL);
-	//ASSERT(pInput != NULL);
+	ASSERT(pResourceManager != NULL);
+	ASSERT(pInput != NULL);
 
 	ErrorCode eCode = kEnvironment.Initialize(pResourceManager);
 	if(eCode != Error_Success)
--- a/LightClone/ToDo.txt	Mon Oct 03 08:58:08 2011 -0700
+++ b/LightClone/ToDo.txt	Mon Oct 03 15:05:09 2011 -0700
@@ -1,10 +1,15 @@
-1.	Button tool tips
+Required:
+1.	Robot model & texture
 2.	Main menu
 3.	Pause menu
-4.	Robot model & texture (.x format)
-5.	Help interface
-6.	Add asserts
-7.	Move resource manager into a service provider container
-8.	Fix gui element destruction
-9.	Add sound and music
-10.	Additional maps
\ No newline at end of file
+4.	Additional maps
+5.	Add camera position to map
+
+Polish:
+1.	Button tool tips
+2.	Move resource manager into a service provider container
+3.	Add sound and music
+4.	Help interface
+
+Bugs:
+1.	Fix gui element destruction