Skip to content

Commit

Permalink
EotB unit flag appropriate naming and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Warlockbugs committed May 4, 2017
1 parent 9d9d1ba commit 6315858
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 @@ -12061,7 +12061,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 @@ -12122,7 +12122,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 @@ -12299,7 +12299,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 @@ -580,7 +580,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 @@ -526,7 +526,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 @@ -597,7 +597,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 6315858

Please sign in to comment.