Skip to content

Commit

Permalink
Validator: More robust detection of missing @ terminators.
Browse files Browse the repository at this point in the history
Small adjustments to satisfy new validator requirements.
  • Loading branch information
wfowler1 committed Jan 2, 2025
1 parent 172843b commit 0e9a8d8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion data/text/battle.asm
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ ProtectedByText:

MirrorMoveFailedText:
text "De SPIEGELAANVAL" ; "The MIRROR MOVE"
next "mislukte!" ; "failed!"
line "mislukte!" ; "failed!"
prompt

StoleText:
Expand Down
2 changes: 1 addition & 1 deletion data/text/common_1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ _FourZerosInvalidText::

_EnterPasscodeText::
text "Voer de CIJFERCODE" ; "Enter the CARD"
next "in van KAARTMAP." ; "FOLDER PASSCODE."
line "in van KAARTMAP." ; "FOLDER PASSCODE."
done

_IncorrectPasscodeText::
Expand Down
2 changes: 1 addition & 1 deletion data/text/common_3.asm
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ _LearnedMoveText::

_MoveAskForgetText::
text "Welke aanval wordt" ; "Which move should"
next "vergeten?" ; "be forgotten?"
line "vergeten?" ; "be forgotten?"
done

_StopLearningMoveText::
Expand Down
42 changes: 21 additions & 21 deletions tools/PokeGen2TextValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ internal class Validator
public const int MaxLandmarkLineLength = 11;
public const int MaxLandmarkLength = 17;

public const string PrintableChars = "“”·… ′″ABCDEFGHIJKLMNOPQRSTUVWXYZ():;[]abcdefghijklmnopqrstuvwxyzàèùßçÄÖÜäöüëïâôûêîÏË←ÈÉ'-+?!.&é→▷▶▼♂¥×/,♀0123456789┌─┐│└─┘";
public const string PrintableChars = "“”·… ′″ABCDEFGHIJKLMNOPQRSTUVWXYZ():;[]abcdefghijklmnopqrstuvwxyzàèùßçÄÖÜäöüëïâôûêîÏË←ÈÉ'-+?!.&é→▷▶▼♂¥×/,♀0123456789┌─┐│└─┘◀⁂№";

private Block _block;
private StringBuilder output;
Expand Down Expand Up @@ -1009,24 +1009,19 @@ private void ValidateLines()
for (int i = 0; i < lines.Count; ++i)
{
string line = lines[i];
string nextLine = null;
if (lines.Count > i + 1)
{
string nextLine = lines[i + 1];
if (CheckTextboxLineNeedsTerminator(line, nextLine) && !lines[i].EndsWith("@\""))
{
output.Append(GetTerminatorErrorMessage(line));
}
if (!CheckTextboxNextLineValid(line, nextLine))
{
output.Append(GetInvalidNextLineErrorMessage(line, nextLine));
}
nextLine = lines[i + 1];
}
else

if (CheckTextboxLineNeedsTerminator(line, nextLine) && !lines[i].EndsWith("@\""))
{
if (!CheckTextboxNextLineValid(line, null))
{
output.Append(GetInvalidLastLineErrorMessage(line));
}
output.Append(GetTerminatorErrorMessage(line));
}
if (!CheckTextboxNextLineValid(line, nextLine))
{
output.Append(GetInvalidNextLineErrorMessage(line, nextLine));
}
}
}
Expand Down Expand Up @@ -1282,11 +1277,16 @@ private static bool CheckTextboxLineNeedsTerminator(string line, string nextLine
if (line.StartsWith("text ")
|| line.StartsWith("line ")
|| line.StartsWith("para ")
|| line.StartsWith("cont ")
|| line.StartsWith("next "))
|| line.StartsWith("cont "))
{
if (nextLine != null && (nextLine.StartsWith("sound_") || nextLine.StartsWith("text_")))
{
return true;
}
}
if (line.StartsWith("db ") || line.StartsWith("next "))
{
if (nextLine.StartsWith("sound_")
|| nextLine.StartsWith("text_"))
if (line.Contains("\"") && !line.Contains("@\"") && (nextLine == null || !nextLine.StartsWith("next ")))
{
return true;
}
Expand Down Expand Up @@ -1656,8 +1656,8 @@ private void CopyLines(Block sourceBlock, Block targetBlock)
}

}
// TrainerDataValidator.cs
// TrainerDataValidator.cs
internal class TrainerDataValidator
{

Expand Down

0 comments on commit 0e9a8d8

Please sign in to comment.