[Scummvm-cvs-logs] SF.net SVN: scummvm:[44434] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Mon Sep 28 06:09:03 CEST 2009


Revision: 44434
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44434&view=rev
Author:   spalek
Date:     2009-09-28 04:09:03 +0000 (Mon, 28 Sep 2009)

Log Message:
-----------
Added const's to getPalette() and several uses of getObject()

Modified Paths:
--------------
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/screen.cpp
    scummvm/trunk/engines/draci/screen.h
    scummvm/trunk/engines/draci/script.cpp

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-09-28 03:51:23 UTC (rev 44433)
+++ scummvm/trunk/engines/draci/game.cpp	2009-09-28 04:09:03 UTC (rev 44434)
@@ -249,7 +249,7 @@
 
 	loadObject(kDragonObject);
 	
-	GameObject *dragon = getObject(kDragonObject);
+	const GameObject *dragon = getObject(kDragonObject);
 	debugC(4, kDraciLogicDebugLevel, "Running init program for the dragon object...");
 	_vm->_script->run(dragon->_program, dragon->_init);
 
@@ -1148,9 +1148,10 @@
 	// other objects that may not yet be loaded
 	for (uint i = 0; i < _info._numObjects; ++i) {
 		if (_objects[i]._location == roomNum) {
+			const GameObject *obj = getObject(i);
 			debugC(6, kDraciLogicDebugLevel, 
-				"Running init program for object %d (offset %d)", i, getObject(i)->_init);		
-			_vm->_script->run(getObject(i)->_program, getObject(i)->_init);
+				"Running init program for object %d (offset %d)", i, obj->_init);		
+			_vm->_script->run(obj->_program, obj->_init);
 		}
 	}
 
@@ -1345,7 +1346,7 @@
 	int oldRoomNum = _currentRoom._roomNum;
 
 	// TODO: Make objects capable of stopping their own animations
-	GameObject *dragon = getObject(kDragonObject);
+	const GameObject *dragon = getObject(kDragonObject);
 	for (uint i = 0; i < dragon->_anims.size(); ++i) {
 		_vm->_anims->stop(dragon->_anims[i]);
 	}

Modified: scummvm/trunk/engines/draci/screen.cpp
===================================================================
--- scummvm/trunk/engines/draci/screen.cpp	2009-09-28 03:51:23 UTC (rev 44433)
+++ scummvm/trunk/engines/draci/screen.cpp	2009-09-28 04:09:03 UTC (rev 44434)
@@ -167,7 +167,7 @@
  * @brief Fetches the current palette
  * @return A byte pointer to the current palette
  */
-byte *Screen::getPalette() const {
+const byte *Screen::getPalette() const {
 	return _palette;
 }
 

Modified: scummvm/trunk/engines/draci/screen.h
===================================================================
--- scummvm/trunk/engines/draci/screen.h	2009-09-28 03:51:23 UTC (rev 44433)
+++ scummvm/trunk/engines/draci/screen.h	2009-09-28 04:09:03 UTC (rev 44434)
@@ -48,7 +48,7 @@
 
 	void setPaletteEmpty(unsigned int numEntries = kNumColours);
 	void setPalette(const byte *data, uint16 start, uint16 num);
-	byte *getPalette() const;
+	const byte *getPalette() const;
 	void copyToScreen();
 	void clearScreen();
 	void fillScreen(uint8 colour);

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-09-28 03:51:23 UTC (rev 44433)
+++ scummvm/trunk/engines/draci/script.cpp	2009-09-28 04:09:03 UTC (rev 44434)
@@ -282,7 +282,7 @@
 int Script::funcIsObjOn(int objID) const {
 	objID -= 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	return obj->_visible;
 }
@@ -290,7 +290,7 @@
 int Script::funcIsObjOff(int objID) const {
 	objID -= 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	// We index locations from 0 (as opposed to the original player where it was from 1)
 	// That's why the "away" location 0 from the data files is converted to -1
@@ -300,7 +300,7 @@
 int Script::funcObjStat(int objID) const {
 	objID -= 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	if (obj->_location == _vm->_game->getRoomNum()) {
 		if (obj->_visible) {
@@ -316,7 +316,7 @@
 int Script::funcIsObjAway(int objID) const {
 	objID -= 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	// see Script::funcIsObjOff
 	return !obj->_visible && obj->_location == -1;
@@ -333,7 +333,7 @@
 		return ret;
 	}
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	bool visible = (obj->_location == _vm->_game->getRoomNum() && obj->_visible);
 
@@ -404,7 +404,7 @@
 	int objID = params.pop() - 1;
 	int animID = params.pop() - 1;	
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	// Stop all animation that the object owns
 
@@ -430,7 +430,7 @@
 	int objID = params.pop() - 1;
 	int animID = params.pop() - 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 
 	// Stop all animation that the object owns
 
@@ -586,7 +586,7 @@
 
 	int objID = params.pop() - 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 	run(obj->_program, obj->_init);
 }
 
@@ -597,7 +597,7 @@
 
 	int objID = params.pop() - 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 	run(obj->_program, obj->_look);
 }
 
@@ -608,7 +608,7 @@
 
 	int objID = params.pop() - 1;
 
-	GameObject *obj = _vm->_game->getObject(objID);
+	const GameObject *obj = _vm->_game->getObject(objID);
 	run(obj->_program, obj->_use);
 }
 


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