Skip to content

Commit

Permalink
use validatecharacterdata in parse function
Browse files Browse the repository at this point in the history
  • Loading branch information
lemz1 committed Nov 19, 2024
1 parent 54654ea commit ca95bec
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/funkin/data/character/CharacterRegistry.hx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class CharacterRegistry
try
{
var charData:CharacterData = parseCharacterData(charId);
charData = validateCharacterData(charId, charData);
if (charData != null)
{
trace(' Loaded character data: ${charId}');
Expand Down Expand Up @@ -399,19 +398,23 @@ class CharacterRegistry
return null;
}

var data:Null<CharacterData> = null;

if (CHARACTER_DATA_VERSION_RULE == null || VersionUtil.validateVersion(version, CHARACTER_DATA_VERSION_RULE))
{
return buildCharacterData(rawJson, charId);
data = buildCharacterData(rawJson, charId);
}
else if (VersionUtil.validateVersion(version, "1.0.x"))
{
return buildCharacterData_v1_0_0(rawJson, charId);
data = buildCharacterData_v1_0_0(rawJson, charId);
}
else
{
trace('[CHARACTER] Could not load character data for "$charId": bad version (got ${version}, expected ${CHARACTER_DATA_VERSION_RULE})');
return null;
}

return validateCharacterData(charId, data);
}

static function loadCharacterFile(charPath:String):JsonFile
Expand Down

0 comments on commit ca95bec

Please sign in to comment.