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

(cherry picked from commit 1ae263c5467105820e4d770b3d57d25ba01e22b1)
This commit is contained in:
Peter Nelson
2022-11-06 19:21:03 +00:00
committed by Jonathan G Rennison
parent d34e1bbbc1
commit 74e4556a85
8 changed files with 27 additions and 17 deletions

View File

@@ -18,7 +18,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);