Local variable reassigned prior to reading

Local variable is reassigned in all paths prior to being read.
This commit is contained in:
Wolverine 2017-08-24 13:38:39 -06:00 committed by MadMax
parent 38ab864468
commit 021aa8cfac
23 changed files with 59 additions and 91 deletions

View File

@ -1171,7 +1171,7 @@ bool ChatHandler::HandleModifyMountCommand(char* args)
if (!*args) if (!*args)
{ return false; } { return false; }
uint16 mId = 1147; uint16 mId;
float speed = (float)15; float speed = (float)15;
uint32 num = atoi(args); uint32 num = atoi(args);
switch (num) switch (num)

View File

@ -1976,11 +1976,8 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
{ mtype = RANDOM_MOTION_TYPE; } { mtype = RANDOM_MOTION_TYPE; }
Creature* pCreature = getSelectedCreature(); Creature* pCreature = getSelectedCreature();
uint32 u_guidlow = 0;
if (pCreature) if (!pCreature)
{ u_guidlow = pCreature->GetGUIDLow(); }
else
{ return false; } { return false; }
pCreature->SetRespawnRadius((float)option); pCreature->SetRespawnRadius((float)option);
@ -1992,7 +1989,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
pCreature->Respawn(); pCreature->Respawn();
} }
WorldDatabase.PExecuteLog("UPDATE creature SET spawndist=%f, MovementType=%i WHERE guid=%u", option, mtype, u_guidlow); WorldDatabase.PExecuteLog("UPDATE creature SET spawndist=%f, MovementType=%i WHERE guid=%u", option, mtype, pCreature->GetGUIDLow());
PSendSysMessage(LANG_COMMAND_SPAWNDIST, option); PSendSysMessage(LANG_COMMAND_SPAWNDIST, option);
return true; return true;
} }
@ -2339,10 +2336,10 @@ bool ChatHandler::HandlePInfoCommand(char* args)
if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name)) if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name))
{ return false; } { return false; }
uint32 accId = 0; uint32 accId;
uint32 money = 0; uint32 money;
uint32 total_player_time = 0; uint32 total_player_time;
uint32 level = 0; uint32 level;
uint32 latency = 0; uint32 latency = 0;
// get additional information from Player object // get additional information from Player object
@ -2910,7 +2907,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
WaypointPathOrigin wpDestination = PATH_NO_PATH; ///< into which storage WaypointPathOrigin wpDestination = PATH_NO_PATH; ///< into which storage
int32 wpPathId = 0; ///< along which path int32 wpPathId = 0; ///< along which path
uint32 wpPointId = 0; ///< pointId if a waypoint was selected, in this case insert after uint32 wpPointId = 0; ///< pointId if a waypoint was selected, in this case insert after
Creature* wpOwner = NULL; Creature* wpOwner;
if (targetCreature) if (targetCreature)
{ {
@ -3104,7 +3101,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
// Did user provide a GUID or did the user select a creature? // Did user provide a GUID or did the user select a creature?
Creature* targetCreature = getSelectedCreature(); // Expect a visual waypoint to be selected Creature* targetCreature = getSelectedCreature(); // Expect a visual waypoint to be selected
Creature* wpOwner = NULL; // Who moves along the waypoint Creature* wpOwner; // Who moves along the waypoint
uint32 wpId = 0; uint32 wpId = 0;
WaypointPathOrigin wpSource = PATH_NO_PATH; WaypointPathOrigin wpSource = PATH_NO_PATH;
int32 wpPathId = 0; int32 wpPathId = 0;
@ -3357,7 +3354,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
} }
} }
Creature* wpOwner = NULL; ///< Npc that is moving Creature* wpOwner; ///< Npc that is moving
TemporarySummonWaypoint* wpTarget = NULL; // Define here for wp-info command TemporarySummonWaypoint* wpTarget = NULL; // Define here for wp-info command
// Show info for the selected waypoint (Step one: get moving npc) // Show info for the selected waypoint (Step one: get moving npc)
@ -3508,7 +3505,7 @@ bool ChatHandler::HandleWpExportCommand(char* args)
if (!*args) if (!*args)
return false; return false;
Creature* wpOwner = NULL; Creature* wpOwner;
WaypointPathOrigin wpOrigin = PATH_NO_PATH; WaypointPathOrigin wpOrigin = PATH_NO_PATH;
int32 wpPathId = 0; int32 wpPathId = 0;

View File

@ -5677,7 +5677,7 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
case CHASE_MOTION_TYPE: case CHASE_MOTION_TYPE:
{ {
Unit* target = NULL; Unit* target;
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->GetTypeId() == TYPEID_PLAYER)
{ target = static_cast<ChaseMovementGenerator<Player> const*>(*itr)->GetTarget(); } { target = static_cast<ChaseMovementGenerator<Player> const*>(*itr)->GetTarget(); }
else else
@ -5693,7 +5693,7 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
} }
case FOLLOW_MOTION_TYPE: case FOLLOW_MOTION_TYPE:
{ {
Unit* target = NULL; Unit* target;
if (unit->GetTypeId() == TYPEID_PLAYER) if (unit->GetTypeId() == TYPEID_PLAYER)
{ target = static_cast<FollowMovementGenerator<Player> const*>(*itr)->GetTarget(); } { target = static_cast<FollowMovementGenerator<Player> const*>(*itr)->GetTarget(); }
else else
@ -5770,7 +5770,7 @@ bool ChatHandler::HandleServerPLimitCommand(char* args)
uint32 pLimit = sWorld.GetPlayerAmountLimit(); uint32 pLimit = sWorld.GetPlayerAmountLimit();
AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit(); AccountTypes allowedAccountType = sWorld.GetPlayerSecurityLimit();
char const* secName = ""; char const* secName;
switch (allowedAccountType) switch (allowedAccountType)
{ {
case SEC_PLAYER: secName = "Player"; break; case SEC_PLAYER: secName = "Player"; break;

View File

@ -409,7 +409,7 @@ void PathFinder::BuildPointPath(const float* startPoint, const float* endPoint)
{ {
float pathPoints[MAX_POINT_PATH_LENGTH * VERTEX_SIZE]; float pathPoints[MAX_POINT_PATH_LENGTH * VERTEX_SIZE];
uint32 pointCount = 0; uint32 pointCount = 0;
dtStatus dtResult = DT_FAILURE; dtStatus dtResult;
if (m_useStraightPath) if (m_useStraightPath)
{ {
dtResult = m_navMeshQuery->findStraightPath( dtResult = m_navMeshQuery->findStraightPath(

View File

@ -988,7 +988,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
} }
case ACTION_T_SUMMON_UNIQUE: //49 case ACTION_T_SUMMON_UNIQUE: //49
{ {
Creature* pCreature = NULL; Creature* pCreature;
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, action.summon_unique.creatureId, true, false, 100, true); MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_creature, action.summon_unique.creatureId, true, false, 100, true);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, u_check); MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pCreature, u_check);

View File

@ -1313,7 +1313,7 @@ namespace MaNGOS
: i_object(obj), i_msgtype(msgtype), i_textData(textData), i_language(language), i_target(target) {} : i_object(obj), i_msgtype(msgtype), i_textData(textData), i_language(language), i_target(target) {}
void operator()(WorldPacket& data, int32 loc_idx) void operator()(WorldPacket& data, int32 loc_idx)
{ {
char const* text = NULL; char const* text;
if ((int32)i_textData->Content.size() > loc_idx + 1 && !i_textData->Content[loc_idx + 1].empty()) if ((int32)i_textData->Content.size() > loc_idx + 1 && !i_textData->Content[loc_idx + 1].empty())
{ text = i_textData->Content[loc_idx + 1].c_str(); } { text = i_textData->Content[loc_idx + 1].c_str(); }
else else

View File

@ -13505,13 +13505,7 @@ void Player::TalkedToCreature(uint32 entry, ObjectGuid guid)
// skip spell casts and Gameobject objectives // skip spell casts and Gameobject objectives
if (qInfo->ReqSpell[j] > 0 || qInfo->ReqCreatureOrGOId[j] < 0) if (qInfo->ReqSpell[j] > 0 || qInfo->ReqCreatureOrGOId[j] < 0)
{ continue; } { continue; }
uint32 reqTarget = qInfo->ReqCreatureOrGOId[j];
uint32 reqTarget = 0;
if (qInfo->ReqCreatureOrGOId[j] > 0) // creature activate objectives
// checked at quest_template loading
{ reqTarget = qInfo->ReqCreatureOrGOId[j]; }
else
{ continue; } { continue; }
if (reqTarget == entry) if (reqTarget == entry)
@ -17059,13 +17053,12 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
uint32 totalcost = 0; uint32 totalcost = 0;
uint32 prevnode = sourcenode; uint32 prevnode = sourcenode;
uint32 lastnode = 0;
for (uint32 i = 1; i < nodes.size(); ++i) for (uint32 i = 1; i < nodes.size(); ++i)
{ {
uint32 path, cost; uint32 path, cost;
lastnode = nodes[i]; uint32 lastnode = nodes[i];
sObjectMgr.GetTaxiPath(prevnode, lastnode, path, cost); sObjectMgr.GetTaxiPath(prevnode, lastnode, path, cost);
if (!path) if (!path)
@ -17162,7 +17155,6 @@ void Player::ContinueTaxiFlight()
TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path]; TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
float distPrev = MAP_SIZE * MAP_SIZE;
float distNext = float distNext =
(nodeList[0].x - GetPositionX()) * (nodeList[0].x - GetPositionX()) + (nodeList[0].x - GetPositionX()) * (nodeList[0].x - GetPositionX()) +
(nodeList[0].y - GetPositionY()) * (nodeList[0].y - GetPositionY()) + (nodeList[0].y - GetPositionY()) * (nodeList[0].y - GetPositionY()) +
@ -17177,7 +17169,7 @@ void Player::ContinueTaxiFlight()
if (node.mapid != GetMapId()) if (node.mapid != GetMapId())
{ continue; } { continue; }
distPrev = distNext; float distPrev = distNext;
distNext = distNext =
(node.x - GetPositionX()) * (node.x - GetPositionX()) + (node.x - GetPositionX()) * (node.x - GetPositionX()) +

View File

@ -332,9 +332,6 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
if (!result) if (!result)
{ return social; } { return social; }
uint32 friend_guid = 0;
uint32 flags = 0;
// used to speed up check below. Using GetNumberOfSocialsWithFlag will cause unneeded iteration // used to speed up check below. Using GetNumberOfSocialsWithFlag will cause unneeded iteration
uint32 friendCounter = 0, ignoreCounter = 0; uint32 friendCounter = 0, ignoreCounter = 0;
@ -342,8 +339,8 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
friend_guid = fields[0].GetUInt32(); uint32 friend_guid = fields[0].GetUInt32();
flags = fields[1].GetUInt32(); uint32 flags = fields[1].GetUInt32();
if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT) if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT)
{ continue; } { continue; }

View File

@ -1619,7 +1619,6 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
damageInfo->HitInfo |= HITINFO_GLANCING; damageInfo->HitInfo |= HITINFO_GLANCING;
damageInfo->TargetState = VICTIMSTATE_NORMAL; damageInfo->TargetState = VICTIMSTATE_NORMAL;
damageInfo->procEx |= PROC_EX_NORMAL_HIT; damageInfo->procEx |= PROC_EX_NORMAL_HIT;
float reducePercent = 1.0f; // damage factor
// calculate base values and mods // calculate base values and mods
float baseLowEnd = 1.3f; float baseLowEnd = 1.3f;
float baseHighEnd = 1.2f; float baseHighEnd = 1.2f;
@ -1662,7 +1661,7 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
if (lowEnd > highEnd) // prevent negative range size if (lowEnd > highEnd) // prevent negative range size
{ lowEnd = highEnd; } { lowEnd = highEnd; }
reducePercent = lowEnd + rand_norm_f() * (highEnd - lowEnd); float reducePercent = lowEnd + rand_norm_f() * (highEnd - lowEnd);
damageInfo->cleanDamage += damageInfo->damage - uint32(reducePercent * damageInfo->damage); damageInfo->cleanDamage += damageInfo->damage - uint32(reducePercent * damageInfo->damage);
damageInfo->damage = uint32(reducePercent * damageInfo->damage); damageInfo->damage = uint32(reducePercent * damageInfo->damage);
@ -1865,7 +1864,6 @@ void Unit::HandleEmote(uint32 emote_id)
uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage) uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
{ {
uint32 newdamage = 0;
float armor = (float)pVictim->GetArmor(); float armor = (float)pVictim->GetArmor();
// Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
@ -1884,7 +1882,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
if (tmpvalue > 0.75f) if (tmpvalue > 0.75f)
{ tmpvalue = 0.75f; } { tmpvalue = 0.75f; }
newdamage = uint32(damage - (damage * tmpvalue)); uint32 newdamage = uint32(damage - (damage * tmpvalue));
return (newdamage > 1) ? newdamage : 1; return (newdamage > 1) ? newdamage : 1;
} }
@ -2944,7 +2942,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit* pVict
uint32 Unit::GetWeaponSkillValue(WeaponAttackType attType, Unit const* target) const uint32 Unit::GetWeaponSkillValue(WeaponAttackType attType, Unit const* target) const
{ {
uint32 value = 0; uint32 value;
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
{ {
Item* item = ((Player*)this)->GetWeaponForAttack(attType, true, true); Item* item = ((Player*)this)->GetWeaponForAttack(attType, true, true);
@ -6621,8 +6619,6 @@ bool Unit::IsTargetableForAttack(bool inverseAlive /*=false*/) const
int32 Unit::ModifyHealth(int32 dVal) int32 Unit::ModifyHealth(int32 dVal)
{ {
int32 gain = 0;
if (dVal == 0) if (dVal == 0)
{ return 0; } { return 0; }
@ -6637,6 +6633,7 @@ int32 Unit::ModifyHealth(int32 dVal)
int32 maxHealth = (int32)GetMaxHealth(); int32 maxHealth = (int32)GetMaxHealth();
int32 gain;
if (val < maxHealth) if (val < maxHealth)
{ {
SetHealth(val); SetHealth(val);
@ -6653,8 +6650,6 @@ int32 Unit::ModifyHealth(int32 dVal)
int32 Unit::ModifyPower(Powers power, int32 dVal) int32 Unit::ModifyPower(Powers power, int32 dVal)
{ {
int32 gain = 0;
if (dVal == 0) if (dVal == 0)
{ return 0; } { return 0; }
@ -6669,6 +6664,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal)
int32 maxPower = (int32)GetMaxPower(power); int32 maxPower = (int32)GetMaxPower(power);
int32 gain;
if (val < maxPower) if (val < maxPower)
{ {
SetPower(power, val); SetPower(power, val);
@ -7610,7 +7606,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
return false; return false;
} }
float val = 1.0f; float val;
switch (modifierType) switch (modifierType)
{ {

View File

@ -153,7 +153,7 @@ void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
void OutdoorPvPEP::HandleObjectiveComplete(uint32 eventId, const std::list<Player*> &players, Team team) void OutdoorPvPEP::HandleObjectiveComplete(uint32 eventId, const std::list<Player*> &players, Team team)
{ {
uint32 credit = 0; uint32 credit;
switch (eventId) switch (eventId)
{ {

View File

@ -282,7 +282,7 @@ void StoreGUID(QueryResult* result, uint32 data, uint32 field, std::set<uint32>&
void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char const* tableFrom, char const* tableTo, DumpTableType type) void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char const* tableFrom, char const* tableTo, DumpTableType type)
{ {
GUIDs const* guids = NULL; GUIDs const* guids = NULL;
char const* fieldname = NULL; char const* fieldname;
switch (type) switch (type)
{ {
@ -420,7 +420,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (!fin) if (!fin)
{ return DUMP_FILE_OPEN_ERROR; } { return DUMP_FILE_OPEN_ERROR; }
QueryResult* result = NULL; QueryResult* result;
char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20]; char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];
// make sure the same guid doesn't already exist and is safe to use // make sure the same guid doesn't already exist and is safe to use

View File

@ -2013,8 +2013,6 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap)
bool PvP = pVictim->IsCharmedOwnedByPlayerOrPlayer(); bool PvP = pVictim->IsCharmedOwnedByPlayerOrPlayer();
// prepare data for near group iteration (PvP and !PvP cases) // prepare data for near group iteration (PvP and !PvP cases)
uint32 xp = 0;
uint32 count = 0; uint32 count = 0;
uint32 sum_level = 0; uint32 sum_level = 0;
Player* member_with_max_level = NULL; Player* member_with_max_level = NULL;
@ -2025,7 +2023,7 @@ void Group::RewardGroupAtKill(Unit* pVictim, Player* player_tap)
if (member_with_max_level) if (member_with_max_level)
{ {
/// not get Xp in PvP or no not gray players in group /// not get Xp in PvP or no not gray players in group
xp = (PvP || !not_gray_member_with_max_level) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, pVictim); uint32 xp = (PvP || !not_gray_member_with_max_level) ? 0 : MaNGOS::XP::Gain(not_gray_member_with_max_level, pVictim);
/// skip in check PvP case (for speed, not used) /// skip in check PvP case (for speed, not used)
bool is_raid = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup(); bool is_raid = PvP ? false : sMapStore.LookupEntry(pVictim->GetMapId())->IsRaid() && isRaidGroup();

View File

@ -2306,7 +2306,7 @@ bool Map::GetReachableRandomPointOnGround(float& x, float& y, float& z, float ra
if (delta > 0.0f) // check to avoid divide by 0 if (delta > 0.0f) // check to avoid divide by 0
{ {
// compute slope // compute slope
slope = atan(ac / delta); float slope = atan(ac / delta);
if (slope < MAX_SLOPE_IN_RADIAN) if (slope < MAX_SLOPE_IN_RADIAN)
{ {
x = i_x; x = i_x;

View File

@ -102,12 +102,11 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
{ {
ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL) ACE_GUARD_RETURN(LOCK_TYPE, _guard, m_lock, NULL)
Map* m = NULL;
const MapEntry* entry = sMapStore.LookupEntry(id); const MapEntry* entry = sMapStore.LookupEntry(id);
if (!entry) if (!entry)
{ return NULL; } { return NULL; }
Map* m;
if (entry->Instanceable()) if (entry->Instanceable())
{ {
MANGOS_ASSERT(obj && obj->GetTypeId() == TYPEID_PLAYER); MANGOS_ASSERT(obj && obj->GetTypeId() == TYPEID_PLAYER);
@ -310,7 +309,7 @@ Map* MapManager::CreateInstance(uint32 id, Player* player)
{ {
Map* map = NULL; Map* map = NULL;
Map* pNewMap = NULL; Map* pNewMap = NULL;
uint32 NewInstanceId = 0; // instanceId of the resulting map uint32 NewInstanceId; // instanceId of the resulting map
const MapEntry* entry = sMapStore.LookupEntry(id); const MapEntry* entry = sMapStore.LookupEntry(id);
if (entry->IsBattleGround()) if (entry->IsBattleGround())

View File

@ -612,8 +612,6 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) for (GuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
{ {
uint8 dialogStatus = DIALOG_STATUS_NONE;
if (itr->IsAnyTypeCreature()) if (itr->IsAnyTypeCreature())
{ {
// need also pet quests case support // need also pet quests case support
@ -625,7 +623,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
{ continue; } { continue; }
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver); uint8 dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus == DIALOG_STATUS_UNDEFINED) if (dialogStatus == DIALOG_STATUS_UNDEFINED)
{ dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); } { dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); }
@ -644,7 +642,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
{ continue; } { continue; }
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver); uint8 dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus == DIALOG_STATUS_UNDEFINED) if (dialogStatus == DIALOG_STATUS_UNDEFINED)
{ dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); } { dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE); }

View File

@ -353,8 +353,7 @@ void ScriptMgr::LoadScripts(DBScriptType type)
} }
case SCRIPT_COMMAND_RESPAWN_GO: // 9 case SCRIPT_COMMAND_RESPAWN_GO: // 9
{ {
uint32 goEntry = 0; uint32 goEntry;
if (!tmp.GetGOGuid()) if (!tmp.GetGOGuid())
{ {
if (!tmp.buddyEntry) if (!tmp.buddyEntry)
@ -409,8 +408,7 @@ void ScriptMgr::LoadScripts(DBScriptType type)
case SCRIPT_COMMAND_OPEN_DOOR: // 11 case SCRIPT_COMMAND_OPEN_DOOR: // 11
case SCRIPT_COMMAND_CLOSE_DOOR: // 12 case SCRIPT_COMMAND_CLOSE_DOOR: // 12
{ {
uint32 goEntry = 0; uint32 goEntry;
if (!tmp.GetGOGuid()) if (!tmp.GetGOGuid())
{ {
if (!tmp.buddyEntry) if (!tmp.buddyEntry)
@ -1336,9 +1334,7 @@ bool ScriptAction::HandleScriptStep()
} }
case SCRIPT_COMMAND_RESPAWN_GO: // 9 case SCRIPT_COMMAND_RESPAWN_GO: // 9
{ {
GameObject* pGo = NULL; GameObject* pGo;
uint32 time_to_despawn = m_script->respawnGo.despawnDelay < 5 ? 5 : m_script->respawnGo.despawnDelay;
if (m_script->respawnGo.goGuid) if (m_script->respawnGo.goGuid)
{ {
GameObjectData const* goData = sObjectMgr.GetGOData(m_script->respawnGo.goGuid); GameObjectData const* goData = sObjectMgr.GetGOData(m_script->respawnGo.goGuid);
@ -1372,6 +1368,8 @@ bool ScriptAction::HandleScriptStep()
if (pGo->isSpawned()) if (pGo->isSpawned())
{ break; } // gameobject already spawned { break; } // gameobject already spawned
uint32 time_to_despawn = m_script->respawnGo.despawnDelay < 5 ? 5 : m_script->respawnGo.despawnDelay;
pGo->SetLootState(GO_READY); pGo->SetLootState(GO_READY);
pGo->SetRespawnTime(time_to_despawn); // despawn object in ? seconds pGo->SetRespawnTime(time_to_despawn); // despawn object in ? seconds
pGo->Refresh(); pGo->Refresh();

View File

@ -787,7 +787,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex)
if (speed > 0.0f && affectiveObject && (pVictim != affectiveObject || (m_targets.m_targetMask & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION)))) if (speed > 0.0f && affectiveObject && (pVictim != affectiveObject || (m_targets.m_targetMask & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION))))
{ {
// calculate spell incoming interval // calculate spell incoming interval
float dist = 0.0f; // distance to impact float dist; // distance to impact
if (pVictim == affectiveObject) // Calculate dist to destination target also for self-cast spells if (pVictim == affectiveObject) // Calculate dist to destination target also for self-cast spells
{ {
if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
@ -4951,7 +4951,7 @@ SpellCastResult Spell::CheckCast(bool strict)
} }
// get the lock entry // get the lock entry
uint32 lockId = 0; uint32 lockId;
if (GameObject* go = m_targets.getGOTarget()) if (GameObject* go = m_targets.getGOTarget())
{ {
// Prevent opening two times a chest in same time. // Prevent opening two times a chest in same time.

View File

@ -1187,8 +1187,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
case 28834: // Mark of Rivendare case 28834: // Mark of Rivendare
case 28835: // Mark of Zeliek case 28835: // Mark of Zeliek
{ {
int32 damage = 0; int32 damage;
switch (GetStackAmount()) switch (GetStackAmount())
{ {
case 1: case 1:
@ -2458,8 +2457,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
if (!caster || caster->GetTypeId() != TYPEID_PLAYER) if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
{ return; } { return; }
uint32 spell_id = 0; uint32 spell_id;
switch (GetId()) switch (GetId())
{ {
case 19386: spell_id = 24131; break; case 19386: spell_id = 24131; break;

View File

@ -436,7 +436,7 @@ WaypointNode const* WaypointManager::AddNode(uint32 entry, uint32 dbGuid, uint32
// Prepare information // Prepare information
char const* const table = wpDest == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template"; char const* const table = wpDest == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
char const* const key_field = wpDest == PATH_FROM_GUID ? "id" : "entry"; char const* const key_field = wpDest == PATH_FROM_GUID ? "id" : "entry";
uint32 const key = wpDest == PATH_FROM_GUID ? dbGuid : ((entry << 8) /*+ pathId*/); uint32 key = wpDest == PATH_FROM_GUID ? dbGuid : ((entry << 8) /*+ pathId*/);
WaypointPathMap* wpMap = wpDest == PATH_FROM_GUID ? &m_pathMap : &m_pathTemplateMap; WaypointPathMap* wpMap = wpDest == PATH_FROM_GUID ? &m_pathMap : &m_pathTemplateMap;
WaypointPath& path = (*wpMap)[key]; WaypointPath& path = (*wpMap)[key];

View File

@ -1964,7 +1964,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_
std::string safe_author = author; std::string safe_author = author;
LoginDatabase.escape_string(safe_author); LoginDatabase.escape_string(safe_author);
QueryResult* resultAccounts = NULL; // used for kicking QueryResult* resultAccounts; // used for kicking
///- Update the database with ban information ///- Update the database with ban information
switch (mode) switch (mode)

View File

@ -49,7 +49,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
} }
// calculate extents // calculate extents
int axis = -1, rightOrig; int axis = -1, rightOrig;
float clipL = G3D::fnan(), clipR = G3D::fnan(), prevClip = G3D::fnan(); float clipL;
float clipR;
float prevClip = G3D::fnan();
float split = G3D::fnan(); float split = G3D::fnan();
bool wasLeft = true; bool wasLeft = true;
while (true) while (true)

View File

@ -180,7 +180,6 @@ namespace VMAP
bool StaticMapTree::getObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const bool StaticMapTree::getObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const
{ {
bool result = false;
float maxDist = (pPos2 - pPos1).magnitude(); float maxDist = (pPos2 - pPos1).magnitude();
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too: // valid map coords should *never ever* produce float overflow, but this would produce NaNs too:
MANGOS_ASSERT(maxDist < std::numeric_limits<float>::max()); MANGOS_ASSERT(maxDist < std::numeric_limits<float>::max());
@ -211,14 +210,9 @@ namespace VMAP
{ {
pResultHitPos = pResultHitPos + dir * pModifyDist; pResultHitPos = pResultHitPos + dir * pModifyDist;
} }
result = true;
} }
else
{
pResultHitPos = pPos2; pResultHitPos = pPos2;
result = false; return false;
}
return result;
} }
//========================================================= //=========================================================

View File

@ -216,14 +216,13 @@ namespace VMAP
return false; return false;
} }
printf("Read coordinate mapping...\n"); printf("Read coordinate mapping...\n");
uint32 mapID, tileX, tileY, check = 0; uint32 mapID, tileX, tileY;
G3D::Vector3 v1, v2; G3D::Vector3 v1, v2;
ModelSpawn spawn; ModelSpawn spawn;
while (!feof(dirf)) while (!feof(dirf))
{ {
check = 0;
// read mapID, tileX, tileY, Flags, adtID, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name // read mapID, tileX, tileY, Flags, adtID, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
check += fread(&mapID, sizeof(uint32), 1, dirf); uint32 check = fread(&mapID, sizeof(uint32), 1, dirf);
if (check == 0) // EoF... if (check == 0) // EoF...
{ break; } { break; }
check += fread(&tileX, sizeof(uint32), 1, dirf); check += fread(&tileX, sizeof(uint32), 1, dirf);