mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-02 03:30:19 -04:00
ZAPD fixes in sys_initial_check, update subrepos (#507)
* git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "a3363333d" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "a3363333d" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/asm-differ --force subrepo: subdir: "tools/asm-differ" merged: "70c33cc12" upstream: origin: "https://github.com/simonlindholm/asm-differ.git" branch: "main" commit: "70c33cc12" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull (merge) tools/z64compress --force subrepo: subdir: "tools/z64compress" merged: "ac5b1a0d0" upstream: origin: "https://github.com/z64me/z64compress.git" branch: "main" commit: "ac5b1a0d0" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Use defines for texture sizes in sys_initial_check * Update extract_assets.py * Add null check * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "50242eca9" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "50242eca9" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Utils/StringHelper.h"
|
||||
#include "WarningHandler.h"
|
||||
#include "ZFile.h"
|
||||
|
||||
REGISTER_ZFILENODE(Array, ZArray);
|
||||
@@ -25,13 +26,18 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader)
|
||||
ZResource::ParseXML(reader);
|
||||
|
||||
arrayCnt = reader->IntAttribute("Count", 0);
|
||||
// TODO: do a better check.
|
||||
assert(arrayCnt > 0);
|
||||
if (arrayCnt <= 0)
|
||||
{
|
||||
HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex,
|
||||
"invalid value found for 'Count' attribute", "");
|
||||
}
|
||||
|
||||
tinyxml2::XMLElement* child = reader->FirstChildElement();
|
||||
if (child == nullptr)
|
||||
throw std::runtime_error(
|
||||
StringHelper::Sprintf("Error! Array needs at least one sub-element.\n"));
|
||||
{
|
||||
HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex,
|
||||
"<Array> needs one sub-element", "");
|
||||
}
|
||||
|
||||
childName = child->Name();
|
||||
|
||||
@@ -42,9 +48,10 @@ void ZArray::ParseXML(tinyxml2::XMLElement* reader)
|
||||
ZResource* res = nodeMap->at(childName)(parent);
|
||||
if (!res->DoesSupportArray())
|
||||
{
|
||||
throw std::runtime_error(StringHelper::Sprintf(
|
||||
"Error! Resource %s does not support being wrapped in an array!\n",
|
||||
childName.c_str()));
|
||||
std::string errorHeader = StringHelper::Sprintf(
|
||||
"resource <%s> does not support being wrapped in an <Array>", childName.c_str());
|
||||
HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, errorHeader,
|
||||
"");
|
||||
}
|
||||
res->parent = parent;
|
||||
res->SetInnerNode(true);
|
||||
@@ -87,7 +94,7 @@ Declaration* ZArray::DeclareVar(const std::string& prefix, const std::string& bo
|
||||
|
||||
std::string ZArray::GetBodySourceCode() const
|
||||
{
|
||||
std::string output;
|
||||
std::string output = "";
|
||||
|
||||
for (size_t i = 0; i < arrayCnt; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user