[Scummvm-git-logs] scummvm master -> 31623f8ead7d417ac3c245cea631e1ab9213e940

a-yyg 76591232+a-yyg at users.noreply.github.com
Mon Jul 26 00:08:27 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
31623f8ead SAGA2: Fix weapon evaluation


Commit: 31623f8ead7d417ac3c245cea631e1ab9213e940
    https://github.com/scummvm/scummvm/commit/31623f8ead7d417ac3c245cea631e1ab9213e940
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-26T09:07:06+09:00

Commit Message:
SAGA2: Fix weapon evaluation

Changed paths:
    engines/saga2/task.cpp


diff --git a/engines/saga2/task.cpp b/engines/saga2/task.cpp
index 40c462fefd..20be181cce 100644
--- a/engines/saga2/task.cpp
+++ b/engines/saga2/task.cpp
@@ -3033,8 +3033,7 @@ TaskResult HuntToKillTask::update(void) {
 void HuntToKillTask::evaluateTarget(void) {
 	Actor               *a = stack->getActor();
 
-	if (flags & evalWeapon
-	        &&  a->isInterruptable() && currentTarget != NULL) {
+	if (flags & evalWeapon && a->isInterruptable()) {
 		evaluateWeapon();
 		flags &= ~evalWeapon;
 	}
@@ -3249,7 +3248,7 @@ void HuntToKillTask::evaluateWeapon(void) {
 		                                ? (WeaponProto *)currentWeapon->proto()
 		                                :   NULL;
 
-		if (currentWeapon == NULL
+		if (currentWeapon == NULL || currentTarget == NULL
 		        ||      weaponProto->weaponRating(
 		            a->thisID(),
 		            actorID,
@@ -3273,10 +3272,12 @@ void HuntToKillTask::evaluateWeapon(void) {
 			WeaponProto     *weaponProto = (WeaponProto *)proto;
 			int             weaponRating;
 
-			weaponRating =  weaponProto->weaponRating(
-			                    obj->thisID(),
-			                    actorID,
-			                    currentTarget->thisID());
+			if (currentTarget) {
+				weaponRating =  weaponProto->weaponRating(obj->thisID(),
+				                                          actorID,
+				                                          currentTarget->thisID());
+			} else
+				weaponRating = 0;
 
 			//  a rating of zero means this weapon is useless
 			if (weaponRating == 0) continue;




More information about the Scummvm-git-logs mailing list