mirror of https://github.com/AxioDL/metaforce.git
DNAMP1/ScriptObjects: Convert SCRIPT_OBJECT_DB into a std::array
Now that all elements of the std::vector would otherwise be constexpr, we can use a std::array here instead, given they're all able to deterministically be available at compile-time. This gets rid of a runtime static heap allocation at program start.
This commit is contained in:
parent
2ec236fc45
commit
5ff100fdd1
|
@ -284,7 +284,7 @@ constexpr ScriptObjectSpec EnergyBallEnt = {0x8B, []() -> IScriptObject* { retur
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
|
||||||
const std::vector<const struct ScriptObjectSpec*> SCRIPT_OBJECT_DB = {
|
const ScriptObjectDBArray SCRIPT_OBJECT_DB = {
|
||||||
&priv::AIJumpPointEnt,
|
&priv::AIJumpPointEnt,
|
||||||
&priv::AIKeyframeEnt,
|
&priv::AIKeyframeEnt,
|
||||||
&priv::ActorEnt,
|
&priv::ActorEnt,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <vector>
|
#include <array>
|
||||||
|
|
||||||
#include <athena/Types.hpp>
|
#include <athena/Types.hpp>
|
||||||
|
|
||||||
|
@ -12,5 +12,7 @@ struct ScriptObjectSpec {
|
||||||
IScriptObject* (*a)();
|
IScriptObject* (*a)();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const std::vector<const struct ScriptObjectSpec*> SCRIPT_OBJECT_DB;
|
using ScriptObjectDBArray = std::array<const ScriptObjectSpec*, 127>;
|
||||||
|
|
||||||
|
extern const ScriptObjectDBArray SCRIPT_OBJECT_DB;
|
||||||
} // namespace DataSpec::DNAMP1
|
} // namespace DataSpec::DNAMP1
|
||||||
|
|
Loading…
Reference in New Issue