[Scummvm-git-logs] scummvm master -> 72234ecd8b52f47920b1eb0e76d827c614cfb9db
sev-
noreply at scummvm.org
Wed Mar 1 18:03:18 UTC 2023
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:
72234ecd8b SAGA2: fix wrong spellid crash
Commit: 72234ecd8b52f47920b1eb0e76d827c614cfb9db
https://github.com/scummvm/scummvm/commit/72234ecd8b52f47920b1eb0e76d827c614cfb9db
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-03-01T19:03:14+01:00
Commit Message:
SAGA2: fix wrong spellid crash
Changed paths:
engines/saga2/magic.cpp
diff --git a/engines/saga2/magic.cpp b/engines/saga2/magic.cpp
index 2206ad7080c..0b7a319ef00 100644
--- a/engines/saga2/magic.cpp
+++ b/engines/saga2/magic.cpp
@@ -93,8 +93,15 @@ GameObject *GetOwner(GameObject *go) {
// This call looks up a spells object prototype. It can accept either
// an object ID or a spell ID
SkillProto *skillProtoFromID(int16 spellOrObjectID) {
+ SkillProto *sProto = (SkillProto *)GameObject::protoAddress(spellOrObjectID);
if (spellOrObjectID > MAX_SPELLS)
- return (SkillProto *)GameObject::protoAddress(spellOrObjectID);
+ return sProto;
+
+ // Can be spellId, check if this the prototype returned by spellOrObjectID refers to a spell
+ int16 manaColor = spellBook[sProto->getSpellID()].getManaType();
+ int16 manaCost = spellBook[sProto->getSpellID()].getManaAmt();
+ if (manaColor >= ksManaIDRed && manaColor <= ksManaIDViolet && manaCost > 0) // A spell
+ return sProto;
if (spellOrObjectID >= kTotalSpellBookPages)
error("Wrong spellID: %d > %d", spellOrObjectID, kTotalSpellBookPages);
More information about the Scummvm-git-logs
mailing list