Core/Movement: Fix invalid memory access

Fix the stack implementation used in MotionMaster and added few sanity checks to ensure no underflows will be made.

Valgrind log:
 Invalid read of size 8
  at : MotionMaster::top() const (MotionMaster.h:115)
  by : MotionMaster::pop() (MotionMaster.h:91)
  by : MotionMaster::~MotionMaster() (MotionMaster.cpp:74)
  by : Unit::~Unit() (Unit.cpp:296)
  by : Player::~Player() (Player.cpp:880)
  by : WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:665)
  by : WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:516)
Core/Player: Add another exception to questgiver spell casting.
Core/Misc: Fix some static analysis issues

Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
Core/Misc: Fix some static analysis issues

Fix some static analysis issues about uninitialized values.
Core/AI: Fix an issue where the OnQuestAccept hooks were not called for auto-completed quests.

Fixes #11304
Core/Quests: Fix an issue where auto-completed quests would not be automatically completed if the quest was added through either the SmartAI action_type SMART_ACTION_ADD_QUEST, the spell effect SPELL_EFFECT_QUEST_START or the opcode CMSG_QUEST_CONFIRM_ACCEPT. Also fixes auto-complete quests in the SAI and opcode case not calling the AI hook.
Scripts: fix crash in spell_jokkum_scriptcast

Closes #11313
Merge branch 'master' of github.com:TrinityCore/TrinityCore
Core/Player: Fix questgiver spell cast.
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into ghbb

Conflicts:
	src/server/game/Entities/Player/Player.cpp