aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek/room.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2019-10-20 15:23:18 +0300
committerFilippos Karapetis2019-10-20 15:23:44 +0300
commit71346d15eb3b9c874f09f19b72f4e60542b50c56 (patch)
tree00a05657a9a367bc0cf0012119f5900ebb6ccc94 /engines/startrek/room.cpp
parentba6834c96e33723ad16f7d7fbaaba17a5e35e91d (diff)
downloadscummvm-rg350-71346d15eb3b9c874f09f19b72f4e60542b50c56.tar.gz
scummvm-rg350-71346d15eb3b9c874f09f19b72f4e60542b50c56.tar.bz2
scummvm-rg350-71346d15eb3b9c874f09f19b72f4e60542b50c56.zip
STARTREK: Read the text of the MUDD mission rooms from RDF files
Also, add a central mechanism to fix text typos
Diffstat (limited to 'engines/startrek/room.cpp')
-rw-r--r--engines/startrek/room.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index eec1bb0f20..d777564bf0 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -183,8 +183,25 @@ void Room::loadRoomMessage(const char *text) {
_lookWithTalkerMessages[messageNum] = text;
}
+struct TypoFix {
+ Common::String prefix;
+ Common::String origText;
+ Common::String newText;
+};
+
Common::String Room::patchRoomMessage(const char *text) {
Common::String txt = text;
+ int i = 0;
+
+ TypoFix typoFixes[] = {
+ { "#MUD0\\MUD0_023#", "gullability", "gullibility" },
+ { "#MUD2\\MUD2_002#", "Well, now! I think", "Well, now I think" },
+ { "#MUD2\\MUD2_014#", "I don't understand enough of the alien's thinking", "I don't understand enough of how the aliens thought," },
+ { "#MUD3\\MUD3_011#", "to think after all the stunts that Harry has pulled", "to think that after all the stunts that Harry has pulled," },
+ { "#MUD3\\MUD3_022#", "and they were certain", "and they are certain" },
+ { "#MUD3\\MUD4_008#", "DId you know", "Did you know" },
+ { "", "", "" }
+ };
// Fix typos where some messages contain a hyphen instead of an underscore
// (e.g in LOV2)
@@ -203,6 +220,18 @@ Common::String Room::patchRoomMessage(const char *text) {
if (txt.hasPrefix("#FEA3\\FEA3_030#"))
txt = Common::String("#LOVA\\LOVA_100#") + (text + 14);
+ // Fix typos
+ do {
+ const Common::String origText = typoFixes[i].origText;
+ const Common::String newText = typoFixes[i].newText;
+
+ int32 pos = txt.find(origText);
+ if (pos > 0)
+ txt.replace(pos, origText.size(), newText, pos, newText.size());
+
+ i++;
+ } while (typoFixes[i].prefix != "");
+
return txt;
}