aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-05-06 20:55:33 +0000
committerJohannes Schickel2008-05-06 20:55:33 +0000
commit5abc85bd0e4e0801e7774e0f3efffcc6213ae88e (patch)
tree6082a5bb5d59a2a9d4884f841e03c3c8a5ab96f7 /engines/kyra
parent11f891963bec97357b69e2e0f4b1639808becab3 (diff)
downloadscummvm-rg350-5abc85bd0e4e0801e7774e0f3efffcc6213ae88e.tar.gz
scummvm-rg350-5abc85bd0e4e0801e7774e0f3efffcc6213ae88e.tar.bz2
scummvm-rg350-5abc85bd0e4e0801e7774e0f3efffcc6213ae88e.zip
Fixed possible crash in Debugger_v2 when using 'give'.
svn-id: r31907
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/debugger.cpp5
-rw-r--r--engines/kyra/kyra_hof.cpp5
-rw-r--r--engines/kyra/kyra_mr.cpp5
-rw-r--r--engines/kyra/kyra_v2.h3
4 files changed, 13 insertions, 5 deletions
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);