From 5abc85bd0e4e0801e7774e0f3efffcc6213ae88e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 6 May 2008 20:55:33 +0000 Subject: Fixed possible crash in Debugger_v2 when using 'give'. svn-id: r31907 --- engines/kyra/debugger.cpp | 5 ++--- engines/kyra/kyra_hof.cpp | 5 ++++- engines/kyra/kyra_mr.cpp | 5 ++++- engines/kyra/kyra_v2.h | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'engines/kyra') diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index 51e4d17487..f90cf5a37b 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -421,9 +421,8 @@ bool Debugger_v2::cmd_giveItem(int argc, const char **argv) { if (argc == 2) { int item = atoi(argv[1]); - // Kyrandia 2 has only 178 items (-1 to 176), otherwise it will crash - if (item < -1 || item > 176) { - DebugPrintf("itemid must be any value between (including) -1 and 176\n"); + if (item < -1 || item > _vm->engineDesc().maxItemId) { + DebugPrintf("itemid must be any value between (including) -1 and %d\n", _vm->engineDesc().maxItemId); return true; } diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index c97bea4c93..693ae36d69 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -49,7 +49,10 @@ const KyraEngine_v2::EngineDesc KyraEngine_HoF::_hofEngineDesc = { 8, // Animation script specific - 33 + 33, + + // Item specific + 175 }; KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEngine_v2(system, flags, _hofEngineDesc), _updateFunctor(this, &KyraEngine_HoF::update) { diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index c54a3278dd..5e23813eb2 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -50,7 +50,10 @@ const KyraEngine_v2::EngineDesc KyraEngine_MR::_mrEngineDesc = { 9, // Animation script specific - 9 + 9, + + // Item specific + 71 }; KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngine_v2(system, flags, _mrEngineDesc) { diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index b8b7c843dd..639594e593 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -51,6 +51,9 @@ public: // Animation script specific const int animScriptFrameAdd; + + // Item specific + const int maxItemId; }; KyraEngine_v2(OSystem *system, const GameFlags &flags, const EngineDesc &desc); -- cgit v1.2.3