summaryrefslogtreecommitdiffstats
path: root/tools/DSGmaker/DynaDSGList.cpp
diff options
context:
space:
mode:
authorSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
committerSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
commiteb4b3404aa00220d659e532151dab13d642c17a3 (patch)
tree7e1107c4995489a26c4007e41b53ea8d00ab2134 /tools/DSGmaker/DynaDSGList.cpp
downloadThe-Simpsons-Hit-and-Run-TSH&R-PC.tar
The-Simpsons-Hit-and-Run-TSH&R-PC.tar.gz
The-Simpsons-Hit-and-Run-TSH&R-PC.tar.bz2
The-Simpsons-Hit-and-Run-TSH&R-PC.tar.lz
The-Simpsons-Hit-and-Run-TSH&R-PC.tar.xz
The-Simpsons-Hit-and-Run-TSH&R-PC.tar.zst
The-Simpsons-Hit-and-Run-TSH&R-PC.zip
Diffstat (limited to 'tools/DSGmaker/DynaDSGList.cpp')
-rw-r--r--tools/DSGmaker/DynaDSGList.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/DSGmaker/DynaDSGList.cpp b/tools/DSGmaker/DynaDSGList.cpp
new file mode 100644
index 0000000..d99f1b2
--- /dev/null
+++ b/tools/DSGmaker/DynaDSGList.cpp
@@ -0,0 +1,53 @@
+#include <cstring>
+#include <stdio.h>
+#include <..\..\..\tools\dsgmaker\DynaDSGList.hpp>
+#include <tlDynaPhysDSGChunk.hpp>
+
+
+const int MAX_DYNA_DSG = 50;
+
+DynaPhysDSGList::DynaPhysDSGList ()
+{
+ mindex =0;
+ mp_list = new tlDynaPhysDSGChunk* [MAX_DYNA_DSG];
+ mp_list[0]=NULL;
+}
+
+DynaPhysDSGList::~DynaPhysDSGList ()
+{
+ delete [] mp_list;
+}
+
+//input DynaDSG name and it should return a pointer to the dsg or null if failure
+tlDynaPhysDSGChunk* DynaPhysDSGList::GetDyna(const char * name)
+{
+
+ //search the array for the name.
+ for(unsigned int i=0;i<mindex;i++)
+ {
+ printf(" Searching for %s, against %s\n",name,mp_list[i]->GetName());
+ //if we find it return pointer otherwise it will return null by default
+ if (strcmp ( mp_list[i]->GetName(),name)==0)
+ {
+ return( mp_list[i] );
+ }
+ }
+ return NULL;
+
+}
+
+// add a dynaphyschunk to the list
+int DynaPhysDSGList::AddDyna (tlDynaPhysDSGChunk* p_dyna)
+{
+ if(mindex < MAX_DYNA_DSG -1)
+ {
+ mp_list[mindex++]=p_dyna;
+ return 0;
+ }
+ else
+ {
+ printf("ERROR: DynaDSGList if FULL! Unable to add entery! \n");
+ return 1;
+ }
+
+}