Fix some bugs with starting AI in mercs

The vtable ptr is that of the current constructor the code is in ...
This commit is contained in:
Michael Cook (mackal) 2015-01-27 19:53:13 -05:00
parent 7dcd12fb9d
commit a12011ca1e
4 changed files with 10 additions and 10 deletions

View File

@ -305,6 +305,8 @@ Client::Client(EQStreamInterface* ieqs)
active_light = innate_light; active_light = innate_light;
spell_light = equip_light = NOT_USED; spell_light = equip_light = NOT_USED;
AI_Init();
} }
Client::~Client() { Client::~Client() {

View File

@ -75,7 +75,6 @@ Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
SetMana(GetMaxMana()); SetMana(GetMaxMana());
SetEndurance(GetMaxEndurance()); SetEndurance(GetMaxEndurance());
AI_Init();
AI_Start(); AI_Start();
} }
@ -1737,7 +1736,6 @@ void Merc::AI_Process() {
} }
void Merc::AI_Start(int32 iMoveDelay) { void Merc::AI_Start(int32 iMoveDelay) {
NPC::AI_Start(iMoveDelay);
if (!pAIControlled) if (!pAIControlled)
return; return;

View File

@ -422,7 +422,8 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float
return false; return false;
} }
void Mob::AI_Init() { void Mob::AI_Init()
{
pAIControlled = false; pAIControlled = false;
AIthink_timer = nullptr; AIthink_timer = nullptr;
AIwalking_timer = nullptr; AIwalking_timer = nullptr;
@ -441,9 +442,8 @@ void Mob::AI_Init() {
pDontCureMeBefore = 0; pDontCureMeBefore = 0;
} }
void NPC::AI_Init() { void NPC::AI_Init()
Mob::AI_Init(); {
AIautocastspell_timer = nullptr; AIautocastspell_timer = nullptr;
casting_spell_AIindex = static_cast<uint8>(AIspells.size()); casting_spell_AIindex = static_cast<uint8>(AIspells.size());
@ -458,8 +458,8 @@ void NPC::AI_Init() {
roambox_delay = 2500; roambox_delay = 2500;
} }
void Client::AI_Init() { void Client::AI_Init()
Mob::AI_Init(); {
minLastFightingDelayMoving = CLIENT_LD_TIMEOUT; minLastFightingDelayMoving = CLIENT_LD_TIMEOUT;
maxLastFightingDelayMoving = CLIENT_LD_TIMEOUT; maxLastFightingDelayMoving = CLIENT_LD_TIMEOUT;
} }

View File

@ -250,7 +250,7 @@ NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int if
npc_aggro = d->npc_aggro; npc_aggro = d->npc_aggro;
if(!IsMerc()) AI_Init();
AI_Start(); AI_Start();
d_melee_texture1 = d->d_melee_texture1; d_melee_texture1 = d->d_melee_texture1;