- fixed string checks in dialogue loader.

This commit is contained in:
Christoph Oelckers 2019-02-20 19:12:32 +01:00
parent d2ac77e721
commit 0e449405a4

View file

@ -352,7 +352,7 @@ static FStrifeDialogueNode *ReadRetailNode (FLevelLocals *Level, const char *nam
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
{
@ -376,7 +376,7 @@ static FStrifeDialogueNode *ReadRetailNode (FLevelLocals *Level, const char *nam
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
@ -448,7 +448,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FLevelLocals *Level, const char *nam
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
{
@ -477,7 +477,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FLevelLocals *Level, const char *nam
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
{
@ -574,7 +574,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;
}
@ -600,7 +600,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
{
@ -610,7 +610,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
{