From 4294185c595bd92e5280ea057c72519c91c1975a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 14 Nov 2008 17:51:48 +0000 Subject: Some corrections, based on observations from bug report #2284298 - "SAGA: Compiler warnings; possibly an engine bug" svn-id: r35058 --- engines/saga/animation.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'engines/saga') diff --git a/engines/saga/animation.h b/engines/saga/animation.h index a88d743af1..1127028718 100644 --- a/engines/saga/animation.h +++ b/engines/saga/animation.h @@ -164,14 +164,17 @@ private: void validateAnimationId(uint16 animId) { if (animId >= MAX_ANIMATIONS) { + // Cutaway if (animId >= MAX_ANIMATIONS + ARRAYSIZE(_cutawayAnimations)) error("validateAnimationId: animId out of range"); if (_cutawayAnimations[animId - MAX_ANIMATIONS] == NULL) { error("validateAnimationId: animId=%i unassigned", animId); } - } - if (_animations[animId] == NULL) { - error("validateAnimationId: animId=%i unassigned.", animId); + } else { + // Animation + if (_animations[animId] == NULL) { + error("validateAnimationId: animId=%i unassigned.", animId); + } } } @@ -184,7 +187,7 @@ private: AnimationData* getAnimation(uint16 animId) { validateAnimationId(animId); - if (animId > MAX_ANIMATIONS) + if (animId >= MAX_ANIMATIONS) return _cutawayAnimations[animId - MAX_ANIMATIONS]; return _animations[animId]; } -- cgit v1.2.3