Skip to content

Commit

Permalink
[10610] Renamed some functions from the Creature class
Browse files Browse the repository at this point in the history
Also other classes have been affected, due to the use of search&replace.
This will probably break some patches and 3rd party libraries, so make sure to update them if required.
Thanks to Phille for the original idea and patch!
  • Loading branch information
DasBlub committed Oct 14, 2010
1 parent ae33712 commit 24920cc
Show file tree
Hide file tree
Showing 50 changed files with 305 additions and 305 deletions.
4 changes: 2 additions & 2 deletions src/game/AggressorAI.cpp
Expand Up @@ -30,7 +30,7 @@ int
AggressorAI::Permissible(const Creature *creature)
{
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
if( !creature->isCivilian() && !creature->IsNeutralToAll() )
if( !creature->IsCivilian() && !creature->IsNeutralToAll() )
return PERMIT_BASE_PROACTIVE;

return PERMIT_BASE_NO;
Expand All @@ -44,7 +44,7 @@ void
AggressorAI::MoveInLineOfSight(Unit *u)
{
// Ignore Z for flying creatures
if( !m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
if( !m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
return;

if (m_creature->CanInitiateAttack() && u->isTargetableForAttack() &&
Expand Down
2 changes: 1 addition & 1 deletion src/game/BattleGround.cpp
Expand Up @@ -1587,7 +1587,7 @@ void BattleGround::SpawnBGCreature(uint64 const& guid, uint32 respawntime)
else
{
map->Add(obj);
obj->setDeathState(JUST_DIED);
obj->SetDeathState(JUST_DIED);
obj->SetRespawnDelay(respawntime);
obj->RemoveCorpse();
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/ConfusedMovementGenerator.cpp
Expand Up @@ -73,8 +73,8 @@ ConfusedMovementGenerator<Creature>::_InitSpecific(Creature &creature, bool &is_
{
creature.RemoveSplineFlag(SPLINEFLAG_WALKMODE);

is_water_ok = creature.canSwim();
is_land_ok = creature.canWalk();
is_water_ok = creature.CanSwim();
is_land_ok = creature.CanWalk();
}

template<>
Expand Down
84 changes: 42 additions & 42 deletions src/game/Creature.cpp
Expand Up @@ -172,7 +172,7 @@ void Creature::RemoveCorpse()
return;

m_corpseDecayTimer = 0;
setDeathState(DEAD);
SetDeathState(DEAD);
UpdateObjectVisibility();

// stop loot rolling before loot clear and for close client dialogs
Expand Down Expand Up @@ -418,11 +418,11 @@ void Creature::Update(uint32 diff)
switch( m_deathState )
{
case JUST_ALIVED:
// Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting.
// Don't must be called, see Creature::SetDeathState JUST_ALIVED -> ALIVE promoting.
sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry());
break;
case JUST_DIED:
// Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
// Don't must be called, see Creature::SetDeathState JUST_DIED -> CORPSE promoting.
sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry());
break;
case DEAD:
Expand All @@ -444,14 +444,14 @@ void Creature::Update(uint32 diff)
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
if (m_isDeadByDefault)
{
setDeathState(JUST_DIED);
SetDeathState(JUST_DIED);
SetHealth(0);
i_motionMaster.Clear();
clearUnitState(UNIT_STAT_ALL_STATE);
LoadCreaturesAddon(true);
LoadCreatureAddon(true);
}
else
setDeathState( JUST_ALIVED );
SetDeathState( JUST_ALIVED );

//Call AI respawn virtual function
i_AI->JustRespawned();
Expand Down Expand Up @@ -557,7 +557,7 @@ void Creature::Update(uint32 diff)
}
case DEAD_FALLING:
{
setDeathState(CORPSE);
SetDeathState(CORPSE);
}
default:
break;
Expand Down Expand Up @@ -611,7 +611,7 @@ void Creature::RegenerateMana()

void Creature::RegenerateHealth()
{
if (!isRegeneratingHealth())
if (!IsRegeneratingHealth())
return;

uint32 curValue = GetHealth();
Expand Down Expand Up @@ -715,13 +715,13 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
m_corpseDelay = sWorld.getConfig(CONFIG_UINT32_CORPSE_DECAY_NORMAL);
break;
}
LoadCreaturesAddon();
LoadCreatureAddon();
}

return bResult;
}

bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
{
if(!isTrainer())
return false;
Expand Down Expand Up @@ -807,7 +807,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
return true;
}

bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
bool Creature::CanInteractWithBattleMaster(Player* pPlayer, bool msg) const
{
if(!isBattleMaster())
return false;
Expand Down Expand Up @@ -842,7 +842,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
return true;
}

bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const
bool Creature::CanTrainAndResetTalentsOf(Player* pPlayer) const
{
return pPlayer->getLevel() >= 10
&& GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS
Expand Down Expand Up @@ -1062,7 +1062,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)

void Creature::SelectLevel(const CreatureInfo *cinfo, float percentHealth, float percentMana)
{
uint32 rank = isPet()? 0 : cinfo->rank;
uint32 rank = IsPet()? 0 : cinfo->rank;

// level
uint32 minlevel = std::min(cinfo->maxlevel, cinfo->minlevel);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map)
if(m_respawnTime > time(NULL)) // not ready to respawn
{
m_deathState = DEAD;
if(canFly())
if(CanFly())
{
float tz = GetMap()->GetHeight(data->posX, data->posY, data->posZ, false);
if(data->posZ - tz > 0.1)
Expand Down Expand Up @@ -1288,7 +1288,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]);
}

bool Creature::hasQuest(uint32 quest_id) const
bool Creature::HasQuest(uint32 quest_id) const
{
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
Expand All @@ -1299,7 +1299,7 @@ bool Creature::hasQuest(uint32 quest_id) const
return false;
}

bool Creature::hasInvolvedQuest(uint32 quest_id) const
bool Creature::HasInvolvedQuest(uint32 quest_id) const
{
QuestRelationsMapBounds bounds = sObjectMgr.GetCreatureQuestInvolvedRelationsMapBounds(GetEntry());
for(QuestRelationsMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
Expand Down Expand Up @@ -1337,8 +1337,8 @@ float Creature::GetAttackDistance(Unit const* pl) const
if(aggroRate == 0)
return 0.0f;

uint32 playerlevel = pl->getLevelForTarget(this);
uint32 creaturelevel = getLevelForTarget(pl);
uint32 playerlevel = pl->GetLevelForTarget(this);
uint32 creaturelevel = GetLevelForTarget(pl);

int32 leveldif = int32(playerlevel) - int32(creaturelevel);

Expand Down Expand Up @@ -1369,23 +1369,23 @@ float Creature::GetAttackDistance(Unit const* pl) const
return (RetDistance*aggroRate);
}

void Creature::setDeathState(DeathState s)
void Creature::SetDeathState(DeathState s)
{
if ((s == JUST_DIED && !m_isDeadByDefault) || (s == JUST_ALIVED && m_isDeadByDefault))
{
m_corpseDecayTimer = m_corpseDelay*IN_MILLISECONDS; // the max/default time for corpse decay (before creature is looted/AllLootRemovedFromCorpse() is called)
m_respawnTime = time(NULL) + m_respawnDelay; // respawn delay (spawntimesecs)

// always save boss respawn time at death to prevent crash cheating
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || isWorldBoss())
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATLY) || IsWorldBoss())
SaveRespawnTime();
}

Unit::setDeathState(s);
Unit::SetDeathState(s);

if (s == JUST_DIED)
{
SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState)
SetTargetGUID(0); // remove target selection in any cases (can be set at aura remove in Unit::SetDeathState)
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);

if (HasSearchedAssistance())
Expand All @@ -1395,10 +1395,10 @@ void Creature::setDeathState(DeathState s)
}

// return, since we promote to DEAD_FALLING. DEAD_FALLING is promoted to CORPSE at next update.
if (canFly() && FallGround())
if (CanFly() && FallGround())
return;

Unit::setDeathState(CORPSE);
Unit::SetDeathState(CORPSE);
}

if (s == JUST_ALIVED)
Expand All @@ -1410,11 +1410,11 @@ void Creature::setDeathState(DeathState s)
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
AddSplineFlag(SPLINEFLAG_WALKMODE);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
Unit::setDeathState(ALIVE);
Unit::SetDeathState(ALIVE);
clearUnitState(UNIT_STAT_ALL_STATE);
i_motionMaster.Clear();
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
LoadCreaturesAddon(true);
LoadCreatureAddon(true);
}
}

Expand All @@ -1437,7 +1437,7 @@ bool Creature::FallGround()
if (fabs(GetPositionZ() - tz) < 0.1f)
return false;

Unit::setDeathState(DEAD_FALLING);
Unit::SetDeathState(DEAD_FALLING);

float dz = tz - GetPositionZ();
float distance = sqrt(dz*dz);
Expand Down Expand Up @@ -1491,24 +1491,24 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
}

if (isAlive())
setDeathState(JUST_DIED);
SetDeathState(JUST_DIED);

RemoveCorpse();
SetHealth(0); // just for nice GM-mode view
}

bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
bool Creature::IsImmuneToSpell(SpellEntry const* spellInfo)
{
if (!spellInfo)
return false;

if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
return true;

return Unit::IsImmunedToSpell(spellInfo);
return Unit::IsImmuneToSpell(spellInfo);
}

bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
{
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
return true;
Expand All @@ -1527,10 +1527,10 @@ bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectIn
return true;
}

return Unit::IsImmunedToSpellEffect(spellInfo, index);
return Unit::IsImmuneToSpellEffect(spellInfo, index);
}

SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
SpellEntry const *Creature::ReachWithSpellAttack(Unit *pVictim)
{
if(!pVictim)
return NULL;
Expand Down Expand Up @@ -1582,7 +1582,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
return NULL;
}

SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
SpellEntry const *Creature::ReachWithSpellCure(Unit *pVictim)
{
if(!pVictim)
return NULL;
Expand Down Expand Up @@ -1680,7 +1680,7 @@ void Creature::SendAIReaction(AiReaction reactionType)

void Creature::CallAssistance()
{
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
if( !m_AlreadyCallAssistance && getVictim() && !IsPet() && !isCharmed())
{
SetNoCallAssistance(true);

Expand All @@ -1706,7 +1706,7 @@ void Creature::CallAssistance()

void Creature::CallForHelp(float fRadius)
{
if (fRadius <= 0.0f || !getVictim() || isPet() || isCharmed())
if (fRadius <= 0.0f || !getVictim() || IsPet() || isCharmed())
return;

MaNGOS::CallOfHelpCreatureInRangeDo u_do(this, getVictim(), fRadius);
Expand All @@ -1721,7 +1721,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
return false;

// we don't need help from non-combatant ;)
if (isCivilian())
if (IsCivilian())
return false;

if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE))
Expand Down Expand Up @@ -1770,7 +1770,7 @@ bool Creature::CanInitiateAttack()

void Creature::SaveRespawnTime()
{
if(isPet() || !m_DBTableGuid)
if(IsPet() || !m_DBTableGuid)
return;

if(m_respawnTime > time(NULL)) // dead (no corpse)
Expand Down Expand Up @@ -1820,7 +1820,7 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
}

//creature_addon table
bool Creature::LoadCreaturesAddon(bool reload)
bool Creature::LoadCreatureAddon(bool reload)
{
CreatureDataAddon const *cainfo = GetCreatureAddon();
if(!cainfo)
Expand Down Expand Up @@ -2139,10 +2139,10 @@ void Creature::AllLootRemovedFromCorpse()
}
}

uint32 Creature::getLevelForTarget( Unit const* target ) const
uint32 Creature::GetLevelForTarget( Unit const* target ) const
{
if(!isWorldBoss())
return Unit::getLevelForTarget(target);
if(!IsWorldBoss())
return Unit::GetLevelForTarget(target);

uint32 level = target->getLevel()+sWorld.getConfig(CONFIG_UINT32_WORLD_BOSS_LEVEL_DIFF);
if(level < 1)
Expand Down

3 comments on commit 24920cc

@triple
Copy link

@triple triple commented on 24920cc Oct 16, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see vehicles has been implemented but where is the sql to support it? i pulled the core as standard compile and pushed dbs but vehicles sql is missing?

@DasBlub
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vehicles have not yet been implemented on mangos.
have a look at this thread for more informations about vehicles: http://getmangos.com/community/viewtopic.php?id=11759

(and what the ... does this have to do with this commit?!)

@kamikazetg
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They see the word "Vehicle" anywhere in a commit and they go apeshit.

Please sign in to comment.