Permalink
Browse files

[mr1974] code style

I use now Eclipse, so i have some code style marks :)
  • Loading branch information...
1 parent 026a399 commit cc4e004b230aa57079236fcdb9ebd668807db5f4 @Reamer Reamer committed May 9, 2012
View
@@ -1668,71 +1668,71 @@ struct ClassFamilyMask
template <CFM_ARGS_1>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_1>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_1>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_1>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_1>::value);
}
template <CFM_ARGS_2>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_2>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_2>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_2>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_2>::value);
}
template <CFM_ARGS_3>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_3>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_3>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_3>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_3>::value);
}
template <CFM_ARGS_4>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_4>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_4>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_4>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_4>::value);
}
template <CFM_ARGS_5>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_5>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_5>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_5>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_5>::value);
}
template <CFM_ARGS_6>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_6>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_6>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_6>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_6>::value);
}
template <CFM_ARGS_7>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_7>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_7>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_7>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_7>::value);
}
template <CFM_ARGS_8>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_8>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_8>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_8>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_8>::value);
}
template <CFM_ARGS_9>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_9>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_9>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_9>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_9>::value);
}
template <CFM_ARGS_10>
bool test() const
{
- return Flags & BitMask<uint64, true, CFM_VALUES_10>::value ||
- Flags2 & BitMask<uint32, false, CFM_VALUES_10>::value;
+ return (Flags & BitMask<uint64, true, CFM_VALUES_10>::value) ||
+ (Flags2 & BitMask<uint32, false, CFM_VALUES_10>::value);
}
// named constructors (compile-time)
@@ -2434,7 +2434,7 @@ struct VehicleSeatEntry
// 55 m_cameraEnteringZoom"
// 56 m_cameraSeatZoomMin
// 57 m_cameraSeatZoomMax
- bool IsUsable() const { return (m_flags & SEAT_FLAG_USABLE || m_flags & SEAT_FLAG_CAN_CONTROL); }
+ bool IsUsable() const { return ((m_flags & SEAT_FLAG_USABLE) || (m_flags & SEAT_FLAG_CAN_CONTROL)); }
};
struct WMOAreaTableEntry
View
@@ -346,7 +346,8 @@ void GameObject::Update(uint32 update_diff, uint32 diff)
}
}
// call capture point events
- if (Player* usePlayer = sObjectMgr.GetPlayer(rangePlayers > 0 ? (*(m_capturePlayers[TEAM_INDEX_ALLIANCE].begin())) : (*(m_capturePlayers[TEAM_INDEX_HORDE].begin()))))
+ Player* usePlayer = sObjectMgr.GetPlayer(rangePlayers > 0 ? (*(m_capturePlayers[TEAM_INDEX_ALLIANCE].begin())) : (*(m_capturePlayers[TEAM_INDEX_HORDE].begin())));
+ if (usePlayer)
Use(usePlayer); // TODO: We actually now dont need player pointer in the Use() function of capture points
}
else
@@ -400,6 +401,7 @@ void GameObject::Update(uint32 update_diff, uint32 diff)
}
// NO BREAK for switch (m_lootState)
}
+ /* no break */
case GO_READY:
{
if (m_respawnTime > 0) // timer on
@@ -2249,7 +2251,8 @@ void GameObject::StopGroupLoot()
if (!m_groupLootId)
return;
- if (Group* group = sObjectMgr.GetGroupById(m_groupLootId))
+ Group* group = sObjectMgr.GetGroupById(m_groupLootId);
+ if (group)
group->EndRoll();
m_groupLootTimer = 0;
View
@@ -319,7 +319,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 updateFlags) const
if (updateFlags & UPDATEFLAG_HAS_POSITION)
{
// 0x02
- if (updateFlags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
+ if ((updateFlags & UPDATEFLAG_TRANSPORT) && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
{
*data << float(0);
*data << float(0);
@@ -2092,7 +2092,8 @@ void WorldObject::StopGroupLoot()
if (!m_groupLootId)
return;
- if (Group* group = sObjectMgr.GetGroupById(m_groupLootId))
+ Group* group = sObjectMgr.GetGroupById(m_groupLootId);
+ if (group)
group->EndRoll();
m_groupLootTimer = 0;
View
@@ -3671,6 +3671,9 @@ void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, Play
info->stats[STAT_AGILITY] += (lvl > 38 ? 2: (lvl > 8 && (lvl%2) ? 1: 0));
info->stats[STAT_INTELLECT] += (lvl > 38 ? 3: (lvl > 4 ? 1: 0));
info->stats[STAT_SPIRIT] += (lvl > 38 ? 3: (lvl > 5 ? 1: 0));
+ break;
+ default:
+ break;
}
}
}
View
@@ -2537,7 +2537,8 @@ void Player::RemoveFromGroup(Group* group, ObjectGuid guid)
if (group)
{
// remove all auras affecting only group members
- if (Player *pLeaver = sObjectMgr.GetPlayer(guid))
+ Player *pLeaver = sObjectMgr.GetPlayer(guid);
+ if (pLeaver)
{
for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -4353,7 +4354,8 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
// remove from guild
if (uint32 guildId = GetGuildIdFromDB(playerguid))
{
- if (Guild* guild = sGuildMgr.GetGuildById(guildId))
+ Guild* guild = sGuildMgr.GetGuildById(guildId);
+ if (guild)
{
if (guild->DelMember(playerguid))
{
@@ -4372,7 +4374,8 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
{
uint32 groupId = (*resultGroup)[0].GetUInt32();
delete resultGroup;
- if (Group* group = sObjectMgr.GetGroupById(groupId))
+ Group* group = sObjectMgr.GetGroupById(groupId);
+ if (group)
RemoveFromGroup(group, playerguid);
}
@@ -4547,6 +4550,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
break;
default:
sLog.outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
+ break;
}
if (updateRealmChars)
@@ -5067,7 +5071,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived
- if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < -500.0f)
+ if ((!isAlive() && zone && (zone->flags & AREA_FLAG_NEED_FLY)) || GetTransport() || GetPositionZ() < -500.0f)
{
ResurrectPlayer(0.5f);
SpawnCorpseBones();
@@ -6664,14 +6668,13 @@ void Player::RewardReputation(Unit *pVictim, float rate)
uint32 Repfaction1 = Rep->repfaction1;
uint32 Repfaction2 = Rep->repfaction2;
- uint32 tabardFactionID = 0;
// Championning tabard reputation system
if (HasAura(Rep->championingAura))
{
if ( Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TABARD ) )
{
- if ( tabardFactionID = pItem->GetProto()->RequiredReputationFaction )
+ if (uint32 tabardFactionID = pItem->GetProto()->RequiredReputationFaction )
{
Repfaction1 = tabardFactionID;
Repfaction2 = tabardFactionID;
@@ -7190,7 +7193,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
if (sWorld.getConfig(CONFIG_BOOL_WEATHER))
{
- if (Weather *wth = sWorld.FindWeather(zone->ID))
+ Weather* wth = sWorld.FindWeather(zone->ID);
+ if (wth)
wth->SendWeatherUpdateToPlayer(this);
else if(!sWorld.AddWeather(zone->ID))
{
@@ -7211,10 +7215,10 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
switch(zone->team)
{
case AREATEAM_ALLY:
- pvpInfo.inHostileArea = GetTeam() != ALLIANCE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
+ pvpInfo.inHostileArea = GetTeam() != ALLIANCE && (sWorld.IsPvPRealm() || (zone->flags & AREA_FLAG_CAPITAL));
break;
case AREATEAM_HORDE:
- pvpInfo.inHostileArea = GetTeam() != HORDE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
+ pvpInfo.inHostileArea = GetTeam() != HORDE && (sWorld.IsPvPRealm() || (zone->flags & AREA_FLAG_CAPITAL));
break;
case AREATEAM_NONE:
// overwrite for battlegrounds, maybe batter some zone flags but current known not 100% fit to this
@@ -8468,7 +8472,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
// not check distance for GO in case owned GO (fishing bobber case, for example)
// And permit out of range GO with no owner in case fishing hole
- if (!go || (loot_type != LOOT_FISHINGHOLE && (loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_FAIL || go->GetOwnerGuid() != GetObjectGuid()) && !go->IsWithinDistInMap(this,INTERACTION_DISTANCE)))
+ if (!go || (loot_type != LOOT_FISHINGHOLE && ((loot_type != LOOT_FISHING && loot_type != LOOT_FISHING_FAIL) || go->GetOwnerGuid() != GetObjectGuid()) && !go->IsWithinDistInMap(this,INTERACTION_DISTANCE)))
{
SendLootRelease(guid);
return;
@@ -9616,7 +9620,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap
if (CanDualWield())
slots[1] = EQUIPMENT_SLOT_OFFHAND;
break;
- };
+ }
case INVTYPE_SHIELD:
slots[0] = EQUIPMENT_SLOT_OFFHAND;
break;
@@ -16473,7 +16477,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
if (!arena_team_id)
continue;
- if (ArenaTeam * at = sObjectMgr.GetArenaTeamById(arena_team_id))
+ ArenaTeam * at = sObjectMgr.GetArenaTeamById(arena_team_id);
+ if (at)
if (at->HaveMember(GetObjectGuid()))
continue;
@@ -17984,8 +17989,8 @@ void Player::_LoadGroup(QueryResult *result)
{
uint32 groupId = (*result)[0].GetUInt32();
delete result;
-
- if (Group* group = sObjectMgr.GetGroupById(groupId))
+ Group* group = sObjectMgr.GetGroupById(groupId);
+ if (group)
{
uint8 subgroup = group->GetMemberGroup(GetObjectGuid());
SetGroup(group, subgroup);
@@ -18157,10 +18162,9 @@ DungeonPersistentState* Player::GetBoundInstanceSaveForSelfOrGroup(uint32 mapid)
// then the player's group bind and finally the solo bind.
if (!pBind || !pBind->perm)
{
- InstanceGroupBind *groupBind = NULL;
// use the player's difficulty setting (it may not be the same as the group's)
if (Group *group = GetGroup())
- if (groupBind = group->GetBoundInstance(mapid, this))
+ if (InstanceGroupBind* groupBind = group->GetBoundInstance(mapid, this))
state = groupBind->state;
}
@@ -19991,8 +19995,11 @@ void Player::LeaveAllArenaTeams(ObjectGuid guid)
{
Field *fields = result->Fetch();
if (uint32 at_id = fields[0].GetUInt32())
- if (ArenaTeam * at = sObjectMgr.GetArenaTeamById(at_id))
+ {
+ ArenaTeam* at = sObjectMgr.GetArenaTeamById(at_id);
+ if (at)
at->DelMember(guid);
+ }
} while (result->NextRow());
@@ -20536,7 +20543,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
// possible item converted for BoA case
ItemPrototype const* crProto = ObjectMgr::GetItemPrototype(crItem->item);
- if (crProto->Flags & ITEM_FLAG_BOA && crProto->RequiredReputationFaction &&
+ if ((crProto->Flags & ITEM_FLAG_BOA) && crProto->RequiredReputationFaction &&
uint32(GetReputationRank(crProto->RequiredReputationFaction)) >= crProto->RequiredReputationRank)
converted = (sObjectMgr.GetItemConvert(crItem->item, getRaceMask()) != 0);
@@ -20607,7 +20614,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
}
}
- uint32 price = (crItem->ExtendedCost == 0 || pProto->Flags2 & ITEM_FLAG2_EXT_COST_REQUIRES_GOLD) ? pProto->BuyPrice * count : 0;
+ uint32 price = (crItem->ExtendedCost == 0 || (pProto->Flags2 & ITEM_FLAG2_EXT_COST_REQUIRES_GOLD)) ? pProto->BuyPrice * count : 0;
// reputation discount
if (price)
@@ -20695,7 +20702,8 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot)
uint32 max_personal_rating = 0;
for(int i = minarenaslot; i < MAX_ARENA_SLOT; ++i)
{
- if (ArenaTeam * at = sObjectMgr.GetArenaTeamById(GetArenaTeamId(i)))
+ ArenaTeam* at = sObjectMgr.GetArenaTeamById(GetArenaTeamId(i));
+ if (at)
{
uint32 p_rating = GetArenaPersonalRating(i);
uint32 t_rating = at->GetRating();
@@ -21801,7 +21809,7 @@ void Player::SetMonthlyQuestStatus(uint32 quest_id)
void Player::ResetDailyQuestStatus()
{
uint32 dailyQuestCount = 0;
- for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
+ for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
++dailyQuestCount;
@@ -22261,7 +22269,7 @@ bool Player::isHonorOrXPTarget(Unit* pVictim) const
{
if (((Creature*)pVictim)->IsTotem() ||
((Creature*)pVictim)->IsPet() ||
- ((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
+ (((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL))
return false;
}
return true;
@@ -24927,7 +24935,7 @@ bool Player::CheckTransferPossibility(AreaTrigger const*& at, bool b_onlyMainReq
case AREA_LOCKSTATUS_MISSING_ITEM:
{
MapDifficultyEntry const* mapDiff = GetMapDifficultyData(targetMapEntry->MapID,GetDifficulty(targetMapEntry->IsRaid()));
- if (mapDiff && mapDiff->mapDifficultyFlags & MAP_DIFFICULTY_FLAG_CONDITION)
+ if (mapDiff && (mapDiff->mapDifficultyFlags & MAP_DIFFICULTY_FLAG_CONDITION))
{
GetSession()->SendAreaTriggerMessage("%s", mapDiff->areaTriggerText[GetSession()->GetSessionDbcLocale()]);
}
@@ -25218,14 +25226,14 @@ uint32 Player::GetModelForForm(SpellShapeshiftFormEntry const* ssEntry) const
if (skinColour >= 0 && skinColour <= 5) modelid = 29412;
else if (skinColour >= 6 && skinColour <= 8) modelid = 29411;
else if (skinColour >= 9 && skinColour <= 11) modelid = 29410;
- else if (skinColour >= 12 && skinColour <= 14 || skinColour == 18) modelid = 29409;
+ else if ((skinColour >= 12 && skinColour <= 14) || skinColour == 18) modelid = 29409;
else if (skinColour >= 15 && skinColour <= 17) modelid = 8571;
}
else // form == FORM_BEAR || form == FORM_DIREBEAR
{
if (skinColour >= 0 && skinColour <= 2) modelid = 29418;
- else if (skinColour >= 3 && skinColour <= 5 || skinColour >= 12 && skinColour <= 14) modelid = 29419;
- else if (skinColour >= 9 && skinColour <= 11 || skinColour >= 15 && skinColour <= 17) modelid = 29420;
+ else if ((skinColour >= 3 && skinColour <= 5) || (skinColour >= 12 && skinColour <= 14)) modelid = 29419;
+ else if ((skinColour >= 9 && skinColour <= 11) || (skinColour >= 15 && skinColour <= 17)) modelid = 29420;
else if (skinColour >= 6 && skinColour <= 8) modelid = 2289;
else if (skinColour == 18) modelid = 29421;
}
Oops, something went wrong.

0 comments on commit cc4e004

Please sign in to comment.