[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.31,2.32 charset.h,2.16,2.17 script_v5.cpp,1.91,1.92 scumm.h,1.206,1.207 string.cpp,1.113,1.114 verbs.cpp,1.44,1.45

Max Horn fingolfin at users.sourceforge.net
Wed May 21 09:29:02 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv18019

Modified Files:
	charset.cpp charset.h script_v5.cpp scumm.h string.cpp 
	verbs.cpp 
Log Message:
constness fixes

Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.31
retrieving revision 2.32
diff -u -d -r2.31 -r2.32
--- charset.cpp	20 May 2003 15:12:33 -0000	2.31
+++ charset.cpp	21 May 2003 16:28:00 -0000	2.32
@@ -94,7 +94,7 @@
 	return spacing;
 }
 
-int CharsetRenderer::getStringWidth(int arg, byte *text) {
+int CharsetRenderer::getStringWidth(int arg, const byte *text) {
 	int pos = 0;
 	int width = 1;
 	byte chr;
@@ -112,8 +112,8 @@
 			if (chr == 8) { // 'Verb on next line'
 				if (arg == 1)
 					break;
-				while (text[pos] == ' ')
-					text[pos++] = '@';
+				while (text[pos++] == ' ')
+					;
 				continue;
 			}
 			if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.16
retrieving revision 2.17
diff -u -d -r2.16 -r2.17
--- charset.h	20 May 2003 15:12:33 -0000	2.16
+++ charset.h	21 May 2003 16:28:01 -0000	2.17
@@ -61,7 +61,7 @@
 
 	virtual void printChar(int chr) = 0;
 
-	int getStringWidth(int a, byte *str);
+	int getStringWidth(int a, const byte *str);
 	void addLinebreaks(int a, byte *str, int pos, int maxwidth);
 	
 	virtual void setCurID(byte id) = 0;

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- script_v5.cpp	21 May 2003 14:00:07 -0000	1.91
+++ script_v5.cpp	21 May 2003 16:28:01 -0000	1.92
@@ -1002,7 +1002,7 @@
 
 	// INDY3 uses this opcode as a wait_for_actor();
 	if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
-		byte *oldaddr = _scriptPointer - 1;
+		const byte *oldaddr = _scriptPointer - 1;
 		if (derefActorSafe(getVarOrDirectByte(0x80), "o5_wait")->moving) {
 			_scriptPointer = oldaddr;
 			o5_breakHere();
@@ -2301,9 +2301,7 @@
 }
 
 void Scumm_v5::o5_wait() {
-	byte *oldaddr;
-
-	oldaddr = _scriptPointer - 1;
+	const byte *oldaddr = _scriptPointer - 1;
 
 	if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
 		_opcode = 2;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- scumm.h	21 May 2003 10:13:06 -0000	1.206
+++ scumm.h	21 May 2003 16:28:01 -0000	1.207
@@ -487,7 +487,7 @@
 
 	/* Script VM - should be in Script class */
 	uint32 _localScriptList[NUM_LOCALSCRIPT];
-	byte *_scriptPointer, *_scriptOrgPointer;
+	const byte *_scriptPointer, *_scriptOrgPointer;
 	byte _opcode, _numNestedScripts, _currentScript;
 	uint16 _curExecScript;
 	byte **_lastCodePtr;
@@ -1017,7 +1017,7 @@
 	void CHARSET_1();
 	void drawString(int a);
 	void drawDescString(byte *msg);
-	byte *addMessageToStack(byte *msg);
+	const byte *addMessageToStack(const byte *msg);
 	void addIntToStack(int var);
 	void addVerbToStack(int var);
 	void addNameToStack(int var);
@@ -1028,7 +1028,7 @@
 
 	int _numInMsgStack;
 	byte *_msgPtrToAdd;
-	byte *_messagePtr;
+	const byte *_messagePtr;
 	int16 _talkDelay;
 	bool _keepText;
 	uint16 _language;
@@ -1037,7 +1037,7 @@
 	struct langIndexNode *_languageIndex;
 	int _languageStrCount;
 	void loadLanguageBundle();
-	void translateText(byte *text, byte *trans_buff);
+	void translateText(const byte *text, byte *trans_buff);
 	byte _transText[500];
 
 #if defined(SCUMM_LITTLE_ENDIAN)

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- string.cpp	19 May 2003 20:09:30 -0000	1.113
+++ string.cpp	21 May 2003 16:28:01 -0000	1.114
@@ -55,7 +55,8 @@
 }
 
 void Scumm::unkMessage2() {
-	byte buf[100], *tmp;
+	byte buf[100];
+	const byte *tmp;
 
 	_msgPtrToAdd = buf;
 	tmp = _messagePtr = addMessageToStack(_messagePtr);
@@ -508,7 +509,7 @@
 	} 
 }
 
-byte *Scumm::addMessageToStack(byte *msg) {
+const byte *Scumm::addMessageToStack(const byte *msg) {
 	int num, numorg;
 	unsigned char *ptr, chr;
 
@@ -835,7 +836,7 @@
 	_existLanguageFile = true;
 }
 
-void Scumm::translateText(byte *text, byte *trans_buff) {
+void Scumm::translateText(const byte *text, byte *trans_buff) {
 	char name[20], tmp[500], tmp2[20], num_s[20], number[4], enc;
 	int32 num, l, j, k, r, pos = 0;
 	char *buf = _languageBuffer;

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- verbs.cpp	21 May 2003 10:13:06 -0000	1.44
+++ verbs.cpp	21 May 2003 16:28:02 -0000	1.45
@@ -79,14 +79,14 @@
 	if (curInventoryCount > 0) { // Draw Up Arrow
 		_string[1].xpos = 145;
 		_string[1].ypos = virtscr[2].topline + 32;
-		_messagePtr = (byte*)strdup("U");
+		_messagePtr = (const byte *)"U";
 		drawString(1);
 	}
 
 	if (items == 4) {     // Draw Down Arrow
 		_string[1].xpos = 145;
 		_string[1].ypos = virtscr[2].topline + 47;
-		_messagePtr = (byte*)strdup("D");
+		_messagePtr = (const byte *)"D";
 		drawString(1);
 	}
 }





More information about the Scummvm-git-logs mailing list