From 187fd85e14dcde3c5ca52a59ea4cefe8490d598d Mon Sep 17 00:00:00 2001 From: Dav999 Date: Wed, 13 Sep 2023 18:47:20 +0200 Subject: [PATCH] Change saved tag back to English This ensures loading a 2.4 save in the English-only 2.3 or earlier doesn't result in missing characters because a translated area name appears in the save file. We are not reading from anymore in 2.4. The way this is done is by not translating the area names inside mapclass::currentarea(), but at the callsites other than the one which saves the . --- desktop_version/src/Map.cpp | 31 +++++++++++++++++-------------- desktop_version/src/Render.cpp | 6 +++--- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 083e8555..e538b1b8 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -1242,51 +1242,54 @@ void mapclass::spawncompanion(void) const char* mapclass::currentarea(const int roomx, const int roomy) { + /* For translation, the returned value is passed to loc::gettext_roomname_special(). + * Returned strings must therefore be found in roomnames_special.xml! */ + if (roomx >= 102 && roomx <= 104 && roomy >= 110 && roomy <= 111) { - return loc::gettext_roomname_special("The Ship"); + return "The Ship"; } switch (area(roomx, roomy)) { case 0: - return loc::gettext_roomname_special("Dimension VVVVVV"); + return "Dimension VVVVVV"; break; case 1: - return loc::gettext_roomname_special("Dimension VVVVVV"); + return "Dimension VVVVVV"; break; case 2: - return loc::gettext_roomname_special("Laboratory"); + return "Laboratory"; break; case 3: - return loc::gettext_roomname_special("The Tower"); + return "The Tower"; break; case 4: - return loc::gettext_roomname_special("Warp Zone"); + return "Warp Zone"; break; case 5: - return loc::gettext_roomname_special("Space Station"); + return "Space Station"; break; case 6: - return loc::gettext_roomname_special("Outside Dimension VVVVVV"); + return "Outside Dimension VVVVVV"; break; case 7: - return loc::gettext_roomname_special("Outside Dimension VVVVVV"); + return "Outside Dimension VVVVVV"; break; case 8: - return loc::gettext_roomname_special("Outside Dimension VVVVVV"); + return "Outside Dimension VVVVVV"; break; case 9: - return loc::gettext_roomname_special("Outside Dimension VVVVVV"); + return "Outside Dimension VVVVVV"; break; case 10: - return loc::gettext_roomname_special("Outside Dimension VVVVVV"); + return "Outside Dimension VVVVVV"; break; case 11: - return loc::gettext_roomname_special("The Tower"); + return "The Tower"; break; } - return loc::gettext_roomname_special("???"); + return "???"; } static void copy_short_to_int(int* dest, const short* src, const size_t size) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 224aff1a..074a130b 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1282,7 +1282,7 @@ static void menurender(void) font::print(PR_2X | PR_CEN, -1, 20, title, tr, tg, tb); font::print( PR_CEN, -1, 80-20, - map.currentarea(summary->saverx, summary->savery), + loc::gettext_roomname_special(map.currentarea(summary->saverx, summary->savery)), 25, 255 - (help.glow / 2), 255 - (help.glow / 2) ); for (int i = 0; i < 6; i++) @@ -2991,7 +2991,7 @@ void maprender(void) buffer, sizeof(buffer), loc::gettext("{area}, {time}"), "area:str, time:str", - map.currentarea(last->saverx, last->savery), + loc::gettext_roomname_special(map.currentarea(last->saverx, last->savery)), game.giventimestring(last->hours, last->minutes, last->seconds).c_str() ); @@ -3014,7 +3014,7 @@ void maprender(void) size_t i; font::print( PR_CEN, -1, FLIP(80, 8), - map.currentarea(game.last_quicksave.saverx, game.last_quicksave.savery), + loc::gettext_roomname_special(map.currentarea(game.last_quicksave.saverx, game.last_quicksave.savery)), 25, 255 - help.glow/2, 255 - help.glow/2 ); for (i = 0; i < SDL_arraysize(game.crewstats); ++i)