Skip to content

Commit 19efc4a

Browse files
committed
Add more contexts to errors
1 parent 9c5d728 commit 19efc4a

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎src/Mod/Mod.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ int Mod::getModOffset() const
672672
* @param shared Max offset limit that is shared for every mod
673673
* @param multipler Value used by `projectle` surface set to convert projectle offset to index offset in surface.
674674
*/
675-
void Mod::loadOffsetNode(const std::string &parent, int& offset, const YAML::Node &node, int shared, size_t multipler) const
675+
void Mod::loadOffsetNode(const std::string &parent, int& offset, const YAML::Node &node, int shared, const std::string &set, size_t multipler) const
676676
{
677677
assert(_modCurrent);
678678
const ModData* curr = _modCurrent;
@@ -721,7 +721,7 @@ void Mod::loadOffsetNode(const std::string &parent, int& offset, const YAML::Nod
721721
if (offset < -1)
722722
{
723723
std::ostringstream err;
724-
err << "Error for '" << parent << "': offset '" << offset << "' have incorrect value";
724+
err << "Error for '" << parent << "': offset '" << offset << "' have incorrect value in set '" << set << "'";
725725
throw Exception(err.str());
726726
}
727727
else if (offset == -1)
@@ -735,7 +735,7 @@ void Mod::loadOffsetNode(const std::string &parent, int& offset, const YAML::Nod
735735
if ((size_t)f > curr->size)
736736
{
737737
std::ostringstream err;
738-
err << "Error for '" << parent << "': offset '" << offset << "' exceeds mod size limit " << (curr->size / multipler);
738+
err << "Error for '" << parent << "': offset '" << offset << "' exceeds mod size limit " << (curr->size / multipler) << " in set '" << set << "'";
739739
throw Exception(err.str());
740740
}
741741
if (f >= shared)
@@ -757,7 +757,7 @@ void Mod::loadSpriteOffset(const std::string &parent, int& sprite, const YAML::N
757757
{
758758
if (node)
759759
{
760-
loadOffsetNode(parent, sprite, node, getRule(set, "Sprite Set", _sets, true)->getMaxSharedFrames(), multipler);
760+
loadOffsetNode(parent, sprite, node, getRule(set, "Sprite Set", _sets, true)->getMaxSharedFrames(), set, multipler);
761761
}
762762
}
763763

@@ -773,7 +773,7 @@ void Mod::loadSoundOffset(const std::string &parent, int& sound, const YAML::Nod
773773
{
774774
if (node)
775775
{
776-
loadOffsetNode(parent, sound, node, getSoundSet(set)->getMaxSharedSounds(), 1);
776+
loadOffsetNode(parent, sound, node, getSoundSet(set)->getMaxSharedSounds(), set, 1);
777777
}
778778
}
779779

@@ -795,13 +795,13 @@ void Mod::loadSoundOffset(const std::string &parent, std::vector<int>& sounds, c
795795
for (YAML::const_iterator i = node.begin(); i != node.end(); ++i)
796796
{
797797
sounds.push_back(-1);
798-
loadOffsetNode(parent, sounds.back(), *i, maxShared, 1);
798+
loadOffsetNode(parent, sounds.back(), *i, maxShared, set, 1);
799799
}
800800
}
801801
else
802802
{
803803
sounds.push_back(-1);
804-
loadOffsetNode(parent, sounds.back(), node, maxShared, 1);
804+
loadOffsetNode(parent, sounds.back(), node, maxShared, set, 1);
805805
}
806806
}
807807
}

‎src/Mod/Mod.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class Mod
272272
/// Gets the mod offset.
273273
int getModOffset() const;
274274
/// Get offset and index for sound set or sprite set.
275-
void loadOffsetNode(const std::string &parent, int& offset, const YAML::Node &node, int shared, size_t multipler) const;
275+
void loadOffsetNode(const std::string &parent, int& offset, const YAML::Node &node, int shared, const std::string &set, size_t multipler) const;
276276
/// Gets the mod offset for a certain sprite.
277277
void loadSpriteOffset(const std::string &parent, int& sprite, const YAML::Node &node, const std::string &set, int multipler = 1) const;
278278
/// Gets the mod offset for a certain sound.

0 commit comments

Comments
 (0)