summaryrefslogtreecommitdiffstats
path: root/tools/ArtChecker/badlist.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/ArtChecker/badlist.cpp
downloadThe-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.gz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.bz2
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.lz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.xz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.zst
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.zip
Diffstat (limited to 'tools/ArtChecker/badlist.cpp')
-rw-r--r--tools/ArtChecker/badlist.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/tools/ArtChecker/badlist.cpp b/tools/ArtChecker/badlist.cpp
new file mode 100644
index 0000000..bcce4ca
--- /dev/null
+++ b/tools/ArtChecker/badlist.cpp
@@ -0,0 +1,90 @@
+#include "badlist.hpp"
+#include <cstring>
+#include<stdio.h>
+
+badlist::badlist ()
+{
+ max_items=200;
+ data_array=new entity_data[max_items];
+ index = 0;
+ totalmemoryusage =0;
+ for(unsigned int i=0;i<max_items;i++)
+ {
+ strcpy(data_array[i].name," ");
+ data_array[i].occurances=0;
+ data_array[i].size=0;
+ }
+}
+badlist::badlist (const unsigned int arraysize)
+{
+ max_items=arraysize;
+ data_array=new entity_data[max_items];
+ index = 0;
+ totalmemoryusage =0;
+ for(unsigned int i=0;i<max_items;i++)
+ {
+ strcpy(data_array[i].name," ");
+ data_array[i].occurances=0;
+ data_array[i].size=0;
+ }
+}
+
+
+
+
+badlist::~badlist ()
+{
+}
+
+int badlist::add(const char* name,const unsigned int occurances,const unsigned int size)
+{
+ if (index<max_items-1)
+ {
+ strcpy( data_array[index].name,name);
+ data_array[index].occurances=occurances;
+ data_array[index].size=size;
+ totalmemoryusage+=size;
+ index++;
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+int badlist::inlist(const char* name)
+{
+ unsigned int i=0;
+ do
+ {
+ if(strcmp(name,data_array[i].name) ==0)
+ {
+ //printf("%s found in list \n",name);
+ return 1;
+ }
+ i++;
+ } while (i<index);
+
+ return 0;
+}
+
+int badlist::getsize()
+{
+ return totalmemoryusage;
+}
+
+int badlist::getindexcount()
+{
+ return index;
+}
+
+
+int badlist::printverbose()
+{
+ for (unsigned int i=0;i<index;i++)
+ {
+ printf("%-30s: size in bytes: %6i \n",data_array[i].name,data_array[i].size);
+ }
+ return 0;
+} \ No newline at end of file