Skip to content

Commit

Permalink
EotB unit flag appropriate naming and documentation
Browse files Browse the repository at this point in the history
(based on cmangos/mangos-wotlk@631585856)

Signed-off-by: Xfurry <xfurry.cmangos@outlook.com>
  • Loading branch information
Warlockbugs authored and xfurry committed Jan 2, 2018
1 parent 1b48344 commit 9df0826
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/game/Unit.cpp
Expand Up @@ -12990,7 +12990,7 @@ Unit* Unit::TakePossessOf(SpellEntry const* spellEntry, SummonPropertiesEntry co
pCreature->SetRespawnCoord(pos); // set spawn coord
pCreature->SetCharmerGuid(GetObjectGuid()); // save guid of the charmer
pCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellEntry->Id); // set the spell id used to create this (may be used for removing corresponding aura
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // set flag for client that mean this unit is controlled by a player
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); // set flag for client that mean this unit is controlled by a player
pCreature->addUnitState(UNIT_STAT_CONTROLLED); // also set internal unit state flag
pCreature->SelectLevel(getLevel()); // set level to same level than summoner TODO:: not sure its always the case...
pCreature->SetLinkedToOwnerAura(TEMPSUMMON_LINKED_AURA_OWNER_CHECK | TEMPSUMMON_LINKED_AURA_REMOVE_OWNER); // set what to do if linked aura is removed or the creature is dead.
Expand Down Expand Up @@ -13051,7 +13051,7 @@ bool Unit::TakePossessOf(Unit* possessed)
possessed->ClearInCombat();

possessed->addUnitState(UNIT_STAT_CONTROLLED);
possessed->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
possessed->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
possessed->SetCharmerGuid(GetObjectGuid());

SetCharm(possessed);
Expand Down Expand Up @@ -13228,7 +13228,7 @@ void Unit::ResetControlState(bool attackCharmer /*= true*/)
}

possessed->clearUnitState(UNIT_STAT_CONTROLLED);
possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
possessed->SetCharmerGuid(ObjectGuid());

// may be not correct we have to remove only some generator taking account of the current situation
Expand Down
2 changes: 1 addition & 1 deletion src/game/Unit.h
Expand Up @@ -594,7 +594,7 @@ enum UnitFlags
UNIT_FLAG_DISARMED = 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip.
UNIT_FLAG_CONFUSED = 0x00400000,
UNIT_FLAG_FLEEING = 0x00800000,
UNIT_FLAG_PLAYER_CONTROLLED = 0x01000000, // used in spell Eyes of the Beast for pet... let attack by controlled creature
UNIT_FLAG_POSSESSED = 0x01000000, // remote control e.g. Eyes of the Beast: let master use melee attack, make unit unselectable via mouse for master in world (as if it was own character)
UNIT_FLAG_NOT_SELECTABLE = 0x02000000,
UNIT_FLAG_SKINNABLE = 0x04000000,
UNIT_FLAG_MOUNT = 0x08000000,
Expand Down
4 changes: 2 additions & 2 deletions src/game/Vehicle.cpp
Expand Up @@ -524,7 +524,7 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
pVehicle->SetCharmerGuid(pPlayer->GetObjectGuid());

pVehicle->addUnitState(UNIT_STAT_CONTROLLED);
pVehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
pVehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);

pPlayer->SetClientControl(pVehicle, 1);
pPlayer->SetMover(pVehicle);
Expand Down Expand Up @@ -595,7 +595,7 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
pPlayer->SetMover(nullptr);

pVehicle->clearUnitState(UNIT_STAT_CONTROLLED);
pVehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
pVehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);

// must be called after movement control unapplying
pPlayer->GetCamera().ResetView();
Expand Down

0 comments on commit 9df0826

Please sign in to comment.