Merge pull request #104 from H0zen/develop21

Various external fixes - part 7
This commit is contained in:
Antz 2016-03-24 18:01:46 +00:00
commit 32a4aad381
14 changed files with 53 additions and 24 deletions

View File

@ -66,7 +66,11 @@ typedef ACE_SHLIB_HANDLE MANGOS_LIBRARY_HANDLE;
#else // PLATFORM != PLATFORM_WINDOWS #else // PLATFORM != PLATFORM_WINDOWS
# define MANGOS_EXPORT export # define MANGOS_EXPORT export
# if defined(__APPLE_CC__) && defined(BIG_ENDIAN) # if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
# if (defined(__ppc__) || defined(__powerpc__))
# define MANGOS_IMPORT __attribute__ ((longcall)) # define MANGOS_IMPORT __attribute__ ((longcall))
# else
# define MANGOS_IMPORT
# endif
# elif defined(__x86_64__) # elif defined(__x86_64__)
# define MANGOS_IMPORT # define MANGOS_IMPORT
# else # else

View File

@ -140,6 +140,23 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
i_recheckDistance.Reset(this->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE ? 50 : 100); i_recheckDistance.Reset(this->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE ? 50 : 100);
G3D::Vector3 dest = owner.movespline->FinalDestination(); G3D::Vector3 dest = owner.movespline->FinalDestination();
targetMoved = RequiresNewPosition(owner, dest.x, dest.y, dest.z); targetMoved = RequiresNewPosition(owner, dest.x, dest.y, dest.z);
if (!targetMoved)
{
// This unit is in hitbox of target
// howewer we have to check if the target not moved a bit to update the orientation
// client do it automatically 'visually' but it need this new orientation send or it will retrieve old orientation in some case (like stun)
G3D::Vector3 currTargetPos;
i_target->GetPosition(currTargetPos.x, currTargetPos.y, currTargetPos.z);
if (owner.movespline->Finalized() && currTargetPos != m_prevTargetPos)
{
// position changed we need to adjust owner orientation to continue facing it
m_prevTargetPos = currTargetPos;
owner.SetInFront(i_target.getTarget()); // set movementinfo orientation, needed for next movement if any
float angle = owner.GetAngle(i_target.getTarget());
owner.SetFacingTo(angle); // inform client that orientation changed
}
}
} }
if (m_speedChanged || targetMoved) if (m_speedChanged || targetMoved)
@ -147,9 +164,6 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
if (owner.movespline->Finalized()) if (owner.movespline->Finalized())
{ {
if (i_angle == 0.f && !owner.HasInArc(0.01f, i_target.getTarget()))
{ owner.SetInFront(i_target.getTarget()); }
if (!i_targetReached) if (!i_targetReached)
{ {
i_targetReached = true; i_targetReached = true;
@ -199,6 +213,7 @@ void ChaseMovementGenerator<Player>::Initialize(Player& owner)
{ {
owner.addUnitState(UNIT_STAT_CHASE); // _MOVE set in _SetTargetLocation after required checks owner.addUnitState(UNIT_STAT_CHASE); // _MOVE set in _SetTargetLocation after required checks
_setTargetLocation(owner, true); _setTargetLocation(owner, true);
i_target->GetPosition(m_prevTargetPos.x, m_prevTargetPos.y, m_prevTargetPos.z);
} }
template<> template<>
@ -207,6 +222,7 @@ void ChaseMovementGenerator<Creature>::Initialize(Creature& owner)
owner.SetWalk(false, false); // Chase movement is running owner.SetWalk(false, false); // Chase movement is running
owner.addUnitState(UNIT_STAT_CHASE); // _MOVE set in _SetTargetLocation after required checks owner.addUnitState(UNIT_STAT_CHASE); // _MOVE set in _SetTargetLocation after required checks
_setTargetLocation(owner, true); _setTargetLocation(owner, true);
i_target->GetPosition(m_prevTargetPos.x, m_prevTargetPos.y, m_prevTargetPos.z);
} }
template<class T> template<class T>

View File

@ -27,6 +27,7 @@
#include "MovementGenerator.h" #include "MovementGenerator.h"
#include "FollowerReference.h" #include "FollowerReference.h"
#include "G3D/Vector3.h"
class PathFinder; class PathFinder;
@ -71,9 +72,9 @@ class TargetedMovementGeneratorMedium
ShortTimeTracker i_recheckDistance; ShortTimeTracker i_recheckDistance;
float i_offset; float i_offset;
float i_angle; float i_angle;
G3D::Vector3 m_prevTargetPos;
bool m_speedChanged : 1; bool m_speedChanged : 1;
bool i_targetReached : 1; bool i_targetReached : 1;
PathFinder* i_path; PathFinder* i_path;
}; };

View File

@ -1086,6 +1086,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->HandleEmote(action.emoteTarget.emoteId); m_creature->HandleEmote(action.emoteTarget.emoteId);
break; break;
} }
default:
break;
} }
} }
@ -1126,11 +1128,11 @@ void CreatureEventAI::Reset()
i->Enabled = true; i->Enabled = true;
break; break;
} }
// default: default:
// TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro() // TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro()
//i->Enabled = true; //i->Enabled = true;
//i->Time = 0; //i->Time = 0;
// break; break;
} }
} }
} }

View File

@ -241,7 +241,7 @@ namespace MaNGOS
namespace XP namespace XP
{ {
typedef enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY } XPColorChar; enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY };
inline uint32 GetGrayLevel(uint32 pl_level) inline uint32 GetGrayLevel(uint32 pl_level)
{ {

View File

@ -252,7 +252,7 @@ void PlayerLogger::StartLogging(PlayerLogEntity entity)
uint32 PlayerLogger::Stop(PlayerLogEntity entity) uint32 PlayerLogger::Stop(PlayerLogEntity entity)
{ {
SetLogActiveMask(entity, false); SetLogActiveMask(entity, false);
sLog.outDebug("PlayerLogger: logging type %u stopped for player %u at %u records.", entity, playerGuid, data[entity]->size()); sLog.outDebug("PlayerLogger: logging type %u stopped for player %u at %lu records.", entity, playerGuid, data[entity]->size());
return data[entity]->size(); return data[entity]->size();
} }

View File

@ -4447,7 +4447,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
if (questStart) if (questStart)
{ {
// not in expected required quest state // not in expected required quest state
if ((!questStartCanActive || !player->IsActiveQuest(questStart)) || player->GetQuestRewardStatus(questStart)) if ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart))
{ return false; } { return false; }
} }

View File

@ -3139,8 +3139,6 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed) void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed)
{ {
MANGOS_ASSERT(spellType < CURRENT_MAX_SPELL);
if (m_currentSpells[spellType] && (withDelayed || m_currentSpells[spellType]->getState() != SPELL_STATE_DELAYED)) if (m_currentSpells[spellType] && (withDelayed || m_currentSpells[spellType]->getState() != SPELL_STATE_DELAYED))
{ {
// send autorepeat cancel message for autorepeat spells // send autorepeat cancel message for autorepeat spells
@ -5307,7 +5305,7 @@ Unit* Unit::_GetTotem(TotemSlot slot) const
Totem* Unit::GetTotem(TotemSlot slot) const Totem* Unit::GetTotem(TotemSlot slot) const
{ {
if (slot >= MAX_TOTEM_SLOT || !IsInWorld() || !m_TotemSlot[slot]) if (!IsInWorld() || !m_TotemSlot[slot])
{ return NULL; } { return NULL; }
Creature* totem = GetMap()->GetCreature(m_TotemSlot[slot]); Creature* totem = GetMap()->GetCreature(m_TotemSlot[slot]);
@ -8812,8 +8810,8 @@ float Unit::GetObjectScaleMod() const
// TODO:: not sure we have to do this sanity check, less than /100 or more than *100 seem not reasonable // TODO:: not sure we have to do this sanity check, less than /100 or more than *100 seem not reasonable
if (result < 0.01f) if (result < 0.01f)
{ result = 0.01f; } { result = 0.01f; }
else if (result > 100) else if (result > 100.0f)
{ result = 100; } { result = 100.0f; }
return result; return result;
} }

View File

@ -379,11 +379,10 @@ enum BaseModGroup
enum BaseModType enum BaseModType
{ {
FLAT_MOD, FLAT_MOD,
PCT_MOD PCT_MOD,
MOD_END,
}; };
#define MOD_END (PCT_MOD+1)
enum DeathState enum DeathState
{ {
ALIVE = 0, ///< show as alive ALIVE = 0, ///< show as alive

View File

@ -822,9 +822,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
time_t mutetime = time_t (fields[7].GetUInt64()); time_t mutetime = time_t (fields[7].GetUInt64());
locale = LocaleConstant(fields[8].GetUInt8()); uint8 tmpLoc = fields[8].GetUInt8();
if (locale >= MAX_LOCALE) if (tmpLoc >= MAX_LOCALE)
{ locale = LOCALE_enUS; } { locale = LOCALE_enUS; }
else
{ locale = LocaleConstant(tmpLoc); }
os = fields[9].GetString(); os = fields[9].GetString();

View File

@ -23,7 +23,6 @@
*/ */
#include "MapPersistentStateMgr.h" #include "MapPersistentStateMgr.h"
#include "SQLStorages.h" #include "SQLStorages.h"
#include "Player.h" #include "Player.h"
#include "GridNotifiers.h" #include "GridNotifiers.h"
@ -41,6 +40,7 @@
#include "Group.h" #include "Group.h"
#include "InstanceData.h" #include "InstanceData.h"
#include "ProgressBar.h" #include "ProgressBar.h"
#include <vector>
INSTANTIATE_SINGLETON_1(MapPersistentStateManager); INSTANTIATE_SINGLETON_1(MapPersistentStateManager);
@ -896,9 +896,14 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32
} }
// remove all binds for online player // remove all binds for online player
std::vector<DungeonPersistentState*> unbindList;
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr) for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
if (itr->second->GetMapId() == mapid) if (itr->second->GetMapId() == mapid)
((DungeonPersistentState*)(itr->second))->UnbindThisState(); unbindList.push_back((DungeonPersistentState*)itr->second);
for (std::vector<DungeonPersistentState*>::const_iterator it = unbindList.begin(); it != unbindList.end(); ++it)
(*it)->UnbindThisState();
// reset maps, teleport player automaticaly to their homebinds and unload maps // reset maps, teleport player automaticaly to their homebinds and unload maps
MapPersistantStateResetWorker worker; MapPersistantStateResetWorker worker;

View File

@ -74,7 +74,7 @@ struct MassMailerQueryHandler
void MassMailMgr::AddMassMailTask(MailDraft* mailProto, const MailSender &sender, char const* query) void MassMailMgr::AddMassMailTask(MailDraft* mailProto, const MailSender &sender, char const* query)
{ {
CharacterDatabase.AsyncPQuery(&massMailerQueryHandler, &MassMailerQueryHandler::HandleQueryCallback, mailProto, sender, query); CharacterDatabase.AsyncPQuery(&massMailerQueryHandler, &MassMailerQueryHandler::HandleQueryCallback, mailProto, sender, "%s", query);
} }
void MassMailMgr::Update(bool sendall /*= false*/) void MassMailMgr::Update(bool sendall /*= false*/)

View File

@ -4074,6 +4074,8 @@ void Aura::HandleShapeshiftBoosts(bool apply)
case FORM_CREATURECAT: case FORM_CREATURECAT:
case FORM_CREATUREBEAR: case FORM_CREATUREBEAR:
break; break;
default:
break;
} }
if (apply) if (apply)

@ -1 +1 @@
Subproject commit d6cbadfec9037c160a28ec72fac9e2ebe276195a Subproject commit e3dd72d27b24168db3057a609af9884de5f10da4