arcemu/arcemu — pull request #20 by MesoX (2011-11-15 19:17:12+00:00)
Title: SpellFactoryMgr::AddSpellByNameHash not working

Hey all, I've just found that SpellFactoryMgr::AddSpellByNameHash is not working correctly and is never registered (thanks Neo_mat for the notice).

There is a logic error when core is starting up, just because SpellFactoryMgr::Setup() is called when creating new SpellFactoryMgr in World.cpp ( and from setup also also AddSpellByNameHash is called if there is any ), before name hashes are initialized for all spells.

This check is in function SpellFactoryMgr::AddSpellByNameHash

if(sp->NameHash != name_hash)
continue;

so in this case, sp->NameHash is empty string, because name hashes are initialized in function called ApplyNormalFixes(), which is obviously called AFTER creating this SpellFactory singleton.