2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 21:47:42 +00:00

Further CGameState imps

This commit is contained in:
Jack Andersen
2016-09-24 15:58:20 -10:00
parent b02b6a4d09
commit 7f987ab10e
23 changed files with 575 additions and 22 deletions

View File

@@ -0,0 +1,36 @@
#include "CMemoryCardSys.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
namespace urde
{
CSaveWorldMemory::CSaveWorldMemory(ResId mlvl, ResId savw)
: x0_mlvlId(mlvl), x8_savwId(savw)
{
if (savw == -1)
x2c_dummyWorld = std::make_unique<CDummyWorld>(mlvl, false);
else
x3c_saveWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), savw});
}
CMemoryCardSys::CMemoryCardSys()
{
xc_memoryWorlds.reserve(16);
x1c_.reserve(16);
g_ResFactory->EnumerateNamedResources([&](const std::string& name, const SObjectTag& tag) -> bool
{
if (tag.type == FOURCC('MLVL'))
{
auto existingSearch =
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const CSaveWorldMemory& wld)
{ return wld.GetWorldAssetId() == tag.id; });
if (existingSearch == xc_memoryWorlds.cend())
xc_memoryWorlds.emplace_back(tag.id, -1);
}
return true;
});
}
}