diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Map.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index eab7c67f778..11bfdcd6f99 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -3070,14 +3070,21 @@ void Map::ScriptsProcess() break; } - if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount()) + Creature* cSource = source->ToCreature() != NULL ? source->ToCreature() : target->ToCreature(); + if (!cSource) + { + sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id: %u) call for non-creature source.", step.script->id); + break; + } + + if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= cSource->GetValuesCount()) { sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id: %u) call for wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u).", step.script->id, step.script->datalong,source->GetValuesCount(),source->GetTypeId(),source->GetEntry(),source->GetGUIDLow()); break; } - source->SetFlag(step.script->datalong, step.script->datalong2); + cSource->SetFlag(step.script->datalong, step.script->datalong2); break; } @@ -3088,14 +3095,22 @@ void Map::ScriptsProcess() sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id: %u) call for NULL object.", step.script->id); break; } - if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= source->GetValuesCount()) + + Creature* cSource = source->ToCreature() != NULL ? source->ToCreature() : target->ToCreature(); + if (!cSource) + { + sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id: %u) call for non-creature source.", step.script->id); + break; + } + + if (step.script->datalong <= OBJECT_FIELD_ENTRY || step.script->datalong >= cSource->GetValuesCount()) { sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id: %u) call for wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u).", step.script->id, step.script->datalong,source->GetValuesCount(),source->GetTypeId(),source->GetEntry(),source->GetGUIDLow()); break; } - source->RemoveFlag(step.script->datalong, step.script->datalong2); + cSource->RemoveFlag(step.script->datalong, step.script->datalong2); break; } |
