# HG changeset patch
# User koryspansel
# Date 1317679509 25200
# Node ID 1fe27776627ebe9e903af75cb4bf0ea9c3ebe68a
# Parent b0f642ee22d3a832767bbf5ed83127c4937d5442
Added asserts
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/LightClone.vcproj
--- 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 @@
>
+
+
@@ -678,7 +682,7 @@
@@ -688,7 +692,7 @@
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/ActionPanel.cpp
--- 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
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/ArrayList.h
--- 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];
}
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/Compiler.cpp
--- 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];
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/Core.h
--- 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
#include
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/Debug.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
+
+/*
+ * ASSERT
+ */
+#define ASSERT assert
+
+#else
+
+/*
+ * ASSERT
+ */
+#define ASSERT(...)
+
+#endif
+
+#endif //__DEBUG_H__
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/GraphicsDevice.cpp
--- 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();
}
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/GuiElement.cpp
--- 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;
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/GuiInterface.cpp
--- 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;
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/GuiRenderContext.cpp
--- 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();
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/ResourceManager.cpp
--- 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;
}
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/Trace.cpp
--- 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);
}
/*
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/VirtualMachine.cpp
--- 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;
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/Source/World.cpp
--- 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)
diff -r b0f642ee22d3 -r 1fe27776627e LightClone/ToDo.txt
--- 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