[Scummvm-cvs-logs] SF.net SVN: scummvm:[38902] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Feb 26 15:42:03 CET 2009


Revision: 38902
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38902&view=rev
Author:   peres001
Date:     2009-02-26 14:42:03 +0000 (Thu, 26 Feb 2009)

Log Message:
-----------
changeLocation now uses the internal variable _newLocationName instead of an input parameter.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2009-02-26 13:54:21 UTC (rev 38901)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2009-02-26 14:42:03 UTC (rev 38902)
@@ -338,7 +338,7 @@
 		return;
 
 	if (_engineFlags & kEngineChangeLocation) {
-		changeLocation(_location._name);
+		changeLocation();
 	}
 
 	_programExec->runScripts(_location._programs.begin(), _location._programs.end());
@@ -954,7 +954,7 @@
 
 void Parallaction::scheduleLocationSwitch(const char *location) {
 	debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location);
-	strcpy(_location._name, location);
+	_newLocationName = location;
 	_engineFlags |= kEngineChangeLocation;
 }
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2009-02-26 13:54:21 UTC (rev 38901)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2009-02-26 14:42:03 UTC (rev 38902)
@@ -291,6 +291,7 @@
 	char			_characterName1[50];	// only used in changeCharacter
 	ZonePtr			_zoneTrap;
 	ZonePtr			_commentZone;
+	Common::String  _newLocationName;
 
 protected:
 	void	runGame();
@@ -352,7 +353,7 @@
 	void 		closeInventory();
 
 	virtual void parseLocation(const char* name) = 0;
-	virtual void changeLocation(char *location) = 0;
+	virtual void changeLocation() = 0;
 	virtual void changeCharacter(const char *name) = 0;
 	virtual	void callFunction(uint index, void* parm) = 0;
 	virtual void runPendingZones() = 0;
@@ -376,7 +377,7 @@
 
 public:
 	virtual void parseLocation(const char *filename);
-	virtual void changeLocation(char *location);
+	virtual void changeLocation();
 	virtual void changeCharacter(const char *name);
 	virtual void callFunction(uint index, void* parm);
 	virtual void runPendingZones();
@@ -474,7 +475,7 @@
 
 public:
 	virtual void parseLocation(const char* name);
-	virtual void changeLocation(char *location);
+	virtual void changeLocation();
 	virtual void changeCharacter(const char *name);
 	virtual	void callFunction(uint index, void* parm);
 	virtual void runPendingZones();

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-26 13:54:21 UTC (rev 38901)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2009-02-26 14:42:03 UTC (rev 38902)
@@ -224,14 +224,20 @@
 }
 
 
-void Parallaction_br::changeLocation(char *location) {
+void Parallaction_br::changeLocation() {
+    if (_newLocationName.empty()) {
+        return;
+    }
+
+    char location[200];
+    strcpy(location, _newLocationName.c_str());
+
 	char *partStr = strrchr(location, '.');
 	if (partStr) {
 		cleanupGame();
 
 		int n = partStr - location;
-		strncpy(_location._name, location, n);
-		_location._name[n] = '\0';
+		location[n] = '\0';
 
 		_part = atoi(++partStr);
 		if (getFeatures() & GF_DEMO) {
@@ -260,6 +266,7 @@
 
 	freeLocation(false);
 	// load new location
+	strcpy(_location._name, location);
 	parseLocation(location);
 
 	if (_location._startPosition.x != -1000) {
@@ -293,6 +300,7 @@
 	_cmdExec->run(_location._aCommands);
 
 	_engineFlags &= ~kEngineChangeLocation;
+	_newLocationName.clear();
 }
 
 // FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2009-02-26 13:54:21 UTC (rev 38901)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2009-02-26 14:42:03 UTC (rev 38902)
@@ -288,7 +288,15 @@
 //	changeLocation handles transitions between locations, and is able to display slides
 //	between one and the other.
 //
-void Parallaction_ns::changeLocation(char *location) {
+void Parallaction_ns::changeLocation() {
+    if (_newLocationName.empty()) {
+        return;
+    }
+
+    char location[200];
+    strcpy(location, _newLocationName.c_str());
+    strcpy(_location._name, _newLocationName.c_str());
+
 	debugC(1, kDebugExec, "changeLocation(%s)", location);
 
 	MouseTriState oldMouseState = _input->getMouseState();
@@ -368,6 +376,7 @@
 	}
 
 	debugC(1, kDebugExec, "changeLocation() done");
+	_newLocationName.clear();
 }
 
 


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