diff options
author | Machiavelli <none@none> | 2010-06-02 18:43:11 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-06-02 18:43:11 +0200 |
commit | fb8399c4132b97f5637efb8dd7262050964f568a (patch) | |
tree | 17f93c1ff317dd82f286074b25bbcdfb2d8c9ad6 /src/game/ObjectMgr.cpp | |
parent | 60fd4a2f60c300b727d5daf721023ee403b8bf44 (diff) |
Few changes to *_scripts handling in core.
- Use pointers of most abstract classes possible where applicable.
- Don“t use dynamic_cast when casting possibility is already explicitly checked per typeid.
- Where applicable use the ToCreature() and ToPlayer() functions for typecasting.
- Fix functioning of SCRIPT_COMMAND_CAST_SPELL
- Fix possible crash in SCRIPT_COMMAND_KILL
- Always include script id in error messages.
- Added a few TODO comments.
These changesets were merged in from MaNGOS:
- [9576] Implement SCRIPT_COMMAND_CREATE_ITEM by NoFantasy
- [9577] Implement SCRIPT_COMMAND_DESPAWN_SELF by NoFantasy
- [9869] Extend SCRIPT_COMMAND_QUEST_EXPLORED to allow player<->player as
source/target by NoFantasy
--HG--
branch : trunk
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index acb5ca1c35e..c826c0ea441 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4429,11 +4429,11 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) tmp.o = fields[9].GetFloat(); // generic command args check - switch(tmp.command) + switch (tmp.command) { case SCRIPT_COMMAND_TALK: { - if (tmp.datalong > 4) + if (tmp.datalong > CHAT_TYPE_WHISPER) { sLog.outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id); continue; @@ -4631,6 +4631,23 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) } break; } + + case SCRIPT_COMMAND_CREATE_ITEM: + { + if (!GetItemPrototype(tmp.datalong)) + { + sLog.outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", + tablename, tmp.datalong, tmp.id); + continue; + } + if (!tmp.datalong2) + { + sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", + tablename, tmp.datalong2, tmp.id); + continue; + } + break; + } } if (scripts.find(tmp.id) == scripts.end()) @@ -4763,6 +4780,7 @@ void ObjectMgr::LoadEventScripts() } } } + // Then check if all scripts are in above list of possible script entries for (ScriptMapMap::const_iterator itr = sEventScripts.begin(); itr != sEventScripts.end(); ++itr) { |