Jump to content

[One] Problem in HomeMovementGenerator.cpp ?


Recommended Posts

Posted

Hello,

I don't know if this problem is only for me, but I had many crashes since the modification in this file in recent commit, because all creature don't necessarily have AI. So maybe it's useless but I post my patch to fix this problem in case anybody have the same issue :

my patch:

diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp
index b53f2c3..38ea935 100644
--- a/src/game/HomeMovementGenerator.cpp
+++ b/src/game/HomeMovementGenerator.cpp
@@ -99,8 +99,9 @@ void HomeMovementGenerator<Creature>::Finalize(Creature& owner)

        if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
            owner.ClearTemporaryFaction();

        owner.LoadCreatureAddon(true);
-        owner.AI()->JustReachedHome();
+        if(owner.AI())
+            owner.AI()->JustReachedHome();
    }
}

Posted

a HomeMMGen must be initialized onto an NPC which has if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))

then i_travel_timer might not be initialized, and hence could be (compiler dependend) 0

which would trigger the call in Finalize for owner.AI()->JustReachedHome

But I don't understand how this can happen (because after a creature is created it is expected that it has AI initialized.)

also I don't see why a HomeMMGen would be pushed in a place where the npc has UNIT_STAT_NOT_MOVE, and Finalized where no AI exists..

Posted

After some research, it seemed to happen with one of my custom scripted mob that uses "SimpleAI* ai = new SimpleAI(pCreature);" as its script. So it IS a personal problem, sorry for inconvenience ^_^. But I didn't have that problem before, so if my patch can help someone that use that kind of script too, I shared it.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use