- fixed string checks in dialogue loader.

This commit is contained in:
Christoph Oelckers 2019-02-20 19:12:32 +01:00 committed by drfrag
parent 9835ef5cfa
commit 6685238a62

View file

@ -377,7 +377,7 @@ static FStrifeDialogueNode *ReadRetailNode (const char *name, FileReader &lump,
if (name)
{
FStringf label("$TXT_DLG_%s_d%d_%s", name, int(pos), TokenFromString(speech.Dialogue).GetChars());
node->Dialogue = GStrings.exists(label)? label : FString(speech.Dialogue);
node->Dialogue = GStrings.exists(label.GetChars()+1)? label : FString(speech.Dialogue);
}
else
{
@ -401,7 +401,7 @@ static FStrifeDialogueNode *ReadRetailNode (const char *name, FileReader &lump,
label.ReplaceChars(' ', '_');
label.ReplaceChars('\'', '_');
node->SpeakerName.Format("$TXT_SPEAKER_%s", label.GetChars());
if (!GStrings.exists(node->SpeakerName)) node->SpeakerName = speech.Name;
if (!GStrings.exists(node->SpeakerName.GetChars() + 1)) node->SpeakerName = speech.Name;
}
else
@ -473,7 +473,7 @@ static FStrifeDialogueNode *ReadTeaserNode (const char *name, FileReader &lump,
if (name)
{
FStringf label("$TXT_DLG_%s_d%d_%s", name, pos, TokenFromString(speech.Dialogue).GetChars());
node->Dialogue = GStrings.exists(label)? label : FString(speech.Dialogue);
node->Dialogue = GStrings.exists(label.GetChars() + 1)? label : FString(speech.Dialogue);
}
else
{
@ -502,7 +502,7 @@ static FStrifeDialogueNode *ReadTeaserNode (const char *name, FileReader &lump,
label.ReplaceChars(' ', '_');
label.ReplaceChars('\'', '_');
node->SpeakerName.Format("$TXT_SPEAKER_%s", label.GetChars());
if (!GStrings.exists(node->SpeakerName)) node->SpeakerName = speech.Name;
if (!GStrings.exists(node->SpeakerName.GetChars() + 1)) node->SpeakerName = speech.Name;
}
else
{
@ -599,7 +599,7 @@ static void ParseReplies (const char *name, int pos, FStrifeDialogueReply **repl
if (name)
{
FStringf label("$TXT_RPLY%d_%s_d%d_%s", j, name, pos, TokenFromString(rsp->Reply).GetChars());
reply->Reply = GStrings.exists(label)? label : FString(rsp->Reply);
reply->Reply = GStrings.exists(label.GetChars() + 1)? label : FString(rsp->Reply);
reply->Reply = label;
}
@ -625,7 +625,7 @@ static void ParseReplies (const char *name, int pos, FStrifeDialogueReply **repl
if (name)
{
FStringf label("$TXT_RYES%d_%s_d%d_%s", j, name, pos, TokenFromString(rsp->Yes).GetChars());
reply->QuickYes = GStrings.exists(label)? label : FString(rsp->Yes);
reply->QuickYes = GStrings.exists(label.GetChars() + 1)? label : FString(rsp->Yes);
}
else
{
@ -635,7 +635,7 @@ static void ParseReplies (const char *name, int pos, FStrifeDialogueReply **repl
if (reply->ItemCheck[0].Item != 0)
{
FStringf label("$TXT_RNO%d_%s_d%d_%s", j, name, pos, TokenFromString(rsp->No).GetChars());
reply->QuickNo = GStrings.exists(label)? label : FString(rsp->No);
reply->QuickNo = GStrings.exists(label.GetChars() + 1)? label : FString(rsp->No);
}
else
{