mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Code style (game + scripts only):
"if(" --> "if ("
--HG--
branch : trunk
This commit is contained in:
@@ -58,7 +58,7 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if( (factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
if ( (factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
(factionEntry->BaseRepRaceMask[i] == 0 &&
|
||||
factionEntry->BaseRepClassMask[i] != 0 ) ) &&
|
||||
(factionEntry->BaseRepClassMask[i] & classMask ||
|
||||
@@ -74,10 +74,10 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
||||
int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
|
||||
{
|
||||
// Faction without recorded reputation. Just ignore.
|
||||
if(!factionEntry)
|
||||
if (!factionEntry)
|
||||
return 0;
|
||||
|
||||
if(FactionState const* state = GetState(factionEntry))
|
||||
if (FactionState const* state = GetState(factionEntry))
|
||||
return GetBaseReputation(factionEntry) + state->Standing;
|
||||
|
||||
return 0;
|
||||
@@ -97,7 +97,7 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons
|
||||
|
||||
void ReputationMgr::ApplyForceReaction( uint32 faction_id,ReputationRank rank,bool apply )
|
||||
{
|
||||
if(apply)
|
||||
if (apply)
|
||||
m_forcedReactions[faction_id] = rank;
|
||||
else
|
||||
m_forcedReactions.erase(faction_id);
|
||||
@@ -112,7 +112,7 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if( (factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
if ( (factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
(factionEntry->BaseRepRaceMask[i] == 0 &&
|
||||
factionEntry->BaseRepClassMask[i] != 0 ) ) &&
|
||||
(factionEntry->BaseRepClassMask[i] & classMask ||
|
||||
@@ -138,7 +138,7 @@ void ReputationMgr::SendForceReactions()
|
||||
|
||||
void ReputationMgr::SendState(FactionState const* faction) const
|
||||
{
|
||||
if(faction->Flags & FACTION_FLAG_VISIBLE) //If faction is visible then update it
|
||||
if (faction->Flags & FACTION_FLAG_VISIBLE) //If faction is visible then update it
|
||||
{
|
||||
WorldPacket data(SMSG_SET_FACTION_STANDING, (16)); // last check 2.4.0
|
||||
data << (float) 0; // unk 2.4.0
|
||||
@@ -193,7 +193,7 @@ void ReputationMgr::SendStates() const
|
||||
|
||||
void ReputationMgr::SendVisible(FactionState const* faction) const
|
||||
{
|
||||
if(m_player->GetSession()->PlayerLoading())
|
||||
if (m_player->GetSession()->PlayerLoading())
|
||||
return;
|
||||
|
||||
// make faction visible in reputation list at client
|
||||
@@ -214,7 +214,7 @@ void ReputationMgr::Initialize()
|
||||
{
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(i);
|
||||
|
||||
if( factionEntry && (factionEntry->reputationListID >= 0))
|
||||
if ( factionEntry && (factionEntry->reputationListID >= 0))
|
||||
{
|
||||
FactionState newFaction;
|
||||
newFaction.ID = factionEntry->ID;
|
||||
@@ -223,7 +223,7 @@ void ReputationMgr::Initialize()
|
||||
newFaction.Flags = GetDefaultStateFlags(factionEntry);
|
||||
newFaction.Changed = true;
|
||||
|
||||
if( newFaction.Flags & FACTION_FLAG_VISIBLE )
|
||||
if ( newFaction.Flags & FACTION_FLAG_VISIBLE )
|
||||
++m_visibleFactionCount;
|
||||
|
||||
UpdateRankCounters(REP_HOSTILE,GetBaseRank(factionEntry));
|
||||
@@ -290,7 +290,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
{
|
||||
for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr)
|
||||
{
|
||||
if((*itr) == factionEntry->ID) // Not to self
|
||||
if ((*itr) == factionEntry->ID) // Not to self
|
||||
continue;
|
||||
|
||||
targetFaction = sFactionStore.LookupEntry(*itr);
|
||||
@@ -320,7 +320,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||
{
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
|
||||
if(incremental)
|
||||
if (incremental)
|
||||
{
|
||||
// int32 *= float cause one point loss?
|
||||
standing = floor( (float)standing * sWorld.getRate(RATE_REPUTATION_GAIN) + 0.5 );
|
||||
@@ -340,7 +340,7 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||
|
||||
SetVisible(&itr->second);
|
||||
|
||||
if(new_rank <= REP_HOSTILE)
|
||||
if (new_rank <= REP_HOSTILE)
|
||||
SetAtWar(&itr->second,true);
|
||||
|
||||
SendState(&itr->second);
|
||||
@@ -361,18 +361,18 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||
|
||||
void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry)
|
||||
{
|
||||
if(!factionTemplateEntry->faction)
|
||||
if (!factionTemplateEntry->faction)
|
||||
return;
|
||||
|
||||
if(FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||
if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||
// Never show factions of the opposing team
|
||||
if(!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom) )
|
||||
if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom) )
|
||||
SetVisible(factionEntry);
|
||||
}
|
||||
|
||||
void ReputationMgr::SetVisible(FactionEntry const *factionEntry)
|
||||
{
|
||||
if(factionEntry->reputationListID < 0)
|
||||
if (factionEntry->reputationListID < 0)
|
||||
return;
|
||||
|
||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||
@@ -386,11 +386,11 @@ void ReputationMgr::SetVisible(FactionState* faction)
|
||||
{
|
||||
// always invisible or hidden faction can't be make visible
|
||||
// except if faction has FACTION_FLAG_SPECIAL
|
||||
if(faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL) )
|
||||
if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) && !(faction->Flags & FACTION_FLAG_SPECIAL) )
|
||||
return;
|
||||
|
||||
// already set
|
||||
if(faction->Flags & FACTION_FLAG_VISIBLE)
|
||||
if (faction->Flags & FACTION_FLAG_VISIBLE)
|
||||
return;
|
||||
|
||||
faction->Flags |= FACTION_FLAG_VISIBLE;
|
||||
@@ -408,7 +408,7 @@ void ReputationMgr::SetAtWar( RepListID repListID, bool on )
|
||||
return;
|
||||
|
||||
// always invisible or hidden faction can't change war state
|
||||
if(itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) )
|
||||
if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN) )
|
||||
return;
|
||||
|
||||
SetAtWar(&itr->second,on);
|
||||
@@ -417,14 +417,14 @@ void ReputationMgr::SetAtWar( RepListID repListID, bool on )
|
||||
void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
|
||||
{
|
||||
// not allow declare war to own faction
|
||||
if(atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) )
|
||||
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) )
|
||||
return;
|
||||
|
||||
// already set
|
||||
if(((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
|
||||
if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
|
||||
return;
|
||||
|
||||
if( atWar )
|
||||
if ( atWar )
|
||||
faction->Flags |= FACTION_FLAG_AT_WAR;
|
||||
else
|
||||
faction->Flags &= ~FACTION_FLAG_AT_WAR;
|
||||
@@ -444,14 +444,14 @@ void ReputationMgr::SetInactive( RepListID repListID, bool on )
|
||||
void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
|
||||
{
|
||||
// always invisible or hidden faction can't be inactive
|
||||
if(inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE) ) )
|
||||
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED|FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE) ) )
|
||||
return;
|
||||
|
||||
// already set
|
||||
if(((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
|
||||
if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
|
||||
return;
|
||||
|
||||
if(inactive)
|
||||
if (inactive)
|
||||
faction->Flags |= FACTION_FLAG_INACTIVE;
|
||||
else
|
||||
faction->Flags &= ~FACTION_FLAG_INACTIVE;
|
||||
@@ -466,14 +466,14 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
|
||||
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'",GetGUIDLow());
|
||||
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32());
|
||||
if( factionEntry && (factionEntry->reputationListID >= 0))
|
||||
if ( factionEntry && (factionEntry->reputationListID >= 0))
|
||||
{
|
||||
FactionState* faction = &m_factions[factionEntry->reputationListID];
|
||||
|
||||
@@ -488,27 +488,27 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
|
||||
|
||||
uint32 dbFactionFlags = fields[2].GetUInt32();
|
||||
|
||||
if( dbFactionFlags & FACTION_FLAG_VISIBLE )
|
||||
if ( dbFactionFlags & FACTION_FLAG_VISIBLE )
|
||||
SetVisible(faction); // have internal checks for forced invisibility
|
||||
|
||||
if( dbFactionFlags & FACTION_FLAG_INACTIVE)
|
||||
if ( dbFactionFlags & FACTION_FLAG_INACTIVE)
|
||||
SetInactive(faction,true); // have internal checks for visibility requirement
|
||||
|
||||
if( dbFactionFlags & FACTION_FLAG_AT_WAR ) // DB at war
|
||||
if ( dbFactionFlags & FACTION_FLAG_AT_WAR ) // DB at war
|
||||
SetAtWar(faction,true); // have internal checks for FACTION_FLAG_PEACE_FORCED
|
||||
else // DB not at war
|
||||
{
|
||||
// allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN)
|
||||
if( faction->Flags & FACTION_FLAG_VISIBLE )
|
||||
if ( faction->Flags & FACTION_FLAG_VISIBLE )
|
||||
SetAtWar(faction,false); // have internal checks for FACTION_FLAG_PEACE_FORCED
|
||||
}
|
||||
|
||||
// set atWar for hostile
|
||||
if(GetRank(factionEntry) <= REP_HOSTILE)
|
||||
if (GetRank(factionEntry) <= REP_HOSTILE)
|
||||
SetAtWar(faction,true);
|
||||
|
||||
// reset changed flag if values similar to saved in DB
|
||||
if(faction->Flags==dbFactionFlags)
|
||||
if (faction->Flags==dbFactionFlags)
|
||||
faction->Changed = false;
|
||||
}
|
||||
}
|
||||
@@ -531,17 +531,17 @@ void ReputationMgr::SaveToDB()
|
||||
|
||||
void ReputationMgr::UpdateRankCounters( ReputationRank old_rank, ReputationRank new_rank )
|
||||
{
|
||||
if(old_rank >= REP_EXALTED)
|
||||
if (old_rank >= REP_EXALTED)
|
||||
--m_exaltedFactionCount;
|
||||
if(old_rank >= REP_REVERED)
|
||||
if (old_rank >= REP_REVERED)
|
||||
--m_reveredFactionCount;
|
||||
if(old_rank >= REP_HONORED)
|
||||
if (old_rank >= REP_HONORED)
|
||||
--m_honoredFactionCount;
|
||||
|
||||
if(new_rank >= REP_EXALTED)
|
||||
if (new_rank >= REP_EXALTED)
|
||||
++m_exaltedFactionCount;
|
||||
if(new_rank >= REP_REVERED)
|
||||
if (new_rank >= REP_REVERED)
|
||||
++m_reveredFactionCount;
|
||||
if(new_rank >= REP_HONORED)
|
||||
if (new_rank >= REP_HONORED)
|
||||
++m_honoredFactionCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user