mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-09 12:08:12 +03:00
Added GetKey() / SetKey() in con_set's Entry, so ScriptVariable can override it and set the key appropriately
This commit is contained in:
parent
2ac2800ecb
commit
b10ce9a426
6 changed files with 105 additions and 62 deletions
|
@ -279,7 +279,6 @@ void con_set<key, value>::Archive(Archiver& arc)
|
|||
Entry *e;
|
||||
int hash;
|
||||
int i;
|
||||
int total;
|
||||
|
||||
arc.ArchiveUnsigned(&tableLength);
|
||||
arc.ArchiveUnsigned(&threshold);
|
||||
|
@ -296,12 +295,15 @@ void con_set<key, value>::Archive(Archiver& arc)
|
|||
e = new Entry;
|
||||
e->Archive(arc);
|
||||
|
||||
hash = HashCode<key>(e->key) % tableLength;
|
||||
hash = HashCode<key>(e->GetKey()) % tableLength;
|
||||
|
||||
e->next = table[hash];
|
||||
table[hash] = e;
|
||||
}
|
||||
} else {
|
||||
#ifndef NDEBUG
|
||||
int total;
|
||||
|
||||
total = 0;
|
||||
|
||||
for (i = 0; i < tableLength; i++) {
|
||||
|
@ -310,7 +312,15 @@ void con_set<key, value>::Archive(Archiver& arc)
|
|||
total++;
|
||||
}
|
||||
}
|
||||
// it must match the number of elements
|
||||
assert(total == count);
|
||||
#else
|
||||
for (i = 0; i < tableLength; i++) {
|
||||
for (e = table[i]; e != NULL; e = e->next) {
|
||||
e->Archive(arc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1199,7 +1199,7 @@ void ScriptMaster::PrintThread(int iThreadNum)
|
|||
int i = 0;
|
||||
|
||||
for (entry = en.NextElement(); entry != NULL; entry = en.NextElement()) {
|
||||
str& name = Director.GetString(entry->key);
|
||||
str& name = Director.GetString(entry->GetKey());
|
||||
|
||||
if (i > 0) {
|
||||
status += ", ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue