From 0a8189fd41e3995ba866967b57ea1a0c25b8e94d Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 5 Jan 2011 13:04:08 +0000 Subject: AGI: cleanup svn-id: r55124 --- engines/agi/agi.h | 8 ++------ engines/agi/predictive.cpp | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 8ff7f6c35e..89b116daec 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -1010,10 +1010,6 @@ public: // Text public: - #define MAXWORDLEN 24 - - typedef Common::String String; - int messageBox(const char *); int selectionBox(const char *, const char **); void closeWindow(); @@ -1044,8 +1040,8 @@ private: char **_predictiveDictLine; int32 _predictiveDictLineCount; char *_predictiveDictActLine; - String _currentCode; - String _currentWord; + Common::String _currentCode; + Common::String _currentWord; int _wordNumber; bool _predictiveDialogRunning; public: diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 250ac1df22..3ab3f31e03 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -35,11 +35,16 @@ namespace Agi { -#define kModePre 0 -#define kModeNum 1 -#define kModeAbc 2 +enum { + kModePre = 0, + kModeNum = 1, + kModeAbc = 2 +}; -#define MAXLINELEN 80 +enum { + MAXLINELEN = 80, + MAXWORDLEN = 24 +}; uint8 countWordsInString(char *str) { // Count the number of (space separated) words in the given string. @@ -98,7 +103,7 @@ bool AgiEngine::predictiveDialog() { uint8 x; int y; int bx[17], by[17]; - String prefix; + Common::String prefix; char temp[MAXWORDLEN + 1], repeatcount[MAXWORDLEN]; AgiBlock tmpwindow; bool navigationwithkeys = false; @@ -137,7 +142,7 @@ bool AgiEngine::predictiveDialog() { _predictiveDialogRunning = true; _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, true); - memset(repeatcount, 0, MAXWORDLEN); + memset(repeatcount, 0, sizeof(repeatcount)); // show the predictive dialog. // if another window is already in display, save its state into tmpwindow @@ -373,7 +378,7 @@ bool AgiEngine::predictiveDialog() { _currentCode.clear(); _currentWord.clear(); numMatchingWords = 0; - memset(repeatcount, 0, MAXWORDLEN); + memset(repeatcount, 0, sizeof(repeatcount)); } else if (active < 9 || active == 11 || active == 15) { // number or backspace if (active == 11) { // backspace if (_currentCode.size()) { @@ -419,7 +424,7 @@ bool AgiEngine::predictiveDialog() { char *tok = strtok(tmp, " "); for (uint8 i = 0; i <= _wordNumber; i++) tok = strtok(NULL, " "); - _currentWord = String(tok, _currentCode.size()); + _currentWord = Common::String(tok, _currentCode.size()); } } else if (mode == kModeAbc){ x = _currentCode.size(); @@ -451,7 +456,7 @@ bool AgiEngine::predictiveDialog() { prefix += temp; _currentCode.clear(); _currentWord.clear(); - memset(repeatcount, 0, MAXWORDLEN); + memset(repeatcount, 0, sizeof(repeatcount)); } else { goto press; } @@ -593,7 +598,7 @@ bool AgiEngine::matchWord() { tmp[MAXLINELEN - 1] = 0; char *tok = strtok(tmp, " "); tok = strtok(NULL, " "); - _currentWord = String(tok, _currentCode.size()); + _currentWord = Common::String(tok, _currentCode.size()); return true; } else { _predictiveDictActLine = NULL; -- cgit v1.2.3