From 85e45f67d3582cde990bc29664ff1581d9690f37 Mon Sep 17 00:00:00 2001 From: disinvite Date: Sat, 8 Jul 2023 23:35:54 -0400 Subject: [PATCH] GetVariable to 100 --- LEGO1/mxvariabletable.cpp | 2 +- LEGO1/mxvariabletable.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LEGO1/mxvariabletable.cpp b/LEGO1/mxvariabletable.cpp index 7dfe59b3..fe11b538 100644 --- a/LEGO1/mxvariabletable.cpp +++ b/LEGO1/mxvariabletable.cpp @@ -40,7 +40,7 @@ void MxVariableTable::SetVariable(MxVariable *var) // OFFSET: LEGO1 0x100b78f0 const char *MxVariableTable::GetVariable(const char *p_key) { - const char *value = NULL; + const char *value = ""; MxHashTableCursor cursor(this); MxVariable *var = new MxVariable(p_key); diff --git a/LEGO1/mxvariabletable.h b/LEGO1/mxvariabletable.h index 5d05c7d5..c635099b 100644 --- a/LEGO1/mxvariabletable.h +++ b/LEGO1/mxvariabletable.h @@ -32,7 +32,7 @@ class MxHashTable : public MxCore MxHashTable() { m_size = 128; - m_table = new MxHashTableNode[128]; + m_table = new MxHashTableNode*[128]; } ~MxHashTable() @@ -46,7 +46,7 @@ class MxHashTable : public MxCore //private: int m_used; // +0x8 void (*m_unkc)(void *); // +0xc - MxHashTableNode *m_table; // +0x10 + MxHashTableNode **m_table; // +0x10 int m_size; // +0x14 int m_unk18; int m_unk1c; @@ -67,12 +67,12 @@ class MxHashTableCursor : public MxCore MxBool Find(T *p_obj) { MxU32 hash = m_hashTable->Hash(p_obj); - int bucket = hash / m_hashTable->m_size; + int bucket = hash % m_hashTable->m_size; - MxHashTableNode *t = &m_hashTable->m_table[bucket]; + MxHashTableNode *t = m_hashTable->m_table[bucket]; while (t) { - if (t->m_hash == hash && !m_hashTable->Compare(p_obj, t->m_obj)) + if (t->m_hash == hash && !m_hashTable->Compare(t->m_obj, p_obj)) m_match = t; t = t->m_next; }