2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 01:07:43 +00:00

Add Global Project

Fix Particle Crashes
This commit is contained in:
2016-04-02 01:42:00 -07:00
parent 32b4815ab5
commit dc978a4c79
7 changed files with 28 additions and 5 deletions

View File

@@ -83,24 +83,34 @@ class UniqueIDBridge
{
friend class UniqueID32;
friend class UniqueID64;
static hecl::Database::Project* s_Project;
public:
template <class IDType>
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id)
{
if (!g_PakRouter)
LogDNACommon.report(logvisor::Fatal,
"UniqueIDBridge::setPakRouter must be called before translatePakIdToPath");
"g_Project must be set to non-null before calling UniqueIDBridge::TranslatePakIdToPath");
return g_PakRouter->getWorking(id);
}
static hecl::ProjectPath MakePathFromString(const std::string& str)
{
return hecl::ProjectPath(g_PakRouter->getProject(), str);
if (!s_Project)
LogDNACommon.report(logvisor::Fatal,
"UniqueIDBridge::setGlobalProject must be called before MakePathFromString");
return hecl::ProjectPath(*s_Project, str);
}
template <class IDType>
static void TransformOldHashToNewHash(IDType& id)
{
id = TranslatePakIdToPath(id);
}
static void setGlobalProject(hecl::Database::Project& project)
{
s_Project = &project;
}
};
/** PAK 32-bit Unique ID */