Codechange: Store objectspecs in std::vector instead of flat array.

This commit is contained in:
Peter Nelson
2022-11-06 19:21:03 +00:00
committed by PeterN
parent 93197f58b7
commit 1f46f080f0
7 changed files with 26 additions and 16 deletions

View File

@@ -19,7 +19,7 @@
/* static */ bool ScriptObjectType::IsValidObjectType(ObjectType object_type)
{
if (object_type >= NUM_OBJECTS) return false;
if (object_type >= ObjectSpec::Count()) return false;
return ObjectSpec::Get(object_type)->IsEverAvailable();
}

View File

@@ -15,7 +15,7 @@
ScriptObjectTypeList::ScriptObjectTypeList()
{
for (int i = 0; i < NUM_OBJECTS; i++) {
for (int i = 0; i < ObjectSpec::Count(); i++) {
const ObjectSpec *spec = ObjectSpec::Get(i);
if (!spec->IsEverAvailable()) continue;
this->AddItem(i);