diff options
| author | louist103 <35883445+louist103@users.noreply.github.com> | 2021-05-08 12:27:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-08 12:27:38 -0400 |
| commit | a357277e412b5e8f0f2f0578c7d7d213e8744c8d (patch) | |
| tree | 353e7aa38aef392c6f337d6a1a04d3438f00def5 /ZAPD/ZRoom/Commands/SetPathways.cpp | |
| parent | 547c9b200d1dff745dee694c20a9f9e8e409a11d (diff) | |
Add const to most functions that need it and remove all "using namespace std" (#132)
* started on basic type errors
* Done. For now
* remove libgfxd binary
* const
* no more namespace std
* revert alloca
* re add a few missing consts
Diffstat (limited to 'ZAPD/ZRoom/Commands/SetPathways.cpp')
| -rw-r--r-- | ZAPD/ZRoom/Commands/SetPathways.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/ZAPD/ZRoom/Commands/SetPathways.cpp b/ZAPD/ZRoom/Commands/SetPathways.cpp index 6d82c6d..dbadba9 100644 --- a/ZAPD/ZRoom/Commands/SetPathways.cpp +++ b/ZAPD/ZRoom/Commands/SetPathways.cpp @@ -7,8 +7,6 @@ REGISTER_ZFILENODE(Path, ZSetPathways); -using namespace std; - ZSetPathways::ZSetPathways(ZFile* nParent) : ZResource(nParent) { } @@ -27,7 +25,7 @@ ZSetPathways::~ZSetPathways() delete pathwayList; } -void ZSetPathways::DeclareVar(const std::string& prefix, const std::string& bodyStr) +void ZSetPathways::DeclareVar(const std::string& prefix, const std::string& bodyStr) const { parent->AddDeclaration(cmdAddress, DeclarationAlignment::None, 8, StringHelper::Sprintf("static %s", GetCommandCName().c_str()), @@ -36,7 +34,7 @@ void ZSetPathways::DeclareVar(const std::string& prefix, const std::string& body StringHelper::Sprintf("%s // 0x%04X", bodyStr.c_str(), cmdAddress)); } -string ZSetPathways::GetSourceOutputCode(const std::string& prefix) +std::string ZSetPathways::GetSourceOutputCode(const std::string& prefix) { if (pathwayList != nullptr) pathwayList->GetSourceOutputCode(parent->GetName()); @@ -61,15 +59,15 @@ void ZSetPathways::ParseRawData() pathwayList = new PathwayList(parent, rawData, segmentOffset, numPaths); } -string ZSetPathways::GenerateSourceCodePass1(string roomName, uint32_t baseAddress) +std::string ZSetPathways::GenerateSourceCodePass1(std::string roomName, uint32_t baseAddress) { ParseRawData(); return ""; } -string ZSetPathways::GenerateSourceCodePass2(string roomName, uint32_t baseAddress) +std::string ZSetPathways::GenerateSourceCodePass2(std::string roomName, uint32_t baseAddress) { - string sourceOutput = ""; + std::string sourceOutput = ""; sourceOutput += StringHelper::Sprintf("\n\t%s 0, (u32)%sPathway0x%06X\n};", ZRoomCommand::GenerateSourceCodePass1("", 0).c_str(), @@ -81,7 +79,7 @@ string ZSetPathways::GenerateSourceCodePass2(string roomName, uint32_t baseAddre return sourceOutput; } -size_t ZSetPathways::GetRawDataSize() +size_t ZSetPathways::GetRawDataSize() const { size_t size = 0; if (pathwayList != nullptr) @@ -90,7 +88,7 @@ size_t ZSetPathways::GetRawDataSize() return ZRoomCommand::GetRawDataSize() + size; } -string ZSetPathways::GenerateExterns() +std::string ZSetPathways::GenerateExterns() const { if (pathwayList != nullptr) return pathwayList->GenerateExterns(parent->GetName()); @@ -98,12 +96,12 @@ string ZSetPathways::GenerateExterns() return ""; } -string ZSetPathways::GetCommandCName() +std::string ZSetPathways::GetCommandCName() const { return "SCmdPathList"; } -RoomCommand ZSetPathways::GetRoomCommand() +RoomCommand ZSetPathways::GetRoomCommand() const { return RoomCommand::SetPathways; } @@ -130,7 +128,7 @@ PathwayEntry::PathwayEntry(std::vector<uint8_t> rawData, uint32_t rawDataIndex) if (numPoints == 0) // Hack for SharpOcarina { - for (int32_t i = 0; i < 3; i++) + for (uint32_t i = 0; i < 3; i++) { Vec3s point = Vec3s(0, 0, 0); points.push_back(point); @@ -167,7 +165,7 @@ PathwayList::~PathwayList() void PathwayList::GetSourceOutputCode(const std::string& prefix) { { - string declaration = ""; + std::string declaration = ""; size_t index = 0; for (PathwayEntry* entry : pathways) { @@ -195,7 +193,7 @@ void PathwayList::GetSourceOutputCode(const std::string& prefix) for (PathwayEntry* entry : pathways) { - string declaration = ""; + std::string declaration = ""; size_t index = 0; for (Vec3s& point : entry->points) @@ -217,7 +215,7 @@ void PathwayList::GetSourceOutputCode(const std::string& prefix) } } -size_t PathwayList::GetRawDataSize() +size_t PathwayList::GetRawDataSize() const { size_t pointsSize = 0; @@ -229,9 +227,9 @@ size_t PathwayList::GetRawDataSize() return pathways.size() * 8 + pointsSize; } -string PathwayList::GenerateExterns(const std::string& prefix) +std::string PathwayList::GenerateExterns(const std::string& prefix) { - string declaration = ""; + std::string declaration = ""; for (PathwayEntry* entry : pathways) { declaration += StringHelper::Sprintf("extern Vec3s %sPathwayList0x%06X[];\n", |
