CScriptMazeNode: Make use of std::array where applicable

Same behavior, stronger typing.
This commit is contained in:
Lioncash 2020-04-12 15:23:26 -04:00
parent c84f430852
commit 175502cb0d
2 changed files with 8 additions and 6 deletions

View File

@ -8,7 +8,7 @@
namespace urde {
atUint32 CScriptMazeNode::sMazeSeeds[300] = {0};
std::array<u32, 300> CScriptMazeNode::sMazeSeeds{};
CScriptMazeNode::CScriptMazeNode(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, s32 w1, s32 w2, s32 w3,
@ -29,10 +29,11 @@ void CScriptMazeNode::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptMazeNode::LoadMazeSeeds() {
const SObjectTag* tag = g_ResFactory->GetResourceIdByName("DUMB_MazeSeeds");
u32 resSize = g_ResFactory->ResourceSize(*tag);
std::unique_ptr<u8[]> buf = g_ResFactory->LoadResourceSync(*tag);
const u32 resSize = g_ResFactory->ResourceSize(*tag);
const std::unique_ptr<u8[]> buf = g_ResFactory->LoadResourceSync(*tag);
CMemoryInStream in(buf.get(), resSize);
for (u32 i = 0; i < 300; ++i)
sMazeSeeds[i] = in.readUint32Big();
for (auto& seed : sMazeSeeds) {
seed = in.readUint32Big();
}
}
} // namespace urde

View File

@ -1,5 +1,6 @@
#pragma once
#include <array>
#include <string_view>
#include "Runtime/RetroTypes.hpp"
@ -9,7 +10,7 @@
namespace urde {
class CScriptMazeNode : public CActor {
static u32 sMazeSeeds[300];
static std::array<u32, 300> sMazeSeeds;
s32 xe8_;
s32 xec_;
s32 xf0_;