[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.65,1.66 resource.cpp,1.99,1.100 scumm.h,1.259,1.260 scummvm.cpp,2.254,2.255 sound.cpp,1.144,1.145 sound.h,1.34,1.35 verbs.cpp,1.57,1.58

Max Horn fingolfin at users.sourceforge.net
Wed Jun 25 16:50:10 CEST 2003


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

Modified Files:
	costume.cpp resource.cpp scumm.h scummvm.cpp sound.cpp sound.h 
	verbs.cpp 
Log Message:
more const qualifiers

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- costume.cpp	19 Jun 2003 21:09:51 -0000	1.65
+++ costume.cpp	25 Jun 2003 23:49:54 -0000	1.66
@@ -724,7 +724,7 @@
 	} while (1);
 }
 
-bool Scumm::isCostumeInUse(int cost) {
+bool Scumm::isCostumeInUse(int cost) const {
 	int i;
 	Actor *a;
 

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- resource.cpp	25 Jun 2003 23:25:51 -0000	1.99
+++ resource.cpp	25 Jun 2003 23:49:54 -0000	1.100
@@ -31,7 +31,8 @@
 #include "gui/message.h"
 #include "dialogs.h"
 
-uint16 newTag2Old(uint32 oldTag);
+static uint16 newTag2Old(uint32 oldTag);
+static const char *resTypeFromId(int id);
 
 /* Open a room */
 void Scumm::openRoom(int room) {
@@ -1318,7 +1319,7 @@
 	return ptr + sizeof(MemBlkHeader);	/* skip header */
 }
 
-bool Scumm::validateResource(const char *str, int type, int idx) {
+bool Scumm::validateResource(const char *str, int type, int idx) const {
 	if (type < rtFirst || type > rtLast || (uint) idx >= (uint) res.num[type]) {
 		warning("%s Illegal Glob type %s (%d) num %d", str, resTypeFromId(type), type, idx);
 		return false;
@@ -1509,8 +1510,7 @@
 //  debug(1, "unlocking %d,%d", type, i);
 }
 
-bool Scumm::isResourceInUse(int type, int i)
-{
+bool Scumm::isResourceInUse(int type, int i) const {
 	if (!validateResource("isResourceInUse", type, i))
 		return false;
 	switch (type) {
@@ -1625,7 +1625,7 @@
 	}
 }
 
-bool Scumm::isResourceLoaded(int type, int idx) {
+bool Scumm::isResourceLoaded(int type, int idx) const {
 	if (!validateResource("isLoaded", type, idx))
 		return false;
 	return res.address[type][idx] != NULL;
@@ -1781,7 +1781,7 @@
 }
 
 
-bool Scumm::isGlobInMemory(int type, int idx) {
+bool Scumm::isGlobInMemory(int type, int idx) const{
 	if (!validateResource("isGlobInMemory", type, idx))
 		return false;
 
@@ -1792,99 +1792,71 @@
 	switch (oldTag) {
 	case (MKID('RMHD')):
 		return (0x4448);	// HD
-		break;
 	case (MKID('IM00')):
 		return (0x4D42);	// BM
-		break;
 	case (MKID('EXCD')):
 		return (0x5845);	// EX
-		break;
 	case (MKID('ENCD')):
 		return (0x4E45);	// EN
-		break;
 	case (MKID('SCAL')):
 		return (0x4153);	// SA
-		break;
 	case (MKID('LSCR')):
 		return (0x534C);	// LS
-		break;
 	case (MKID('OBCD')):
 		return (0x434F);	// OC
-		break;
 	case (MKID('OBIM')):
 		return (0x494F);	// OI
-		break;
 	case (MKID('SMAP')):
 		return (0x4D42);	// BM
-		break;
 	case (MKID('CLUT')):
 		return (0x4150);	// PA
-		break;
 	case (MKID('BOXD')):
 		return (0x5842);	// BX
-		break;
 	default:
 		return (0);
 	}
 }
 
-char *Scumm::resTypeFromId(int id) {
+const char *resTypeFromId(int id) {
 	static char buf[100];
 
 	switch (id) {
 	case rtRoom:
-		sprintf(buf, "Room");
-		break;
+		return "Room";
 	case rtScript:
-		sprintf(buf, "Script");
-		break;
+		return "Script";
 	case rtCostume:
-		sprintf(buf, "Costume");
-		break;
+		return "Costume";
 	case rtSound:
-		sprintf(buf, "Sound");
-		break;
+		return "Sound";
 	case rtInventory:
-		sprintf(buf, "Inventory");
-		break;
+		return "Inventory";
 	case rtCharset:
-		sprintf(buf, "Charset");
-		break;
+		return "Charset";
 	case rtString:
-		sprintf(buf, "String");
-		break;
+		return "String";
 	case rtVerb:
-		sprintf(buf, "Verb");
-		break;
+		return "Verb";
 	case rtActorName:
-		sprintf(buf, "ActorName");
-		break;
+		return "ActorName";
 	case rtBuffer:
-		sprintf(buf, "Buffer");
-		break;
+		return "Buffer";
 	case rtScaleTable:
-		sprintf(buf, "ScaleTable");
-		break;
+		return "ScaleTable";
 	case rtTemp:
-		sprintf(buf, "Temp");
-		break;
+		return "Temp";
 	case rtFlObject:
-		sprintf(buf, "FlObject");
-		break;
+		return "FlObject";
 	case rtMatrix:
-		sprintf(buf, "Matrix");
-		break;
+		return "Matrix";
 	case rtBox:
-		sprintf(buf, "Box");
-		break;
+		return "Box";
 	case rtLast:
-		sprintf(buf, "Last");
-		break;
+		return "Last";
 	case rtNumTypes:
-		sprintf(buf, "NumTypes");
-		break;
+		return "NumTypes";
 	default:
 		sprintf(buf, "%d", id);
+		return buf;
 	}
-	return buf;
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -d -r1.259 -r1.260
--- scumm.h	25 Jun 2003 23:25:51 -0000	1.259
+++ scumm.h	25 Jun 2003 23:49:54 -0000	1.260
@@ -342,7 +342,6 @@
 	// Startup functions
 	void main();
 	void parseCommandLine(int argc, char **argv);
-	void showHelpAndExit();
 	bool detectGame();
 	void launch();
 	void go();
@@ -619,15 +618,14 @@
 
 	void loadPtrToResource(int type, int i, const byte *ptr);
 	void readResTypeList(int id, uint32 tag, const char *name);
-	char *resTypeFromId(int id);
 	void allocResTypeData(int id, uint32 tag, int num, const char *name, int mode);
 	byte *createResource(int type, int index, uint32 size);
 	int loadResource(int type, int i);
 	void nukeResource(int type, int i);	
 
 public:
-	bool isGlobInMemory(int type, int index);
-	bool isResourceLoaded(int type, int index);
+	bool isGlobInMemory(int type, int index) const;
+	bool isResourceLoaded(int type, int index) const;
 	byte *getResourceAddress(int type, int i);
 	byte *getStringAddress(int i);
 	byte *getStringAddressVar(int i);
@@ -638,9 +636,9 @@
 	int readSoundResource(int type, int index);
 	int readSoundResourceSmallHeader(int type, int index);
 	void setResourceCounter(int type, int index, byte flag);
-	bool validateResource(const char *str, int type, int index);
+	bool validateResource(const char *str, int type, int index) const;
 	void increaseResourceCounter();
-	bool isResourceInUse(int type, int i);
+	bool isResourceInUse(int type, int i) const;
 	void initRoomSubBlocks();
 	void clearRoomObjects();
 	void loadRoomObjects();
@@ -738,12 +736,12 @@
 	void redrawVerbs();
 	void checkExecVerbs();
 	void verbMouseOver(int verb);
-	int checkMouseOver(int x, int y);
+	int checkMouseOver(int x, int y) const;
 	void drawVerb(int verb, int mode);
 	void runInputScript(int a, int cmd, int mode);
 	void restoreVerbBG(int verb);
 	void drawVerbBitmap(int verb, int x, int y);
-	int getVerbSlot(int id, int mode);
+	int getVerbSlot(int id, int mode) const;
 	void killVerb(int slot);
 	void setVerbObject(uint room, uint object, uint verb);
 
@@ -759,8 +757,8 @@
 
 public:
 	/* Should be in Actor class */
-	Actor *derefActor(int id, const char *errmsg = 0);
-	Actor *derefActorSafe(int id, const char *errmsg);
+	Actor *derefActor(int id, const char *errmsg = 0) const;
+	Actor *derefActorSafe(int id, const char *errmsg) const;
 
 	uint32 *_classData;
 
@@ -776,7 +774,7 @@
 	void processUpperActors();
 	int getActorFromPos(int x, int y);
 	
-	bool isCostumeInUse(int i);
+	bool isCostumeInUse(int i) const;
 
 public:
 	/* Actor talking stuff */

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.254
retrieving revision 2.255
diff -u -d -r2.254 -r2.255
--- scummvm.cpp	25 Jun 2003 23:25:52 -0000	2.254
+++ scummvm.cpp	25 Jun 2003 23:49:54 -0000	2.255
@@ -2115,7 +2115,7 @@
 	}
 }
 
-Actor *Scumm::derefActor(int id, const char *errmsg) {
+Actor *Scumm::derefActor(int id, const char *errmsg) const {
 	if (id < 1 || id >= _numActors || _actors[id].number != id) {
 		if (errmsg)
 			error("Invalid actor %d in %s", id, errmsg);
@@ -2125,7 +2125,7 @@
 	return &_actors[id];
 }
 
-Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
+Actor *Scumm::derefActorSafe(int id, const char *errmsg) const {
 	if (id < 1 || id >= _numActors || _actors[id].number != id) {
 		debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
 			 id, errmsg, vm.slot[_curExecScript].number, _opcode);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- sound.cpp	25 Jun 2003 23:25:52 -0000	1.144
+++ sound.cpp	25 Jun 2003 23:49:54 -0000	1.145
@@ -591,7 +591,7 @@
 }
 
 
-int Sound::isSoundRunning(int sound) {
+int Sound::isSoundRunning(int sound) const {
 	int i;
 
 	if (sound == _current_cd_sound)
@@ -603,7 +603,7 @@
 		} else if (sound == -1) {
 			// getSoundStatus(), with a -1, will return the
 			// ID number of the first active music it finds.
-			return _scumm->_imuse->getSoundStatus (sound);
+			return _scumm->_imuse->getSoundStatus(sound);
 		}
 	}
 	
@@ -626,7 +626,7 @@
 		return _scumm->_imuse->getSoundStatus(sound);
 
 	if (_scumm->_playerV2)
-		return _scumm->_playerV2->getSoundStatus (sound);
+		return _scumm->_playerV2->getSoundStatus(sound);
 
 	return 0;
 }
@@ -635,7 +635,7 @@
 // calls IMuse::get_sound_active() instead of IMuse::getSoundStatus().
 // This is necessary when determining what resources to
 // expire from memory.
-bool Sound::isSoundActive(int sound) {
+bool Sound::isSoundActive(int sound) const {
 	int i;
 
 	if (sound == _current_cd_sound)
@@ -662,7 +662,7 @@
 	return _scumm->_imuse->get_sound_active(sound);
 }
 
-bool Sound::isSoundInQueue(int sound) {
+bool Sound::isSoundInQueue(int sound) const {
 	int i = 0, j, num;
 	int16 table[16];
 
@@ -961,7 +961,7 @@
 	}
 }
 
-bool Sound::isSfxFinished() {
+bool Sound::isSfxFinished() const {
 	return !_scumm->_mixer->hasActiveSFXChannel();
 }
 
@@ -1454,7 +1454,7 @@
 		_scumm->_system->stop_cdrom();
 }
 
-int Sound::pollCD() {
+int Sound::pollCD() const {
 	if (pollMP3CD())
 		return 1;
 
@@ -1566,7 +1566,7 @@
 	return -1;
 }
 
-int Sound::pollMP3CD() {
+int Sound::pollMP3CD() const{
 	if (_dig_cd_playing == true)
 		return 1;
 	return 0;

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- sound.h	25 Jun 2003 23:25:52 -0000	1.34
+++ sound.h	25 Jun 2003 23:49:54 -0000	1.35
@@ -118,9 +118,9 @@
 	int startTalkSound(uint32 offset, uint32 b, int mode);
 	void stopTalkSound();
 	bool isMouthSyncOff(uint pos);
-	int isSoundRunning(int sound);
-	bool isSoundActive(int sound);
-	bool isSoundInQueue(int sound);
+	int isSoundRunning(int sound) const;
+	bool isSoundActive(int sound) const;
+	bool isSoundInQueue(int sound) const;
 	void stopSound(int a);
 	void stopAllSounds();
 	void soundKludge(int *list, int num);
@@ -141,7 +141,7 @@
 
 	void playCDTrack(int track, int num_loops, int start, int delay);
 	void stopCD();
-	int pollCD();
+	int pollCD() const;
 	void updateCD();
 
 protected:
@@ -150,7 +150,7 @@
 	File *openSfxFile();
 	int startSfxSound(File *file, int file_size);
 	void stopSfxSound();
-	bool isSfxFinished();
+	bool isSfxFinished() const;
 	int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
 	int playSfxSound_MP3(void *sound, uint32 size);
 	int playSfxSound_Vorbis(void *sound, uint32 size);
@@ -158,7 +158,7 @@
 	int getCachedTrack(int track);
 	int playMP3CDTrack(int track, int num_loops, int start, int delay);
 	int stopMP3CD();
-	int pollMP3CD();
+	int pollMP3CD() const;
 	int updateMP3CD();
 };
 

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- verbs.cpp	17 Jun 2003 07:11:58 -0000	1.57
+++ verbs.cpp	25 Jun 2003 23:49:54 -0000	1.58
@@ -319,7 +319,7 @@
 	}
 }
 
-int Scumm::checkMouseOver(int x, int y) {
+int Scumm::checkMouseOver(int x, int y) const {
 	VerbSlot *vs;
 	int i = _maxVerbs - 1;
 
@@ -505,7 +505,7 @@
 	vs->alloctwobuffers = twobufs;
 }
 
-int Scumm::getVerbSlot(int id, int mode) {
+int Scumm::getVerbSlot(int id, int mode) const {
 	int i;
 	for (i = 1; i < _maxVerbs; i++) {
 		if (_verbs[i].verbid == id && _verbs[i].saveid == mode) {





More information about the Scummvm-git-logs mailing list