From 74052020235cdb8b2a7b38806b238e44a98f4587 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 12 Apr 2012 15:44:41 +0200 Subject: Removed unused file --- .../shared/Dynamic/TypeContainerFunctionsPtr.h | 168 --------------------- 1 file changed, 168 deletions(-) delete mode 100755 src/server/shared/Dynamic/TypeContainerFunctionsPtr.h (limited to 'src') diff --git a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h b/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h deleted file mode 100755 index 2c065d96d4a..00000000000 --- a/src/server/shared/Dynamic/TypeContainerFunctionsPtr.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef TYPECONTAINER_FUNCTIONS_PTR_H -#define TYPECONTAINER_FUNCTIONS_PTR_H - -/* - * Here you'll find a list of helper functions to make - * the TypeContainer usefull. Without it, its hard - * to access or mutate the container. - */ - -#include "Platform/Define.h" -#include "Utilities/TypeList.h" -#include - -namespace Trinity -{ - /* ContainerMapList Helpers */ - // count functions - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return elements._element.size(); - // }; - // - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return 0; - // } - // - // template size_t Count(const ContainerMapList &elements, CountedPtr* /*fake*/) - // { - // return 0; - // } - // - // template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._elements, fake); - // } - // - // template size_t Count(const ContainerMapList >&elements, SPECIFIC_TYPE* fake) - // { - // return Count(elements._TailElements, fake); - // } - - // non-const find functions - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - typename std::map >::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// terminate recursion - } - - template CountedPtr& Find(ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// this is a missed - } - - template CountedPtr& Find(ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) - { - CountedPtr &t = Find(elements._elements, hdl, fake); - return (!t ? Find(elements._TailElements, hdl, fake) : t); - } - - // const find functions - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - typename CountedPtr::iterator iter = elements._element.find(hdl); - return (iter == elements._element.end() ? NullPtr((SPECIFIC_TYPE*)NULL) : iter->second); - }; - - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - template const CountedPtr& Find(const ContainerMapList &elements, OBJECT_HANDLE hdl, CountedPtr* /*fake*/) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - template CountedPtr& Find(const ContainerMapList >&elements, OBJECT_HANDLE hdl, CountedPtr* fake) - { - CountedPtr &t = Find(elements._elements, hdl, fake); - if (!t) - t = Find(elements._TailElement, hdl, fake); - - return t; - } - - // non-const insert functions - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - elements._element[hdl] = obj; - return obj; - }; - - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return NullPtr((SPECIFIC_TYPE*)NULL); - } - - // this is a missed - template CountedPtr& Insert(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return NullPtr((SPECIFIC_TYPE*)NULL);// a missed - } - - // Recursion - template CountedPtr& Insert(ContainerMapList >&elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - CountedPtr &t= Insert(elements._elements, obj, hdl); - return (!t ? Insert(elements._TailElements, obj, hdl) : t); - } - - // non-const remove method - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - typename std::map >::iterator iter = elements._element.find(hdl); - if ( iter != elements._element.end() ) - { - elements._element.erase(iter); - return true; - } - - return false; // found... terminate the search - } - - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return false; - } - - // this is a missed - template bool Remove(ContainerMapList &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - return false; - } - - template bool Remove(ContainerMapList > &elements, CountedPtr &obj, OBJECT_HANDLE hdl) - { - // The head element is bad - bool t = Remove(elements._elements, obj, hdl); - return ( !t ? Remove(elements._TailElements, obj, hdl) : t ); - } - -} -#endif - -- cgit v1.2.3 From 71bf2684be58f6fdaebaeb480385769bd5934c85 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 12 Apr 2012 17:53:34 +0200 Subject: Core/Script: Use DoMeleeAttackIfReady in default ScriptedAI::UpdateAI method (fixes offhand attacks if not UpdateAI is overridden) --- src/server/game/AI/CreatureAIImpl.h | 1 + src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index f568da80b49..98b0afdefc9 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -604,6 +604,7 @@ inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) { + // Why don't we check for casting unit_state and existing target as we do in DoCast(.. ? me->CastSpell(me->getVictim(), spellId, triggered); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 096ee695bcf..6d27d251579 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -114,15 +114,7 @@ void ScriptedAI::UpdateAI(uint32 const /*diff*/) if (!UpdateVictim()) return; - if (me->isAttackReady()) - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } void ScriptedAI::DoStartMovement(Unit* victim, float distance, float angle) -- cgit v1.2.3