diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-05-26 20:04:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-26 20:04:02 -0400 |
| commit | 4410b554e835ab7844c8eb78fd54fa3842d50f16 (patch) | |
| tree | 065b8f53d6e1052c9f7ad1917c1b3b66d5eef645 /ZAPD/ZLimb.cpp | |
| parent | 769f5702a422d14bfb0a60a39319da4b4bf9ec1f (diff) | |
Check XML resource attributes (#126)
* register attibutes
* fix array problems
* cutscene problems
* Set inner
* fix merge
* ups
* Run format
* small cleaning
* A small blob cleanup
* Simplify the logic a bit
* ups
* Fix merge problem
* Fix merge issues
* Fix merge issues
* fix merge-produced type
* Fix merge issues
* run format and update easteregg
* register ZPath attributes
* dumb problems
* How dumb can I be?
* future proof change
* empty commit
* Check if Width and Height attributes of ZTexture has only decimal digits
Diffstat (limited to 'ZAPD/ZLimb.cpp')
| -rw-r--r-- | ZAPD/ZLimb.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/ZAPD/ZLimb.cpp b/ZAPD/ZLimb.cpp index aa29e4e..ce891b2 100644 --- a/ZAPD/ZLimb.cpp +++ b/ZAPD/ZLimb.cpp @@ -356,11 +356,13 @@ ZLimb::ZLimb(ZFile* nParent) : ZResource(nParent) { dListPtr = 0; dList2Ptr = 0; + RegisterOptionalAttribute("LimbType"); + RegisterOptionalAttribute("Type"); } ZLimb::ZLimb(ZLimbType limbType, const std::string& prefix, const std::vector<uint8_t>& nRawData, uint32_t nRawDataIndex, ZFile* nParent) - : ZResource(nParent) + : ZLimb(nParent) { rawData.assign(nRawData.begin(), nRawData.end()); rawDataIndex = nRawDataIndex; @@ -378,44 +380,44 @@ void ZLimb::ParseXML(tinyxml2::XMLElement* reader) ZResource::ParseXML(reader); // Reading from a <Skeleton/> - const char* limbType = reader->Attribute("LimbType"); - if (limbType == nullptr) // Reading from a <Limb/> - limbType = reader->Attribute("Type"); + std::string limbType = registeredAttributes.at("LimbType").value; + if (limbType == "") // Reading from a <Limb/> + limbType = registeredAttributes.at("Type").value; - if (limbType == nullptr) + if (limbType == "") { fprintf(stderr, - "ZLimb::ParseXML: Warning in '%s'.\n\t Missing 'LimbType' attribute in xml. " - "Defaulting to 'Standard'.\n", + "ZLimb::ParseXML: Warning in '%s'.\n" + "\t Missing 'LimbType' attribute in xml.\n" + "\t Defaulting to 'Standard'.\n", name.c_str()); type = ZLimbType::Standard; } else { - std::string limbTypeStr(limbType); - - if (limbTypeStr == "Standard") + if (limbType == "Standard") { type = ZLimbType::Standard; } - else if (limbTypeStr == "LOD") + else if (limbType == "LOD") { type = ZLimbType::LOD; } - else if (limbTypeStr == "Skin") + else if (limbType == "Skin") { type = ZLimbType::Skin; } - else if (limbTypeStr == "Curve") + else if (limbType == "Curve") { type = ZLimbType::Curve; } else { fprintf(stderr, - "ZLimb::ParseXML: Warning in '%s'.\n\t Invalid LimbType found: '%s'. " - "Defaulting to 'Standard'.\n", - name.c_str(), limbType); + "ZLimb::ParseXML: Warning in '%s'.\n" + "\t Invalid LimbType found: '%s'.\n" + "\t Defaulting to 'Standard'.\n", + name.c_str(), limbType.c_str()); type = ZLimbType::Standard; } } |
