diff options
author | Strangerke | 2012-02-23 07:55:58 +0100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:21:51 +0200 |
commit | 529b678885f4fb63bb8630bafca53183a0f6b4fa (patch) | |
tree | 01db6e270d9a7224946d9e10e848ca0461a70707 /engines/mortevielle | |
parent | f4a8434d8f59b7df60c5f4c10f598940be4e266a (diff) | |
download | scummvm-rg350-529b678885f4fb63bb8630bafca53183a0f6b4fa.tar.gz scummvm-rg350-529b678885f4fb63bb8630bafca53183a0f6b4fa.tar.bz2 scummvm-rg350-529b678885f4fb63bb8630bafca53183a0f6b4fa.zip |
MORTEVIELLE: cleanup decodeAlertDetails, rename parameters and variables
Diffstat (limited to 'engines/mortevielle')
-rw-r--r-- | engines/mortevielle/dialogs.cpp | 40 | ||||
-rw-r--r-- | engines/mortevielle/dialogs.h | 2 |
2 files changed, 19 insertions, 23 deletions
diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index b332c7e94c..beac0a595e 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -190,44 +190,40 @@ int Alert::show(const Common::String &msg, int n) { * Alert function - Decode Alert Details * @remarks Originally called 'decod' */ -void Alert::decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs) { - int i, k; - bool v; +void Alert::decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr) { + // The second character of the string contains the number of choices + choiceNumb = atoi(inputStr.c_str() + 1); - //val(s[2], nbc, i); - choiceNumb = atoi(s.c_str() + 1); - i = 0; - - c = ""; + choiceStr = ""; + col = 0; lineNumb = 0; // Originally set to 5, decreased to 4 because strings are 0 based, and not 1 based as in Pascal - i = 4; - k = 0; - v = true; - col = 0; + int i = 4; + int k = 0; + bool empty = true; - while (s[i] != ']') { - c += s[i]; - if ((s[i] == '|') || (s[i + 1] == ']')) { + for (; inputStr[i] != ']'; ++i) { + choiceStr += inputStr[i]; + if ((inputStr[i] == '|') || (inputStr[i + 1] == ']')) { if (k > col) col = k; k = 0; ++lineNumb; - } else if (s[i] != ' ') - v = false; - ++i; + } else if (inputStr[i] != ' ') + empty = false; ++k; } - if (v) { - c = ""; + + if (empty) { + choiceStr = ""; col = 20; } else { - c += ']'; + choiceStr += ']'; col += 6; } ++i; - cs = copy(s, i, 30); + choiceListStr = copy(inputStr, i, 30); if (res == 2) col *= 6; else diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index c4d4ab266f..a3f98f38d9 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -34,7 +34,7 @@ namespace Mortevielle { class Alert { private: - static void decodeAlertDetails(Common::String s, int &choiceNumb, int &lineNumb, int &col, Common::String &c, Common::String &cs); + static void decodeAlertDetails(Common::String inputStr, int &choiceNumb, int &lineNumb, int &col, Common::String &choiceStr, Common::String &choiceListStr); static void setPosition(int ji, int coldep, int esp); static void drawAlertBox(int lidep, int nli, int tx); static void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); |