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

spalek at users.sourceforge.net spalek at users.sourceforge.net
Sun Nov 8 07:30:11 CET 2009


Revision: 45747
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45747&view=rev
Author:   spalek
Date:     2009-11-08 06:30:10 +0000 (Sun, 08 Nov 2009)

Log Message:
-----------
Do not immediately clear the path when it has just 1 vertex.

This fixes the previous bugfix, which causes that I could not re-run the same
program (e.g., by repeatedly clicking on the hollow tree) if the hero did not
move at least one pixel.

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

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-11-08 06:16:25 UTC (rev 45746)
+++ scummvm/trunk/engines/draci/game.cpp	2009-11-08 06:30:10 UTC (rev 45747)
@@ -443,7 +443,7 @@
 	// proper timing.
 	bool walkingFinished = false;
 	if (_walkingState.isActive()) {
-		walkingFinished = !_walkingState.continueWalking();
+		walkingFinished = !_walkingState.continueWalkingOrClearPath();
 	}
 
 	// Advance animations (this may also call setExitLoop(true) in the

Modified: scummvm/trunk/engines/draci/walking.cpp
===================================================================
--- scummvm/trunk/engines/draci/walking.cpp	2009-11-08 06:16:25 UTC (rev 45746)
+++ scummvm/trunk/engines/draci/walking.cpp	2009-11-08 06:30:10 UTC (rev 45747)
@@ -493,6 +493,14 @@
 	_vm->_mouse->cursorOn();
 }
 
+bool WalkingState::continueWalkingOrClearPath() {
+	const bool stillWalking = continueWalking();
+	if (!stillWalking) {
+		_path.clear();
+	}
+	return stillWalking;
+}
+
 bool WalkingState::continueWalking() {
 	const GameObject *dragon = _vm->_game->getObject(kDragonObject);
 	const Movement movement = static_cast<Movement> (_vm->_game->playingObjectAnimation(dragon));
@@ -513,7 +521,6 @@
 	// has just 1 vertex and startWalking() leaves the path open.
 	// Finishing and nontrivial path will get caught earlier.
 	if (_segment >= _path.size()) {
-		_path.clear();
 		return false;
 	}
 
@@ -650,7 +657,6 @@
 	} else {
 		// Otherwise we are done.  continueWalking() will return false next time.
 		debugC(2, kDraciWalkingDebugLevel, "We have walked the whole path");
-		_path.clear();
 		return false;
 	}
 }

Modified: scummvm/trunk/engines/draci/walking.h
===================================================================
--- scummvm/trunk/engines/draci/walking.h	2009-11-08 06:16:25 UTC (rev 45746)
+++ scummvm/trunk/engines/draci/walking.h	2009-11-08 06:30:10 UTC (rev 45747)
@@ -120,9 +120,11 @@
 
 	// Advances the hero along the path and changes animation accordingly.
 	// Walking MUST be active when calling this method.  When the hero has
-	// arrived to the target, clears the path and returns false, but leaves
-	// the callback untouched (the caller must call it).
+	// arrived to the target, returns false, but leaves the callback
+	// untouched (the caller must call it).
+	// The second variant also clears the path when returning false.
 	bool continueWalking();
+	bool continueWalkingOrClearPath();
 
 	// Called when the hero's turning animation has finished.
 	void heroAnimationFinished();


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