[Scummvm-cvs-logs] SF.net SVN: scummvm:[55124] scummvm/trunk/engines/agi

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Jan 5 14:04:08 CET 2011


Revision: 55124
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55124&view=rev
Author:   fingolfin
Date:     2011-01-05 13:04:08 +0000 (Wed, 05 Jan 2011)

Log Message:
-----------
AGI: cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/predictive.cpp

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2011-01-04 23:19:04 UTC (rev 55123)
+++ scummvm/trunk/engines/agi/agi.h	2011-01-05 13:04:08 UTC (rev 55124)
@@ -1010,10 +1010,6 @@
 
 	// 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 @@
 	char **_predictiveDictLine;
 	int32 _predictiveDictLineCount;
 	char *_predictiveDictActLine;
-	String _currentCode;
-	String _currentWord;
+	Common::String _currentCode;
+	Common::String _currentWord;
 	int _wordNumber;
 	bool _predictiveDialogRunning;
 public:

Modified: scummvm/trunk/engines/agi/predictive.cpp
===================================================================
--- scummvm/trunk/engines/agi/predictive.cpp	2011-01-04 23:19:04 UTC (rev 55123)
+++ scummvm/trunk/engines/agi/predictive.cpp	2011-01-05 13:04:08 UTC (rev 55124)
@@ -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 @@
 	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 @@
 	_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 @@
 					_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 @@
 							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 @@
 					prefix += temp;
 					_currentCode.clear();
 					_currentWord.clear();
-					memset(repeatcount, 0, MAXWORDLEN);
+					memset(repeatcount, 0, sizeof(repeatcount));
 				} else {
 					goto press;
 				}
@@ -593,7 +598,7 @@
 		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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list