From 6423b2fece0e76b7a97c2613430684e0586f0dc9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 9 Feb 2015 10:15:11 +0100 Subject: [PATCH] - fixed: Dehacked text patching needs to alter all occurences of the source string. --- src/d_dehacked.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 8debb69a4..4a436c0a8 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2190,24 +2190,25 @@ static int PatchText (int oldSize) } } - if (!good) - { - // Search through most other texts - const char *str; - str = EnglishStrings->MatchString (oldStr); + // Search through most other texts + const char *str; + do + { + str = EnglishStrings->MatchString(oldStr); if (str != NULL) { - GStrings.SetString (str, newStr); + GStrings.SetString(str, newStr); + EnglishStrings->SetString(str, "~~"); // set to something invalid so that it won't get found again by the next iteration or by another replacement later good = true; } + } + while (str != NULL); // repeat search until the text can no longer be found - if (!good) - { - DPrintf (" (Unmatched)\n"); - } + if (!good) + { + DPrintf (" (Unmatched)\n"); } - donewithtext: if (newStr) delete[] newStr;