This commit is contained in:
parent
2ba61e595c
commit
73c60fbd11
23 changed files with 471 additions and 84 deletions
94
Utils/Libs/DaveLib/DaveLib.dsp
Normal file
94
Utils/Libs/DaveLib/DaveLib.dsp
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Microsoft Developer Studio Project File - Name="DaveLib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=DaveLib - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DaveLib.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "DaveLib.mak" CFG="DaveLib - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DaveLib - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "DaveLib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "DaveLib - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "DaveLib - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "DaveLib - Win32 Release"
|
||||
# Name "DaveLib - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\List.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\list2d.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,9 +1,11 @@
|
|||
/**********************/
|
||||
/*** Vtx List Class ***/
|
||||
/**********************/
|
||||
/******************/
|
||||
/*** List Class ***/
|
||||
/******************/
|
||||
|
||||
#if !defined __VTXLIST_CLASS_HEADER__
|
||||
#define __VTXLIST_CLASS_HEADER__
|
||||
#pragma warning( disable : 4786 )
|
||||
|
||||
#if !defined __LIST_CLASS_HEADER__
|
||||
#define __LIST_CLASS_HEADER__
|
||||
|
||||
#include <Vector>
|
||||
|
||||
|
@ -41,10 +43,9 @@ public:
|
|||
return(ListSize);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
List.clear();
|
||||
}
|
||||
void clear() {List.clear();}
|
||||
void resize(int i) {List.resize(i);}
|
||||
|
||||
|
||||
int size() {return(List.size());}
|
||||
|
||||
|
|
10
Utils/Libs/DaveLib/list2d.cpp
Normal file
10
Utils/Libs/DaveLib/list2d.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
/******************/
|
||||
/*** List Class ***/
|
||||
/******************/
|
||||
|
||||
|
||||
#include <Vector>
|
||||
#include "List2d.h"
|
||||
|
||||
|
||||
|
143
Utils/Libs/DaveLib/list2d.h
Normal file
143
Utils/Libs/DaveLib/list2d.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*********************/
|
||||
/*** List 2d Class ***/
|
||||
/*********************/
|
||||
|
||||
|
||||
#pragma warning( disable : 4786 )
|
||||
|
||||
#ifndef __LIST_2D_HEADER__
|
||||
#define __LIST_2D_HEADER__
|
||||
|
||||
#include <Vector>
|
||||
|
||||
/*****************************************************************************/
|
||||
template <class T> class CList2d
|
||||
{
|
||||
public:
|
||||
inline int GetWidth()
|
||||
{
|
||||
return(List.size());
|
||||
}
|
||||
|
||||
inline int GetHeight()
|
||||
{
|
||||
if (GetWidth())
|
||||
{
|
||||
return(List[0].size());
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
inline void SetSize(int Width,int Height)
|
||||
{
|
||||
List.resize(Width);
|
||||
for (int i=0;i<Width;i++)
|
||||
{
|
||||
List[i].resize(Height);
|
||||
}
|
||||
}
|
||||
|
||||
inline void Resize(int Width,int Height)
|
||||
{
|
||||
CList2d<T> Old=*this;
|
||||
|
||||
int OldWidth=Old.GetWidth();
|
||||
int OldHeight=Old.GetHeight();
|
||||
int MinW=min(Width,OldWidth);
|
||||
int MinH=min(Height,OldHeight);
|
||||
|
||||
Delete();
|
||||
SetSize(Width,Height,TRUE);
|
||||
for (int Y=0; Y<MinH; Y++)
|
||||
{
|
||||
for (int X=0; X<MinW; X++)
|
||||
{
|
||||
Set(X,Y,Old.Get(X,Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void Delete()
|
||||
{
|
||||
int Width=GetWidth();
|
||||
|
||||
for (int i=0;i<Width;i++)
|
||||
{
|
||||
List[i].clear();
|
||||
}
|
||||
List.clear();
|
||||
}
|
||||
|
||||
inline T &Get(int X,int Y)
|
||||
{
|
||||
return(List[X][Y]);
|
||||
}
|
||||
|
||||
inline void Set(int X,int Y,T &Src)
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
// Make sure within List
|
||||
if ((X>=0 && X<Width) && (Y>=0 && Y<Height))
|
||||
{
|
||||
List[X][Y]=Src;
|
||||
}
|
||||
}
|
||||
|
||||
inline void Set(int X,int Y,CList2d &Src)
|
||||
{
|
||||
int Width=Src.GetWidth();
|
||||
int Height=Src.GetHeight();
|
||||
|
||||
for (int Y=0; Y<Height; Y++)
|
||||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
Set(StartX+X,StartY+Y,Src.Get(X,Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool DoesContainElem(T &Tile)
|
||||
{
|
||||
int Width=GetWidth();
|
||||
int Height=GetHeight();
|
||||
|
||||
for (int Y=0; Y<Height; Y++)
|
||||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
T &ThisElem=Get(X,Y);
|
||||
if (ThisElem==Elem) return(TRUE);
|
||||
}
|
||||
}
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
inline void operator=(T &Src)
|
||||
{
|
||||
int Width=Src.GetWidth();
|
||||
int Height=Src.GetHeight();
|
||||
|
||||
Delete();
|
||||
SetSize(Width,Height);
|
||||
|
||||
for (int Y=0; Y<Height; Y++)
|
||||
{
|
||||
for (int X=0; X<Width; X++)
|
||||
{
|
||||
Set(X,Y,Src.Get(StartX+X,StartY+Y),Force);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector< std::vector<T> > List;
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue