Core/AI: Factory functions cleanup

- Get rid of fugly void pointers
- Streamlined AI selection code, using Permissible as it should've been instead of harcoded checks on the selector code
- Moved IdleMovementGenerator singleton to factory code
This commit is contained in:
ariel-
2017-06-01 02:29:20 -03:00
parent aeaa8ecfab
commit ce3787f190
34 changed files with 268 additions and 305 deletions

View File

@@ -595,13 +595,6 @@ void SmartAI::JustRespawned()
mFollowCreditType = 0;
}
int SmartAI::Permissible(const Creature* creature)
{
if (creature->GetAIName() == "SmartAI")
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
}
void SmartAI::JustReachedHome()
{
GetScript()->OnReset();
@@ -965,13 +958,6 @@ void SmartAI::CheckConditions(uint32 diff)
mConditionsTimer -= diff;
}
int SmartGameObjectAI::Permissible(const GameObject* g)
{
if (g->GetAIName() == "SmartGameObjectAI")
return PERMIT_BASE_SPECIAL;
return PERMIT_BASE_NO;
}
void SmartGameObjectAI::UpdateAI(uint32 diff)
{
GetScript()->OnUpdate(diff);

View File

@@ -160,7 +160,7 @@ class TC_GAME_API SmartAI : public CreatureAI
ObjectGuid GetGUID(int32 id = 0) const override;
//core related
static int Permissible(const Creature*);
static int32 Permissible(Creature const* /*creature*/) { return PERMIT_BASE_NO; }
// Called at movepoint reached
void MovepointReached(uint32 id);
@@ -257,7 +257,7 @@ class TC_GAME_API SmartGameObjectAI : public GameObjectAI
void InitializeAI() override;
void Reset() override;
SmartScript* GetScript() { return &mScript; }
static int Permissible(const GameObject* g);
static int32 Permissible(GameObject const* /*go*/) { return PERMIT_BASE_NO; }
bool GossipHello(Player* player, bool reportUse) override;
bool GossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override;