Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update (3.3.5-lfgsolo): core aligntment #116

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ if(SERVERS OR TOOLS)
add_subdirectory(openssl)
add_subdirectory(jemalloc)
add_subdirectory(argon2)
add_subdirectory(short_alloc)
endif()

if(SERVERS)
add_subdirectory(mysql)
add_subdirectory(readline)
add_subdirectory(gsoap)
add_subdirectory(efsw)
add_subdirectory(short_alloc)
endif()

if(TOOLS)
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GroupMgr.h"
#include "MiscPackets.h"
#include "Object.h"
#include "ObjectAccessor.h"
Expand Down Expand Up @@ -1042,6 +1043,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
group = new Group;
SetBgRaid(team, group);
group->Create(player);
sGroupMgr->AddGroup(group);
}
else // raid already exist
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
joinData.result = LFG_JOIN_NOT_MEET_REQS;
else if (grp)
{
if (grp->GetMembersCount() > MAXGROUPSIZE)
if (grp->GetMembersCount() > MAX_GROUP_SIZE)
joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS;
else
{
Expand Down
12 changes: 6 additions & 6 deletions src/server/game/DungeonFinding/LFGQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
LfgRolesMap proposalRoles;

// Check for correct size
if (check.size() > MAXGROUPSIZE || check.empty())
if (check.size() > MAX_GROUP_SIZE || check.empty())
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}): Size wrong - Not compatibles", GetDetailedMatchRoles(check));
return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE;
Expand All @@ -396,7 +396,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
// Check if more than one LFG group and number of players joining
uint8 numPlayers = 0;
uint8 numLfgGroups = 0;
for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
for (GuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAX_GROUP_SIZE; ++it)
{
ObjectGuid guid = *it;
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
Expand All @@ -421,8 +421,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
}
}

// Group with less that MAXGROUPSIZE members always compatible
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) //solo lfg
// Group with less that MAX_GROUP_SIZE members always compatible
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) single group. Compatibles", GetDetailedMatchRoles(check));
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
Expand All @@ -443,7 +443,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
}

if (numPlayers > MAXGROUPSIZE)
if (numPlayers > MAX_GROUP_SIZE)
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Too many players ({})", GetDetailedMatchRoles(check), numPlayers);
SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS);
Expand Down Expand Up @@ -520,7 +520,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
}

// Enough players?
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) //solo lfg
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Compatibles but not enough players({})", GetDetailedMatchRoles(check), numPlayers);
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
Expand Down
4 changes: 3 additions & 1 deletion src/server/game/Entities/Creature/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,9 @@ void Creature::setDeathState(DeathState s)

Motion_Initialize();
Unit::setDeathState(ALIVE);
LoadCreaturesAddon();

if (!IsPet())
LoadCreaturesAddon();
}
}

Expand Down
14 changes: 2 additions & 12 deletions src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,19 +1011,9 @@ void WorldObject::setActive(bool on)
return;

if (on)
{
if (GetTypeId() == TYPEID_UNIT)
map->AddToActive(ToCreature());
else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
map->AddToActive((DynamicObject*)this);
}
map->AddToActive(this);
else
{
if (GetTypeId() == TYPEID_UNIT)
map->RemoveFromActive(ToCreature());
else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
map->RemoveFromActive((DynamicObject*)this);
}
map->RemoveFromActive(this);
}

void WorldObject::SetFarVisible(bool on)
Expand Down
1 change: 0 additions & 1 deletion src/server/game/Entities/Pet/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,6 @@ bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32
SetPhaseMask(phaseMask, false);
Object::_Create(guidlow, petId, HighGuid::Pet);

m_spawnId = guidlow;
m_originalEntry = Entry;

if (!InitEntry(Entry))
Expand Down
3 changes: 1 addition & 2 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4512,8 +4512,7 @@ void Player::BuildPlayerRepop()
// there must be SMSG.STOP_MIRROR_TIMER

// the player cannot have a corpse already on current map, only bones which are not returned by GetCorpse
WorldLocation corpseLocation = GetCorpseLocation();
if (corpseLocation.GetMapId() == GetMapId())
if (GetCorpseLocation().GetMapId() == GetMapId())
{
TC_LOG_ERROR("entities.player", "Player::BuildPlayerRepop: Player '{}' ({}) already has a corpse", GetName(), GetGUID().ToString());
return;
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void KillPlayer();
static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans);
bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
WorldLocation GetCorpseLocation() const { return _corpseLocation; }
WorldLocation const& GetCorpseLocation() const { return _corpseLocation; }
uint32 GetResurrectionSpellId();
void ResurrectPlayer(float restore_percent, bool applySickness = false);
void BuildPlayerRepop();
Expand Down
27 changes: 7 additions & 20 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
ASSERT(!m_cleanupDone);
m_ownedAuras.emplace(aura->GetId(), aura);

_RemoveNoStackAurasDueToAura(aura);
_RemoveNoStackAurasDueToAura(aura, true);

if (aura->IsRemoved())
return;
Expand Down Expand Up @@ -3363,7 +3363,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
{
Aura* aura = aurApp->GetBase();

_RemoveNoStackAurasDueToAura(aura);
_RemoveNoStackAurasDueToAura(aura, false);

if (aurApp->GetRemoveMode())
return;
Expand Down Expand Up @@ -3517,7 +3517,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode)
ABORT();
}

void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
void Unit::_RemoveNoStackAurasDueToAura(Aura* aura, bool owned)
{
SpellInfo const* spellProto = aura->GetSpellInfo();

Expand All @@ -3531,23 +3531,10 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
return;
}

bool remove = false;
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
{
if (remove)
{
remove = false;
i = m_appliedAuras.begin();
}

if (aura->CanStackWith(i->second->GetBase()))
continue;

RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
if (i == m_appliedAuras.end())
break;
remove = true;
}
if (owned)
RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AURA_REMOVE_BY_DEFAULT);
else
RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AURA_REMOVE_BY_DEFAULT);
}

void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Unit/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ class TC_GAME_API Unit : public WorldObject
void _ApplyAura(AuraApplication* aurApp, uint8 effMask);
void _UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMode);
void _UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode);
void _RemoveNoStackAurasDueToAura(Aura* aura);
void _RemoveNoStackAurasDueToAura(Aura* aura, bool owned);
void _RegisterAuraEffect(AuraEffect* aurEff, bool apply);

// m_ownedAuras container management
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Entities/Unit/UnitDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ enum UnitFlags : uint32
UNIT_FLAG_SILENCED | UNIT_FLAG_NON_ATTACKABLE_2 | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED |
UNIT_FLAG_IN_COMBAT | UNIT_FLAG_ON_TAXI | UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING |
UNIT_FLAG_POSSESSED | UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_UNK_28 |
UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_SHEATHE | UNIT_FLAG_IMMUNE),
UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_SHEATHE | UNIT_FLAG_IMMUNE), // SKIP

UNIT_FLAG_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG_DISALLOWED)
UNIT_FLAG_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG_DISALLOWED) // SKIP
};

DEFINE_ENUM_FLAG(UnitFlags);
Expand Down Expand Up @@ -222,9 +222,9 @@ enum UnitFlags2 : uint32
/* UNIT_FLAG2_PLAY_DEATH_ANIM | */ UNIT_FLAG2_ALLOW_CHEAT_SPELLS | UNIT_FLAG2_UNUSED_1 |
UNIT_FLAG2_UNUSED_2 | UNIT_FLAG2_UNUSED_3 | UNIT_FLAG2_UNUSED_4 | UNIT_FLAG2_UNUSED_5 |
UNIT_FLAG2_UNUSED_6 | UNIT_FLAG2_UNUSED_7 | UNIT_FLAG2_UNUSED_8 | UNIT_FLAG2_UNUSED_9 |
UNIT_FLAG2_UNUSED_10 | UNIT_FLAG2_UNUSED_11 | UNIT_FLAG2_UNUSED_12 | UNIT_FLAG2_UNUSED_13),
UNIT_FLAG2_UNUSED_10 | UNIT_FLAG2_UNUSED_11 | UNIT_FLAG2_UNUSED_12 | UNIT_FLAG2_UNUSED_13), // SKIP

UNIT_FLAG2_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG2_DISALLOWED)
UNIT_FLAG2_ALLOWED = (0xFFFFFFFF & ~UNIT_FLAG2_DISALLOWED) // SKIP
};

DEFINE_ENUM_FLAG(UnitFlags2);
Expand Down
21 changes: 2 additions & 19 deletions src/server/game/Grids/ObjectGridLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,14 @@ class ObjectWorldLoader
uint32& i_corpses;
};

template<class T> void ObjectGridLoader::SetObjectCell(T* /*obj*/, CellCoord const& /*cellCoord*/) { }

template<> void ObjectGridLoader::SetObjectCell(Creature* obj, CellCoord const& cellCoord)
{
Cell cell(cellCoord);
obj->SetCurrentCell(cell);
}

template<> void ObjectGridLoader::SetObjectCell(GameObject* obj, CellCoord const& cellCoord)
void ObjectGridLoader::SetObjectCell(MapObject* obj, CellCoord const& cellCoord)
{
Cell cell(cellCoord);
obj->SetCurrentCell(cell);
}

template <class T>
void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* /*map*/, T *obj)
{
obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
obj->AddToWorld();
++count;
}

template <>
void AddObjectHelper(CellCoord &cell, CreatureMapType &m, uint32 &count, Map* map, Creature *obj)
void AddObjectHelper(CellCoord &cell, GridRefManager<T> &m, uint32 &count, Map* map, T *obj)
{
obj->AddToGrid(m);
ObjectGridLoader::SetObjectCell(obj, cell);
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Grids/ObjectGridLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "GridDefines.h"
#include "Cell.h"

class MapObject;
class ObjectWorldLoader;

class TC_GAME_API ObjectGridLoader
Expand All @@ -42,7 +43,7 @@ class TC_GAME_API ObjectGridLoader

void LoadN(void);

template<class T> static void SetObjectCell(T* obj, CellCoord const& cellCoord);
static void SetObjectCell(MapObject* obj, CellCoord const& cellCoord);

private:
Cell i_cell;
Expand Down
22 changes: 11 additions & 11 deletions src/server/game/Groups/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY
m_bgGroup(nullptr), m_bfGroup(nullptr), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(),
m_masterLooterGuid(), m_subGroupsCounts(nullptr), m_guid(), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0), m_isLeaderOffline(false)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
m_targetIcons[i].Clear();
}

Expand Down Expand Up @@ -232,7 +232,7 @@ void Group::LoadGroupFromDB(Field* fields)
m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32());
m_lootThreshold = ItemQualities(fields[3].GetUInt8());

for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
m_targetIcons[i].Set(fields[4 + i].GetUInt64());

m_groupType = GroupType(fields[12].GetUInt8());
Expand Down Expand Up @@ -401,7 +401,7 @@ bool Group::AddMember(Player* player)
bool groupFound = false;
for (; subGroup < MAX_RAID_SUBGROUPS; ++subGroup)
{
if (m_subGroupsCounts[subGroup] < MAXGROUPSIZE)
if (m_subGroupsCounts[subGroup] < MAX_GROUP_SIZE)
{
groupFound = true;
break;
Expand Down Expand Up @@ -438,7 +438,7 @@ bool Group::AddMember(Player* player)

if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
m_targetIcons[i].Clear();
}

Expand Down Expand Up @@ -1627,12 +1627,12 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)

void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid)
{
if (id >= TARGETICONCOUNT)
if (id >= TARGET_ICONS_COUNT)
return;

// clean other icons
if (targetGuid)
for (int i=0; i<TARGETICONCOUNT; ++i)
for (int i=0; i<TARGET_ICONS_COUNT; ++i)
if (m_targetIcons[i] == targetGuid)
SetTargetIcon(i, ObjectGuid::Empty, ObjectGuid::Empty);

Expand All @@ -1651,10 +1651,10 @@ void Group::SendTargetIconList(WorldSession* session)
if (!session)
return;

WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGET_ICONS_COUNT*9));
data << uint8(1); // list targets

for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i)
{
if (m_targetIcons[i].IsEmpty())
continue;
Expand Down Expand Up @@ -1972,7 +1972,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
// check for min / max count
uint32 memberscount = GetMembersCount();

if (memberscount > bgEntry->MaxGroupSize) // no MinPlayerCount for battlegrounds
if (memberscount > bgEntry->MAX_GROUP_SIZE) // no MinPlayerCount for battlegrounds
return ERR_BATTLEGROUND_NONE; // ERR_GROUP_JOIN_BATTLEGROUND_TOO_MANY handled on client side

// get a player as reference, to compare other players' stats to (arena team id, queue id based on level, etc.)
Expand Down Expand Up @@ -2387,7 +2387,7 @@ void Group::SetLfgRoles(ObjectGuid guid, uint8 roles)

bool Group::IsFull() const
{
return isRaidGroup() ? (m_memberSlots.size() >= MAXRAIDSIZE) : (m_memberSlots.size() >= MAXGROUPSIZE);
return isRaidGroup() ? (m_memberSlots.size() >= MAX_RAID_SIZE) : (m_memberSlots.size() >= MAX_GROUP_SIZE);
}

bool Group::isLFGGroup() const
Expand Down Expand Up @@ -2501,7 +2501,7 @@ bool Group::SameSubGroup(ObjectGuid guid1, MemberSlot const* slot2) const

bool Group::HasFreeSlotSubGroup(uint8 subgroup) const
{
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAXGROUPSIZE);
return (m_subGroupsCounts && m_subGroupsCounts[subgroup] < MAX_GROUP_SIZE);
}

uint8 Group::GetMemberGroup(ObjectGuid guid) const
Expand Down
Loading
Loading