Skip to content

Commit d38acb9

Browse files
authored
Merge pull request #117 from acidmanifesto/lfg-solo-2
fix (3.3.5-Lfgsolo): Conflict\alignment
2 parents cd66511 + a19b766 commit d38acb9

34 files changed

+155
-175
lines changed

dep/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ if(SERVERS OR TOOLS)
2222
add_subdirectory(openssl)
2323
add_subdirectory(jemalloc)
2424
add_subdirectory(argon2)
25+
add_subdirectory(short_alloc)
2526
endif()
2627

2728
if(SERVERS)
2829
add_subdirectory(mysql)
2930
add_subdirectory(readline)
3031
add_subdirectory(gsoap)
3132
add_subdirectory(efsw)
32-
add_subdirectory(short_alloc)
3333
endif()
3434

3535
if(TOOLS)

src/server/game/Battlegrounds/Battleground.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "GameTime.h"
2828
#include "GridNotifiersImpl.h"
2929
#include "Group.h"
30+
#include "GroupMgr.h"
3031
#include "MiscPackets.h"
3132
#include "Object.h"
3233
#include "ObjectAccessor.h"
@@ -1042,6 +1043,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
10421043
group = new Group;
10431044
SetBgRaid(team, group);
10441045
group->Create(player);
1046+
sGroupMgr->AddGroup(group);
10451047
}
10461048
else // raid already exist
10471049
{

src/server/game/DungeonFinding/LFGMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
446446
joinData.result = LFG_JOIN_NOT_MEET_REQS;
447447
else if (grp)
448448
{
449-
if (grp->GetMembersCount() > MAXGROUPSIZE)
449+
if (grp->GetMembersCount() > MAX_GROUP_SIZE)
450450
joinData.result = LFG_JOIN_TOO_MUCH_MEMBERS;
451451
else
452452
{

src/server/game/DungeonFinding/LFGQueue.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
370370
LfgRolesMap proposalRoles;
371371

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

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

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

522522
// Enough players?
523-
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) //solo lfg
523+
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg
524524
{
525525
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Compatibles but not enough players({})", GetDetailedMatchRoles(check), numPlayers);
526526
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);

src/server/game/Entities/Creature/Creature.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,9 @@ void Creature::setDeathState(DeathState s)
20412041

20422042
Motion_Initialize();
20432043
Unit::setDeathState(ALIVE);
2044-
LoadCreaturesAddon();
2044+
2045+
if (!IsPet())
2046+
LoadCreaturesAddon();
20452047
}
20462048
}
20472049

src/server/game/Entities/Object/Object.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,19 +1011,9 @@ void WorldObject::setActive(bool on)
10111011
return;
10121012

10131013
if (on)
1014-
{
1015-
if (GetTypeId() == TYPEID_UNIT)
1016-
map->AddToActive(ToCreature());
1017-
else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
1018-
map->AddToActive((DynamicObject*)this);
1019-
}
1014+
map->AddToActive(this);
10201015
else
1021-
{
1022-
if (GetTypeId() == TYPEID_UNIT)
1023-
map->RemoveFromActive(ToCreature());
1024-
else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
1025-
map->RemoveFromActive((DynamicObject*)this);
1026-
}
1016+
map->RemoveFromActive(this);
10271017
}
10281018

10291019
void WorldObject::SetFarVisible(bool on)

src/server/game/Entities/Pet/Pet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,6 @@ bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32
18741874
SetPhaseMask(phaseMask, false);
18751875
Object::_Create(guidlow, petId, HighGuid::Pet);
18761876

1877-
m_spawnId = guidlow;
18781877
m_originalEntry = Entry;
18791878

18801879
if (!InitEntry(Entry))

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,8 +4512,7 @@ void Player::BuildPlayerRepop()
45124512
// there must be SMSG.STOP_MIRROR_TIMER
45134513

45144514
// the player cannot have a corpse already on current map, only bones which are not returned by GetCorpse
4515-
WorldLocation corpseLocation = GetCorpseLocation();
4516-
if (corpseLocation.GetMapId() == GetMapId())
4515+
if (GetCorpseLocation().GetMapId() == GetMapId())
45174516
{
45184517
TC_LOG_ERROR("entities.player", "Player::BuildPlayerRepop: Player '{}' ({}) already has a corpse", GetName(), GetGUID().ToString());
45194518
return;

src/server/game/Entities/Player/Player.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
17001700
void KillPlayer();
17011701
static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans);
17021702
bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
1703-
WorldLocation GetCorpseLocation() const { return _corpseLocation; }
1703+
WorldLocation const& GetCorpseLocation() const { return _corpseLocation; }
17041704
uint32 GetResurrectionSpellId();
17051705
void ResurrectPlayer(float restore_percent, bool applySickness = false);
17061706
void BuildPlayerRepop();

src/server/game/Entities/Unit/Unit.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,7 +3269,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
32693269
ASSERT(!m_cleanupDone);
32703270
m_ownedAuras.emplace(aura->GetId(), aura);
32713271

3272-
_RemoveNoStackAurasDueToAura(aura);
3272+
_RemoveNoStackAurasDueToAura(aura, true);
32733273

32743274
if (aura->IsRemoved())
32753275
return;
@@ -3363,7 +3363,7 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint8 effMask)
33633363
{
33643364
Aura* aura = aurApp->GetBase();
33653365

3366-
_RemoveNoStackAurasDueToAura(aura);
3366+
_RemoveNoStackAurasDueToAura(aura, false);
33673367

33683368
if (aurApp->GetRemoveMode())
33693369
return;
@@ -3517,7 +3517,7 @@ void Unit::_UnapplyAura(AuraApplication* aurApp, AuraRemoveMode removeMode)
35173517
ABORT();
35183518
}
35193519

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

@@ -3531,23 +3531,10 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
35313531
return;
35323532
}
35333533

3534-
bool remove = false;
3535-
for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
3536-
{
3537-
if (remove)
3538-
{
3539-
remove = false;
3540-
i = m_appliedAuras.begin();
3541-
}
3542-
3543-
if (aura->CanStackWith(i->second->GetBase()))
3544-
continue;
3545-
3546-
RemoveAura(i, AURA_REMOVE_BY_DEFAULT);
3547-
if (i == m_appliedAuras.end())
3548-
break;
3549-
remove = true;
3550-
}
3534+
if (owned)
3535+
RemoveOwnedAuras([aura](Aura const* ownedAura) { return !aura->CanStackWith(ownedAura); }, AURA_REMOVE_BY_DEFAULT);
3536+
else
3537+
RemoveAppliedAuras([aura](AuraApplication const* appliedAura) { return !aura->CanStackWith(appliedAura->GetBase()); }, AURA_REMOVE_BY_DEFAULT);
35513538
}
35523539

35533540
void Unit::_RegisterAuraEffect(AuraEffect* aurEff, bool apply)

0 commit comments

Comments
 (0)