Merge pull request #2852 from Chaplain/cleanup2

Core/Misc: Cleanup - remove unused variables, add some const modifiers to functions, fix process of args in vmap3_extractor
This commit is contained in:
QAston
2011-09-03 08:34:02 -07:00
14 changed files with 23 additions and 39 deletions
@@ -90,7 +90,7 @@ class AuctionHouseObject
typedef std::map<uint32, AuctionEntry*> AuctionEntryMap; typedef std::map<uint32, AuctionEntry*> AuctionEntryMap;
uint32 Getcount() { return AuctionsMap.size(); } uint32 Getcount() const { return AuctionsMap.size(); }
AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();} AuctionEntryMap::iterator GetAuctionsBegin() {return AuctionsMap.begin();}
AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();} AuctionEntryMap::iterator GetAuctionsEnd() {return AuctionsMap.end();}
+1 -1
View File
@@ -119,7 +119,7 @@ class ChatHandler
GameObject* GetNearbyGameObject(); GameObject* GetNearbyGameObject();
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry); GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
bool HasSentErrorMessage() { return sentErrorMessage;} bool HasSentErrorMessage() const { return sentErrorMessage;}
void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; void SetSentErrorMessage(bool val){ sentErrorMessage = val;};
static bool LoadCommandTable() { return load_command_table;} static bool LoadCommandTable() { return load_command_table;}
static void SetLoadCommandTable(bool val){ load_command_table = val;}; static void SetLoadCommandTable(bool val){ load_command_table = val;};
-2
View File
@@ -4208,8 +4208,6 @@ bool ChatHandler::HandleServerSetMotdCommand(const char *args)
/// Set whether we accept new clients /// Set whether we accept new clients
bool ChatHandler::HandleServerSetClosedCommand(const char *args) bool ChatHandler::HandleServerSetClosedCommand(const char *args)
{ {
std::string arg = args;
if (strncmp(args, "on", 3) == 0) if (strncmp(args, "on", 3) == 0)
{ {
SendSysMessage(LANG_WORLD_CLOSED); SendSysMessage(LANG_WORLD_CLOSED);
+2 -2
View File
@@ -407,11 +407,11 @@ struct Position
Position::PositionXYZStreamer PositionXYZStream() Position::PositionXYZStreamer PositionXYZStream()
{ {
return Position::PositionXYZStreamer(*this); return PositionXYZStreamer(*this);
} }
Position::PositionXYZOStreamer PositionXYZOStream() Position::PositionXYZOStreamer PositionXYZOStream()
{ {
return Position::PositionXYZOStreamer(*this); return PositionXYZOStreamer(*this);
} }
bool IsPositionValid() const; bool IsPositionValid() const;
@@ -56,7 +56,7 @@ class UpdateData
void AddOutOfRangeGUID(uint64 guid); void AddOutOfRangeGUID(uint64 guid);
void AddUpdateBlock(const ByteBuffer &block); void AddUpdateBlock(const ByteBuffer &block);
bool BuildPacket(WorldPacket* packet); bool BuildPacket(WorldPacket* packet);
bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); } bool HasData() const { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
void Clear(); void Clear();
std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; } std::set<uint64> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
+3 -10
View File
@@ -7949,23 +7949,16 @@ void Player::_ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply
if (CanUseAttackType(attType)) if (CanUseAttackType(attType))
_ApplyWeaponDamage(slot, proto, ssv, apply); _ApplyWeaponDamage(slot, proto, ssv, apply);
int32 extraDPS = ssv->getDPSMod(proto->ScalingStatValue);
// Apply feral bonus from ScalingStatValue if set // Apply feral bonus from ScalingStatValue if set
if (ssv) if (ssv)
{
if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue)) if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue))
ApplyFeralAPBonus(feral_bonus, apply); ApplyFeralAPBonus(feral_bonus, apply);
}
// Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue) // Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue)
if (getClass() == CLASS_DRUID) if (getClass() == CLASS_DRUID)
{ if (int32 feral_bonus = proto->getFeralBonus(ssv->getDPSMod(proto->ScalingStatValue)))
int32 feral_bonus = proto->getFeralBonus(extraDPS);
if (feral_bonus > 0)
ApplyFeralAPBonus(feral_bonus, apply); ApplyFeralAPBonus(feral_bonus, apply);
} }
}
void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply) void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
{ {
+1 -1
View File
@@ -214,7 +214,7 @@ class Group
uint64 GetLooterGuid() const; uint64 GetLooterGuid() const;
ItemQualities GetLootThreshold() const; ItemQualities GetLootThreshold() const;
uint32 GetDbStoreId() { return m_dbStoreId; }; uint32 GetDbStoreId() const { return m_dbStoreId; };
// member manipulation methods // member manipulation methods
bool IsMember(uint64 guid) const; bool IsMember(uint64 guid) const;
+3 -3
View File
@@ -55,8 +55,8 @@ class InstanceSave
or when the instance is reset */ or when the instance is reset */
~InstanceSave(); ~InstanceSave();
uint8 GetPlayerCount() { return m_playerList.size(); } uint8 GetPlayerCount() const { return m_playerList.size(); }
uint8 GetGroupCount() { return m_groupList.size(); } uint8 GetGroupCount() const { return m_groupList.size(); }
/* A map corresponding to the InstanceId/MapId does not always exist. /* A map corresponding to the InstanceId/MapId does not always exist.
InstanceSave objects may be created on player logon but the maps are InstanceSave objects may be created on player logon but the maps are
@@ -136,7 +136,7 @@ class InstanceSaveManager
InstResetEvent() : type(0), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {} InstResetEvent() : type(0), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {}
InstResetEvent(uint8 t, uint32 _mapid, Difficulty d, uint16 _instanceid) InstResetEvent(uint8 t, uint32 _mapid, Difficulty d, uint16 _instanceid)
: type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {} : type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {}
bool operator == (const InstResetEvent& e) { return e.instanceId == instanceId; } bool operator == (const InstResetEvent& e) const { return e.instanceId == instanceId; }
}; };
typedef std::multimap<time_t /*resetTime*/, InstResetEvent> ResetTimeQueue; typedef std::multimap<time_t /*resetTime*/, InstResetEvent> ResetTimeQueue;
+1 -1
View File
@@ -101,7 +101,7 @@ class ReputationMgr
ReputationRank GetRank(FactionEntry const* factionEntry) const; ReputationRank GetRank(FactionEntry const* factionEntry) const;
ReputationRank GetBaseRank(FactionEntry const* factionEntry) const; ReputationRank GetBaseRank(FactionEntry const* factionEntry) const;
uint32 GetReputationRankStrIndex(FactionEntry const* factionEntry) uint32 GetReputationRankStrIndex(FactionEntry const* factionEntry) const
{ {
return ReputationRankStrIndex[GetRank(factionEntry)]; return ReputationRankStrIndex[GetRank(factionEntry)];
}; };
+1 -3
View File
@@ -364,9 +364,7 @@ void Map::ScriptsProcess()
break; break;
} }
} }
// Some information for error messages
std::string tableName = GetScriptsTableNameByType(step.script->type);
std::string commandName = GetScriptCommandName(step.script->command);
switch (step.script->command) switch (step.script->command)
{ {
case SCRIPT_COMMAND_TALK: case SCRIPT_COMMAND_TALK:
@@ -2299,10 +2299,6 @@ void UnitAura::Remove(AuraRemoveMode removeMode)
void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster) void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
{ {
Player* modOwner = NULL;
if (caster)
modOwner = caster->GetSpellModOwner();
for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex) for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex)
{ {
if (!HasEffect(effIndex)) if (!HasEffect(effIndex))
+1 -1
View File
@@ -5857,7 +5857,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
} }
// Bonus from spells that increase reputation gain // Bonus from spells that increase reputation gain
float bonus = rep_change * _player->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN) / 100.0; // 10% float bonus = rep_change * _player->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN) / 100.0f; // 10%
rep_change += (int32)bonus; rep_change += (int32)bonus;
_player->GetReputationMgr().ModifyReputation(factionEntry, rep_change); _player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
+2 -2
View File
@@ -313,10 +313,10 @@ public:
{ {
if (!creature->IsHostileTo(player)) if (!creature->IsHostileTo(player))
{ {
uint32 Spell = 0;
if (FactionTemplateEntry const* pFaction = creature->getFactionTemplateEntry()) if (FactionTemplateEntry const* pFaction = creature->getFactionTemplateEntry())
{ {
uint32 Spell = 0;
switch(pFaction->faction) switch(pFaction->faction)
{ {
case 1011: Spell = SPELL_REP_LC; break; case 1011: Spell = SPELL_REP_LC; break;
+6 -7
View File
@@ -379,17 +379,16 @@ bool processArgv(int argc, char ** argv, const char *versionString)
{ {
bool result = true; bool result = true;
hasInputPathParam = false; hasInputPathParam = false;
bool preciseVectorData = false;
for(int i=1; i< argc; ++i) for (int i=1; i < argc; ++i)
{ {
if(strcmp("-s",argv[i]) == 0) if (strcmp("-s", argv[i]) == 0)
{ {
preciseVectorData = false; preciseVectorData = false;
} }
else if(strcmp("-d",argv[i]) == 0) else if (strcmp("-d", argv[i]) == 0)
{ {
if((i+1)<argc) if ((i + 1) < argc)
{ {
hasInputPathParam = true; hasInputPathParam = true;
strcpy(input_path, argv[i+1]); strcpy(input_path, argv[i+1]);
@@ -402,11 +401,11 @@ bool processArgv(int argc, char ** argv, const char *versionString)
result = false; result = false;
} }
} }
else if(strcmp("-?",argv[1]) == 0) else if (strcmp("-?", argv[1]) == 0)
{ {
result = false; result = false;
} }
else if(strcmp("-l",argv[i]) == 0) else if (strcmp("-l", argv[i]) == 0)
{ {
preciseVectorData = true; preciseVectorData = true;
} }