[Scummvm-cvs-logs] SF.net SVN: scummvm:[55766] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Fri Feb 4 16:53:45 CET 2011


Revision: 55766
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55766&view=rev
Author:   drmccoy
Date:     2011-02-04 15:53:44 +0000 (Fri, 04 Feb 2011)

Log Message:
-----------
GOB: Move storeValue/storeString to class Inter

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter.cpp
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v7.cpp

Modified: scummvm/trunk/engines/gob/inter.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter.cpp	2011-02-04 15:42:58 UTC (rev 55765)
+++ scummvm/trunk/engines/gob/inter.cpp	2011-02-04 15:53:44 UTC (rev 55766)
@@ -365,4 +365,74 @@
 	_variables = 0;
 }
 
+void Inter::storeValue(uint16 index, uint16 type, uint32 value) {
+	switch (type) {
+	case OP_ARRAY_INT8:
+	case TYPE_VAR_INT8:
+		WRITE_VARO_UINT8(index, value);
+		break;
+
+	case TYPE_VAR_INT16:
+	case TYPE_VAR_INT32_AS_INT16:
+	case TYPE_ARRAY_INT16:
+		WRITE_VARO_UINT16(index, value);
+		break;
+
+	default:
+		WRITE_VARO_UINT32(index, value);
+	}
+}
+
+void Inter::storeValue(uint32 value) {
+	uint16 type;
+	uint16 index = _vm->_game->_script->readVarIndex(0, &type);
+
+	storeValue(index, type, value);
+}
+
+void Inter::storeString(uint16 index, uint16 type, const char *value) {
+	uint32 maxLength = _vm->_global->_inter_animDataSize * 4 - 1;
+	char  *str       = GET_VARO_STR(index);
+
+	switch (type) {
+	case TYPE_VAR_STR:
+		if (strlen(value) > maxLength)
+			warning("Inter_v7::storeString(): String too long");
+
+		Common::strlcpy(str, value, maxLength);
+		break;
+
+	case TYPE_IMM_INT8:
+	case TYPE_VAR_INT8:
+		strcpy(str, value);
+		break;
+
+	case TYPE_ARRAY_INT8:
+		WRITE_VARO_UINT8(index, atoi(value));
+		break;
+
+	case TYPE_VAR_INT16:
+	case TYPE_VAR_INT32_AS_INT16:
+	case TYPE_ARRAY_INT16:
+		WRITE_VARO_UINT16(index, atoi(value));
+		break;
+
+	case TYPE_VAR_INT32:
+	case TYPE_ARRAY_INT32:
+		WRITE_VARO_UINT32(index, atoi(value));
+		break;
+
+	default:
+		warning("Inter_v7::storeString(): Requested to store a string into type %d", type);
+		break;
+	}
+}
+
+void Inter::storeString(const char *value) {
+	uint16 type;
+	uint16 varIndex = _vm->_game->_script->readVarIndex(0, &type);
+
+	storeString(varIndex, type, value);
+}
+
 } // End of namespace Gob

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2011-02-04 15:42:58 UTC (rev 55765)
+++ scummvm/trunk/engines/gob/inter.h	2011-02-04 15:53:44 UTC (rev 55766)
@@ -156,6 +156,12 @@
 	void o_drawNOP() {}
 	void o_funcNOP(OpFuncParams &params) {}
 	void o_gobNOP(OpGobParams &params) {}
+
+	void storeValue(uint16 index, uint16 type, uint32 value);
+	void storeValue(uint32 value);
+
+	void storeString(uint16 index, uint16 type, const char *value);
+	void storeString(const char *value);
 };
 
 class Inter_v1 : public Inter {
@@ -630,12 +636,6 @@
 	INIConfig _inis;
 	Databases _databases;
 
-	void storeValue(uint16 index, uint16 type, uint32 value);
-	void storeValue(uint32 value);
-
-	void storeString(uint16 index, uint16 type, const char *value);
-	void storeString(const char *value);
-
 	Common::String findFile(const Common::String &mask);
 };
 

Modified: scummvm/trunk/engines/gob/inter_v7.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v7.cpp	2011-02-04 15:42:58 UTC (rev 55765)
+++ scummvm/trunk/engines/gob/inter_v7.cpp	2011-02-04 15:53:44 UTC (rev 55766)
@@ -515,76 +515,6 @@
 	_vm->_game->_script->skip(2);
 }
 
-void Inter_v7::storeValue(uint16 index, uint16 type, uint32 value) {
-	switch (type) {
-	case OP_ARRAY_INT8:
-	case TYPE_VAR_INT8:
-		WRITE_VARO_UINT8(index, value);
-		break;
-
-	case TYPE_VAR_INT16:
-	case TYPE_VAR_INT32_AS_INT16:
-	case TYPE_ARRAY_INT16:
-		WRITE_VARO_UINT16(index, value);
-		break;
-
-	default:
-		WRITE_VARO_UINT32(index, value);
-	}
-}
-
-void Inter_v7::storeValue(uint32 value) {
-	uint16 type;
-	uint16 index = _vm->_game->_script->readVarIndex(0, &type);
-
-	storeValue(index, type, value);
-}
-
-void Inter_v7::storeString(uint16 index, uint16 type, const char *value) {
-	uint32 maxLength = _vm->_global->_inter_animDataSize * 4 - 1;
-	char  *str       = GET_VARO_STR(index);
-
-	switch (type) {
-	case TYPE_VAR_STR:
-		if (strlen(value) > maxLength)
-			warning("Inter_v7::storeString(): String too long");
-
-		Common::strlcpy(str, value, maxLength);
-		break;
-
-	case TYPE_IMM_INT8:
-	case TYPE_VAR_INT8:
-		strcpy(str, value);
-		break;
-
-	case TYPE_ARRAY_INT8:
-		WRITE_VARO_UINT8(index, atoi(value));
-		break;
-
-	case TYPE_VAR_INT16:
-	case TYPE_VAR_INT32_AS_INT16:
-	case TYPE_ARRAY_INT16:
-		WRITE_VARO_UINT16(index, atoi(value));
-		break;
-
-	case TYPE_VAR_INT32:
-	case TYPE_ARRAY_INT32:
-		WRITE_VARO_UINT32(index, atoi(value));
-		break;
-
-	default:
-		warning("Inter_v7::storeString(): Requested to store a string into type %d", type);
-		break;
-	}
-}
-
-void Inter_v7::storeString(const char *value) {
-	uint16 type;
-	uint16 varIndex = _vm->_game->_script->readVarIndex(0, &type);
-
-	storeString(varIndex, type, value);
-}
-
 void Inter_v7::o7_gob0x201(OpGobParams &params) {
 	uint16 varIndex = _vm->_game->_script->readUint16();
 


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