Core/Misc: Fixing warnings detected by Visual Studio 2015 compiler

This commit is contained in:
Shauren
2015-07-21 00:33:36 +02:00
parent 5987391073
commit a22e4e121a
47 changed files with 311 additions and 322 deletions
+4 -2
View File
@@ -51,8 +51,10 @@ message(STATUS "MSVC: Disabled NON-SECURE warnings")
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
message(STATUS "MSVC: Disabled POSIX warnings")
# Ignore C4351: new behavior: elements of array 'x' will be default initialized
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4351")
# Ignore specific warnings
# C4351: new behavior: elements of array 'x' will be default initialized
# C4091: 'typedef ': ignored on left of '' when no variable is declared
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4351 /wd4091")
if(NOT WITH_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512")
@@ -918,8 +918,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
else if (IsUnit(*itr)) // Special handling for vehicles
if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit())
for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->second.Passenger.Guid))
for (SeatMap::iterator seatItr = vehicle->Seats.begin(); seatItr != vehicle->Seats.end(); ++seatItr)
if (Player* player = ObjectAccessor::FindPlayer(seatItr->second.Passenger.Guid))
player->KilledMonsterCredit(e.action.killedMonster.creature);
}
@@ -1754,7 +1754,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsUnit(*itr))
continue;
Unit* unit = (*itr)->ToUnit();
Unit* targetUnit = (*itr)->ToUnit();
bool interruptedSpell = false;
@@ -1767,11 +1767,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (!interruptedSpell && e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
{
unit->InterruptNonMeleeSpells(false);
targetUnit->InterruptNonMeleeSpells(false);
interruptedSpell = true;
}
unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
targetUnit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*it)->GetGUID().ToString().c_str());
@@ -1380,10 +1380,10 @@ bool BattlegroundAV::SetupBattleground()
//creatures
TC_LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
for (BG_AV_Nodes n = BG_AV_NODES_FIRSTAID_STATION; n < BG_AV_NODES_MAX; ++n)
{
if (m_Nodes[i].Owner)
PopulateNode(i);
if (m_Nodes[n].Owner)
PopulateNode(n);
}
//all creatures which don't get despawned through the script are static
TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
@@ -496,62 +496,62 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
}
}
void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint)
void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node)
{
//updating worldstate
if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTROLLED])
nodePoint->nodeState = NODE_STATE_CONTROLLED_A;
else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTESTED])
nodePoint->nodeState = NODE_STATE_CONFLICT_A;
else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTROLLED])
nodePoint->nodeState = NODE_STATE_CONTROLLED_H;
else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTESTED])
nodePoint->nodeState = NODE_STATE_CONFLICT_H;
if (node->gameobject_entry == node->banners[BANNER_A_CONTROLLED])
node->nodeState = NODE_STATE_CONTROLLED_A;
else if (node->gameobject_entry == node->banners[BANNER_A_CONTESTED])
node->nodeState = NODE_STATE_CONFLICT_A;
else if (node->gameobject_entry == node->banners[BANNER_H_CONTROLLED])
node->nodeState = NODE_STATE_CONTROLLED_H;
else if (node->gameobject_entry == node->banners[BANNER_H_CONTESTED])
node->nodeState = NODE_STATE_CONFLICT_H;
uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState];
uint32 worldstate = node->worldStates[node->nodeState];
// with this we are sure we dont bug the client
for (uint8 i = 0; i < 5; ++i)
{
if (nodePoint->worldStates[i] == worldstate)
if (node->worldStates[i] == worldstate)
continue;
UpdateWorldState(nodePoint->worldStates[i], 0);
UpdateWorldState(node->worldStates[i], 0);
}
UpdateWorldState(worldstate, 1);
}
uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve)
uint32 BattlegroundIC::GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve)
{
// this is only used in the update map function
if (returnDefinitve)
// here is a special case, here we must return the definitve faction banner after the grey banner was spawned 1 minute
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
// there were no changes, this point has never been captured by any faction or at least clicked
if (nodePoint->last_entry == 0)
if (node->last_entry == 0)
// 1 returns the CONTESTED ALLIANCE BANNER, 3 returns the HORDE one
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the definitive faction banner, we must return the grey banner of the player's faction
if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTROLLED] || nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTROLLED])
return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
if (node->gameobject_entry == node->banners[BANNER_A_CONTROLLED] || node->gameobject_entry == node->banners[BANNER_H_CONTROLLED])
return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the grey faction banner, we must return the previous banner
if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTESTED] || nodePoint->banners[BANNER_H_CONTESTED])
return nodePoint->last_entry;
if (node->gameobject_entry == node->banners[BANNER_A_CONTESTED] || node->banners[BANNER_H_CONTESTED])
return node->last_entry;
// we should never be here...
TC_LOG_ERROR("bg.battleground", "Isle Of Conquest: Unexpected return in GetNextBanner function");
return 0;
}
void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
void BattlegroundIC::HandleContestedNodes(ICNodePoint* node)
{
if (nodePoint->nodeType == NODE_TYPE_HANGAR)
if (node->nodeType == NODE_TYPE_HANGAR)
{
if (gunshipAlliance && gunshipHorde)
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->EnableMovement(false);
(node->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->EnableMovement(false);
for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u <= BG_IC_GO_HANGAR_TELEPORTER_3; ++u)
DelObject(u);
@@ -568,7 +568,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
}
std::list<Creature*> cannons;
if (nodePoint->faction == TEAM_HORDE)
if (node->faction == TEAM_HORDE)
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
@@ -579,22 +579,22 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
cannon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
else if (nodePoint->nodeType == NODE_TYPE_WORKSHOP)
else if (node->nodeType == NODE_TYPE_WORKSHOP)
{
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
}
}
void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture)
{
if (nodePoint->nodeType != NODE_TYPE_REFINERY && nodePoint->nodeType != NODE_TYPE_QUARRY)
if (node->nodeType != NODE_TYPE_REFINERY && node->nodeType != NODE_TYPE_QUARRY)
{
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2, BG_IC_SpiritGuidePos[nodePoint->nodeType], nodePoint->faction))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+node->nodeType-2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", node->nodeType, node->faction);
}
switch (nodePoint->gameobject_type)
switch (node->gameobject_type)
{
case BG_IC_GO_HANGAR_BANNER:
{
@@ -602,7 +602,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
break;
std::list<Creature*> cannons;
if (nodePoint->faction == TEAM_ALLIANCE)
if (node->faction == TEAM_ALLIANCE)
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
@@ -613,20 +613,20 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u], 0, 0, 0, 0, RESPAWN_ONE_DAY))
if (!AddObject(type, (node->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u], 0, 0, 0, 0, RESPAWN_ONE_DAY))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u], 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
if (!AddObject(type, (node->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u], 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
{
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction], nodePoint->faction, RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[node->faction], node->faction, RESPAWN_ONE_DAY, node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
}
@@ -635,24 +635,24 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0], nodePoint->faction, RESPAWN_ONE_DAY))
if (AddCreature(node->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[node->faction == TEAM_ALLIANCE ? 2 : 0], node->faction, RESPAWN_ONE_DAY))
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1], nodePoint->faction, RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
if (!AddCreature(node->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[node->faction == TEAM_ALLIANCE ? 3 : 1], node->faction, RESPAWN_ONE_DAY, node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
}
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
(node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
break;
}
case BG_IC_GO_QUARRY_BANNER:
RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
RemoveAuraOnTeam(SPELL_QUARRY, (node->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_QUARRY, (node->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
break;
case BG_IC_GO_REFINERY_BANNER:
RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
RemoveAuraOnTeam(SPELL_OIL_REFINERY, (node->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
CastSpellOnTeam(SPELL_OIL_REFINERY, (node->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
break;
case BG_IC_GO_DOCKS_BANNER:
if (recapture)
@@ -662,7 +662,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
docksTimer = DOCKS_UPDATE_TIME;
// we must del opposing faction vehicles when the node is captured (unused ones)
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
{
if (Creature* glaiveThrower = GetBGCreature(i, false))
{
@@ -674,7 +674,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
{
if (Creature* catapult = GetBGCreature(i, false))
{
@@ -689,25 +689,25 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
// spawning glaive throwers
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, BG_IC_DocksVehiclesGlaives[i], nodePoint->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
if (AddCreature(node->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, BG_IC_DocksVehiclesGlaives[i], node->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
// spawning catapults
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
if (AddCreature(NPC_CATAPULT, type, BG_IC_DocksVehiclesCatapults[i], nodePoint->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
if (AddCreature(NPC_CATAPULT, type, BG_IC_DocksVehiclesCatapults[i], node->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
break;
case BG_IC_GO_WORKSHOP_BANNER:
@@ -718,7 +718,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (!recapture)
{
// we must del opposing faction vehicles when the node is captured (unused ones)
for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
{
if (Creature* demolisher = GetBGCreature(i, false))
{
@@ -733,17 +733,17 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
if (AddCreature(NPC_DEMOLISHER, type, BG_IC_WorkshopVehicles[i], nodePoint->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
if (AddCreature(NPC_DEMOLISHER, type, BG_IC_WorkshopVehicles[i], node->faction, RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
// we check if the opossing siege engine is in use
int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
int8 enemySiege = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
if (Creature* siegeEngine = GetBGCreature(enemySiege, false))
{
@@ -755,16 +755,16 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
uint8 siegeType = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (!GetBGCreature(siegeType, false) || !GetBGCreature(siegeType)->IsAlive())
{
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
BG_IC_WorkshopVehicles[4], nodePoint->faction, RESPAWN_ONE_DAY);
AddCreature((node->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
BG_IC_WorkshopVehicles[4], node->faction, RESPAWN_ONE_DAY);
if (Creature* siegeEngine = GetBGCreature(siegeType))
{
siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC);
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
siegeEngine->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
}
}
@@ -779,7 +779,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
{
seaforiumBombs->SetRespawnTime(10);
seaforiumBombs->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
seaforiumBombs->SetFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
}
break;
@@ -967,7 +967,7 @@ class BattlegroundIC : public Battleground
Transport* gunshipAlliance;
Transport* gunshipHorde;
uint32 GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve);
uint32 GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve);
uint32 GetGateIDFromEntry(uint32 id)
{
@@ -1012,9 +1012,9 @@ class BattlegroundIC : public Battleground
return uws;
}
void UpdateNodeWorldState(ICNodePoint* nodePoint);
void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
void HandleContestedNodes(ICNodePoint* nodePoint);
void UpdateNodeWorldState(ICNodePoint* node);
void HandleCapturedNodes(ICNodePoint* node, bool recapture);
void HandleContestedNodes(ICNodePoint* node);
};
#endif
+1 -1
View File
@@ -538,7 +538,7 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
{
if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
if (guild)
guild->BroadcastPacket(&data);
}
else
+2 -2
View File
@@ -270,9 +270,9 @@ inline void LoadGameTable(StoreProblemList& errors, std::string const& tableName
if (!gt)
continue;
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
for (uint32 l = 0; l < TOTAL_LOCALES; ++l)
{
if (tableName == gt->Name->Str[i])
if (tableName == gt->Name->Str[l])
{
found = true;
storage.SetGameTableEntry(gt);
@@ -2338,12 +2338,12 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
}
else if (index == GAMEOBJECT_FLAGS)
{
uint32 flags = m_uint32Values[GAMEOBJECT_FLAGS];
uint32 goFlags = m_uint32Values[GAMEOBJECT_FLAGS];
if (GetGoType() == GAMEOBJECT_TYPE_CHEST)
if (GetGOInfo()->chest.usegrouplootrules && !IsLootAllowedFor(target))
flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
goFlags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
fieldBuffer << flags;
fieldBuffer << goFlags;
}
else if (index == GAMEOBJECT_LEVEL)
{
+2 -2
View File
@@ -2867,8 +2867,8 @@ void WorldObject::UpdateAreaPhase()
{
bool up = false;
uint32 phaseGroup = uint32((*itr)->GetMiscValueB());
std::set<uint32> const& phases = sDB2Manager.GetPhasesForGroup(phaseGroup);
for (uint32 phase : phases)
std::set<uint32> const& phaseIDs = sDB2Manager.GetPhasesForGroup(phaseGroup);
for (uint32 phase : phaseIDs)
up = SetInPhase(phase, false, true);
if (!updateNeeded && up)
updateNeeded = true;
+1 -1
View File
@@ -336,7 +336,7 @@ struct MovementInfo
bool HasExtraMovementFlag(uint16 flag) const { return (flags2 & flag) != 0; }
uint32 GetFallTime() const { return jump.fallTime; }
void SetFallTime(uint32 time) { jump.fallTime = time; }
void SetFallTime(uint32 fallTime) { jump.fallTime = fallTime; }
void ResetTransport()
{
+2 -2
View File
@@ -344,10 +344,10 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (getPetType() == HUNTER_PET)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
stmt->setUInt64(0, owner->GetGUID().GetCounter());
stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
result = CharacterDatabase.Query(stmt);
if (result)
{
+3 -3
View File
@@ -7279,7 +7279,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
// stored zone is zero, use generic and slow zone detection
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
stmt->setUInt64(0, guidLow);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
result = CharacterDatabase.Query(stmt);
if (!result)
return 0;
@@ -17713,8 +17713,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
std::map<ObjectGuid, Item*>::iterator itr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
std::map<ObjectGuid, Item*>::iterator invalidBagItr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), invalidBagItr->second) != problematicItems.end())
err = EQUIP_ERR_INTERNAL_BAG_ERROR;
}
else
+7 -7
View File
@@ -8853,12 +8853,12 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* /*spellProto*/, uint32 d
return damage;
}
uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const* effect, uint32 stack) const
uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const* spellEffect, uint32 stack) const
{
// For totems get healing bonus from owner (statue isn't totem in fact)
if (GetTypeId() == TYPEID_UNIT && IsTotem())
if (Unit* owner = GetOwner())
return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effect, stack);
return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, spellEffect, stack);
// No bonus healing for potion spells
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
@@ -8914,11 +8914,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
// Check for table values
float coeff = effect->BonusCoefficient;
float coeff = spellEffect->BonusCoefficient;
float factorMod = 1.0f;
if (effect->BonusCoefficientFromAP > 0.0f)
if (spellEffect->BonusCoefficientFromAP > 0.0f)
{
DoneTotal += int32(effect->BonusCoefficientFromAP * stack * GetTotalAttackPowerValue(
DoneTotal += int32(spellEffect->BonusCoefficientFromAP * stack * GetTotalAttackPowerValue(
(spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
}
else if (coeff <= 0.0f)
@@ -9040,7 +9040,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
return DoneTotalMod;
}
uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType /*damagetype*/, SpellEffectInfo const* effect, uint32 stack) const
uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType /*damagetype*/, SpellEffectInfo const* spellEffect, uint32 stack) const
{
float TakenTotalMod = 1.0f;
@@ -9073,7 +9073,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
}
// Check for table values
float coeff = effect->BonusCoefficient;
float coeff = spellEffect->BonusCoefficient;
float factorMod = 1.0f;
if (coeff <= 0.0f)
{
+2 -2
View File
@@ -85,7 +85,7 @@ bool Garrison::LoadFromDB(PreparedQueryResult garrison, PreparedQueryResult blue
{
do
{
Field* fields = followers->Fetch();
fields = followers->Fetch();
uint64 dbId = fields[0].GetUInt64();
uint32 followerId = fields[1].GetUInt32();
@@ -116,7 +116,7 @@ bool Garrison::LoadFromDB(PreparedQueryResult garrison, PreparedQueryResult blue
{
do
{
Field* fields = abilities->Fetch();
fields = abilities->Fetch();
uint64 dbId = fields[0].GetUInt64();
GarrAbilityEntry const* ability = sGarrAbilityStore.LookupEntry(fields[1].GetUInt32());
+7 -7
View File
@@ -269,21 +269,21 @@ std::list<GarrAbilityEntry const*> GarrisonMgr::RollFollowerAbilities(GarrFollow
genericTraits.unique();
std::size_t firstExclusive = 0, total = genericTraits.size();
for (auto itr = genericTraits.begin(); itr != genericTraits.end(); ++itr, ++firstExclusive)
if ((*itr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
for (auto genericTraitItr = genericTraits.begin(); genericTraitItr != genericTraits.end(); ++genericTraitItr, ++firstExclusive)
if ((*genericTraitItr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
break;
while (traitList.size() < size_t(std::max<int32>(0, slots[1] - forcedTraits.size())) && total)
{
auto itr = genericTraits.begin();
std::advance(itr, urand(0, total-- - 1));
if ((*itr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
auto genericTraitItr = genericTraits.begin();
std::advance(genericTraitItr, urand(0, total-- - 1));
if ((*genericTraitItr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
total = firstExclusive; // selected exclusive trait - no other can be selected now
else
--firstExclusive;
traitList.push_back(*itr);
genericTraits.erase(itr);
traitList.push_back(*genericTraitItr);
genericTraits.erase(genericTraitItr);
}
}
+7 -7
View File
@@ -8150,12 +8150,12 @@ void ObjectMgr::LoadTrainerSpell()
TC_LOG_INFO("server.loading", ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::set<uint32> *skip_vendors)
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 referenceType, std::set<uint32> *skip_vendors)
{
// find all items from the reference vendor
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_NPC_VENDOR_REF);
stmt->setUInt32(0, uint32(item));
stmt->setUInt8(1, type);
stmt->setUInt8(1, referenceType);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -8170,7 +8170,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::se
// if item is a negative, its a reference
if (item_id < 0)
count += LoadReferenceVendor(vendor, -item_id, type, skip_vendors);
count += LoadReferenceVendor(vendor, -item_id, referenceType, skip_vendors);
else
{
int32 maxcount = fields[1].GetUInt32();
@@ -9248,10 +9248,10 @@ void ObjectMgr::LoadRealmNames()
{
Field* fields = result->Fetch();
uint32 realm = fields[0].GetUInt32();
uint32 realmId = fields[0].GetUInt32();
std::string realmName = fields[1].GetString();
_realmNameStore[realm] = realmName;
_realmNameStore[realmId] = realmName;
++count;
}
@@ -9259,9 +9259,9 @@ void ObjectMgr::LoadRealmNames()
TC_LOG_INFO("server.loading", ">> Loaded %u realm names in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
}
std::string ObjectMgr::GetRealmName(uint32 realm) const
std::string ObjectMgr::GetRealmName(uint32 realmId) const
{
RealmNameContainer::const_iterator iter = _realmNameStore.find(realm);
RealmNameContainer::const_iterator iter = _realmNameStore.find(realmId);
return iter != _realmNameStore.end() ? iter->second : "";
}
+1 -1
View File
@@ -646,7 +646,7 @@ bool normalizePlayerName(std::string& name);
struct ExtendedPlayerName
{
ExtendedPlayerName(std::string const& name, std::string const& realm) : Name(name), Realm(realm) { }
ExtendedPlayerName(std::string const& name, std::string const& realmName) : Name(name), Realm(realmName) { }
std::string Name;
std::string Realm;
};
+10 -10
View File
@@ -488,24 +488,24 @@ bool Group::AddMember(Player* player)
if (itr->GetSource() == player)
continue;
if (Player* member = itr->GetSource())
if (Player* existingMember = itr->GetSource())
{
if (player->HaveAtClient(member))
if (player->HaveAtClient(existingMember))
{
member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
member->BuildValuesUpdateBlockForPlayer(&groupData, player);
member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
existingMember->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
existingMember->BuildValuesUpdateBlockForPlayer(&groupData, player);
existingMember->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
}
if (member->HaveAtClient(player))
if (existingMember->HaveAtClient(player))
{
UpdateData newData(player->GetMapId());
WorldPacket newDataPacket;
player->BuildValuesUpdateBlockForPlayer(&newData, member);
player->BuildValuesUpdateBlockForPlayer(&newData, existingMember);
if (newData.HasData())
{
newData.BuildPacket(&newDataPacket);
member->SendDirectMessage(&newDataPacket);
existingMember->SendDirectMessage(&newDataPacket);
}
}
}
@@ -2118,8 +2118,8 @@ void Group::ResetInstances(uint8 method, bool isRaid, bool isLegacy, Player* Sen
{
if (Group* group = SendMsgTo->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* player = itr->GetSource())
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
if (Player* player = groupRef->GetSource())
player->SendResetInstanceSuccess(instanceSave->GetMapId());
}
+1 -1
View File
@@ -501,7 +501,7 @@ void GuildMgr::LoadGuildRewards()
{
do
{
Field* fields = reqAchievementResult->Fetch();
fields = reqAchievementResult->Fetch();
uint32 requiredAchievementId = fields[0].GetUInt32();
+19 -19
View File
@@ -733,7 +733,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, WorldPac
{
if (charTemplate->Level != 1)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt->setUInt8(0, uint8(charTemplate->Level));
stmt->setUInt64(1, newChar.GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
@@ -1604,7 +1604,7 @@ void WorldSession::HandleCharCustomizeCallback(PreparedQueryResult result, World
playerBytes2 &= ~0xFF;
playerBytes2 |= customizeInfo->FacialHairStyleID;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES);
stmt->setUInt8(0, customizeInfo->SexID);
stmt->setUInt32(1, customizeInfo->SkinID | (uint32(customizeInfo->FaceID) << 8) | (uint32(customizeInfo->HairStyleID) << 16) | (uint32(customizeInfo->HairColorID) << 24));
@@ -1639,16 +1639,16 @@ void WorldSession::HandleCharCustomizeCallback(PreparedQueryResult result, World
GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), customizeInfo->CharGUID.ToString().c_str(), customizeInfo->CharName.c_str());
}
void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet)
void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& saveEquipmentSet)
{
if (packet.Set.SetID >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
if (saveEquipmentSet.Set.SetID >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (!(packet.Set.IgnoreMask & (1 << i)))
if (!(saveEquipmentSet.Set.IgnoreMask & (1 << i)))
{
ObjectGuid const& itemGuid = packet.Set.Pieces[i];
ObjectGuid const& itemGuid = saveEquipmentSet.Set.Pieces[i];
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -1661,37 +1661,37 @@ void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipm
return;
}
else
packet.Set.Pieces[i].Clear();
saveEquipmentSet.Set.Pieces[i].Clear();
}
packet.Set.IgnoreMask &= 0x7FFFF; /// clear invalid bits (i > EQUIPMENT_SLOT_END)
saveEquipmentSet.Set.IgnoreMask &= 0x7FFFF; /// clear invalid bits (i > EQUIPMENT_SLOT_END)
_player->SetEquipmentSet(std::move(packet.Set));
_player->SetEquipmentSet(std::move(saveEquipmentSet.Set));
}
void WorldSession::HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& packet)
void WorldSession::HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& deleteEquipmentSet)
{
_player->DeleteEquipmentSet(packet.ID);
_player->DeleteEquipmentSet(deleteEquipmentSet.ID);
}
void WorldSession::HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& packet)
void WorldSession::HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& useEquipmentSet)
{
ObjectGuid ignoredItemGuid;
ignoredItemGuid.SetRawValue(0, 1);
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
TC_LOG_DEBUG("entities.player.items", "%s: ContainerSlot: %u, Slot: %u", packet.Items[i].Item.ToString().c_str(), packet.Items[i].ContainerSlot, packet.Items[i].Slot);
TC_LOG_DEBUG("entities.player.items", "%s: ContainerSlot: %u, Slot: %u", useEquipmentSet.Items[i].Item.ToString().c_str(), useEquipmentSet.Items[i].ContainerSlot, useEquipmentSet.Items[i].Slot);
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
if (packet.Items[i].Item == ignoredItemGuid)
if (useEquipmentSet.Items[i].Item == ignoredItemGuid)
continue;
// Only equip weapons in combat
if (_player->IsInCombat() && i != EQUIPMENT_SLOT_MAINHAND && i != EQUIPMENT_SLOT_OFFHAND && i != EQUIPMENT_SLOT_RANGED)
continue;
Item* item = _player->GetItemByGuid(packet.Items[i].Item);
Item* item = _player->GetItemByGuid(useEquipmentSet.Items[i].Item);
uint16 dstPos = i | (INVENTORY_SLOT_BAG_0 << 8);
@@ -2057,8 +2057,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
stmt->setUInt64(0, lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
if (Guild* guild = sGuildMgr->GetGuildById(result->Fetch()[0].GetUInt64()))
if (PreparedQueryResult memberResult = CharacterDatabase.Query(stmt))
if (Guild* guild = sGuildMgr->GetGuildById(memberResult->Fetch()[0].GetUInt64()))
guild->DeleteMember(factionChangeInfo->Guid, false, false, true);
Player::LeaveAllArenaTeams(factionChangeInfo->Guid);
@@ -2213,9 +2213,9 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
stmt->setUInt32(0, oldReputation);
stmt->setUInt64(1, lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
if (PreparedQueryResult reputationResult = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
fields = reputationResult->Fetch();
int32 oldDBRep = fields[0].GetInt32();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation);
+4 -4
View File
@@ -318,15 +318,15 @@ void WorldSession::HandleQueryQuestCompletionNPCs(WorldPackets::Query::QueryQues
SendPacket(response.Write());
}
void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& packet)
void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& questPoiQuery)
{
if (packet.MissingQuestCount > MAX_QUEST_LOG_SIZE)
if (questPoiQuery.MissingQuestCount > MAX_QUEST_LOG_SIZE)
return;
// Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times
std::unordered_set<int32> questIds;
for (int32 i = 0; i < packet.MissingQuestCount; ++i)
questIds.insert(packet.MissingQuestPOIs[i]); // QuestID
for (int32 i = 0; i < questPoiQuery.MissingQuestCount; ++i)
questIds.insert(questPoiQuery.MissingQuestPOIs[i]); // QuestID
WorldPackets::Query::QuestPOIQueryResponse response;
+2 -1
View File
@@ -272,7 +272,8 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest
if (questPackageItem->ItemID != uint32(packet.ItemChoiceID))
continue;
if (ItemTemplate const* rewardProto = sObjectMgr->GetItemTemplate(questPackageItem->ItemID))
rewardProto = sObjectMgr->GetItemTemplate(questPackageItem->ItemID);
if (rewardProto)
{
if (rewardProto->CanWinForPlayer(_player))
{
+23 -23
View File
@@ -484,10 +484,10 @@ void WorldSession::HandleSelfResOpcode(WorldPackets::Spells::SelfRes& /*packet*/
}
}
void WorldSession::HandleSpellClick(WorldPackets::Spells::SpellClick& packet)
void WorldSession::HandleSpellClick(WorldPackets::Spells::SpellClick& spellClick)
{
// this will get something not in world. crash
Creature* unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, packet.SpellClickUnitGuid);
Creature* unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, spellClick.SpellClickUnitGuid);
if (!unit)
return;
@@ -499,9 +499,9 @@ void WorldSession::HandleSpellClick(WorldPackets::Spells::SpellClick& packet)
unit->HandleSpellClick(_player);
}
void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& packet)
void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& getMirrorImageData)
{
ObjectGuid guid = packet.UnitGUID;
ObjectGuid guid = getMirrorImageData.UnitGUID;
// Get unit for which data is needed by client
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
@@ -518,23 +518,23 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorI
if (Player* player = creator->ToPlayer())
{
WorldPackets::Spells::MirrorImageComponentedData packet;
packet.UnitGUID = guid;
packet.DisplayID = creator->GetDisplayId();
packet.RaceID = creator->getRace();
packet.Gender = creator->getGender();
packet.ClassID = creator->getClass();
WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
mirrorImageComponentedData.UnitGUID = guid;
mirrorImageComponentedData.DisplayID = creator->GetDisplayId();
mirrorImageComponentedData.RaceID = creator->getRace();
mirrorImageComponentedData.Gender = creator->getGender();
mirrorImageComponentedData.ClassID = creator->getClass();
Guild* guild = player->GetGuild();
packet.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
packet.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
packet.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
packet.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
packet.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
packet.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
mirrorImageComponentedData.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
mirrorImageComponentedData.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
mirrorImageComponentedData.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
mirrorImageComponentedData.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
mirrorImageComponentedData.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
packet.ItemDisplayID.reserve(11);
mirrorImageComponentedData.ItemDisplayID.reserve(11);
static EquipmentSlots const itemSlots[] =
{
@@ -564,16 +564,16 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorI
else
itemDisplayId = 0;
packet.ItemDisplayID.push_back(itemDisplayId);
mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
}
SendPacket(packet.Write());
SendPacket(mirrorImageComponentedData.Write());
}
else
{
WorldPackets::Spells::MirrorImageCreatureData packet;
packet.UnitGUID = guid;
packet.DisplayID = creator->GetDisplayId();
SendPacket(packet.Write());
WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
mirrorImageCreatureData.UnitGUID = guid;
mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
SendPacket(mirrorImageCreatureData.Write());
}
}
+4 -4
View File
@@ -854,16 +854,16 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
npolys -= npos;
// Handle the connection.
float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE];
if (dtStatusSucceed(_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos)))
float connectionStartPos[VERTEX_SIZE], connectionEndPos[VERTEX_SIZE];
if (dtStatusSucceed(_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, connectionStartPos, connectionEndPos)))
{
if (nsmoothPath < maxSmoothPathSize)
{
dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], startPos);
dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], connectionStartPos);
nsmoothPath++;
}
// Move position at the other side of the off-mesh link.
dtVcopy(iterPos, endPos);
dtVcopy(iterPos, connectionEndPos);
_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]);
iterPos[1] += 0.5f;
}
+5 -5
View File
@@ -205,7 +205,7 @@ void SplineBase::init_spline(const Vector3 * controls, index_type count, Evaluat
m_mode = m;
cyclic = false;
(this->*initializers[m_mode])(controls, count, cyclic, 0);
(this->*initializers[m_mode])(controls, count, 0);
}
void SplineBase::init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point)
@@ -213,10 +213,10 @@ void SplineBase::init_cyclic_spline(const Vector3 * controls, index_type count,
m_mode = m;
cyclic = true;
(this->*initializers[m_mode])(controls, count, cyclic, cyclic_point);
(this->*initializers[m_mode])(controls, count, cyclic_point);
}
void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
void SplineBase::InitLinear(const Vector3* controls, index_type count, index_type cyclic_point)
{
ASSERT(count >= 2);
const int real_size = count + 1;
@@ -236,7 +236,7 @@ void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cycl
index_hi = cyclic ? count : (count - 1);
}
void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, index_type cyclic_point)
{
const int real_size = count + (cyclic ? (1+2) : (1+1));
@@ -269,7 +269,7 @@ void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool
index_hi = high_index + (cyclic ? 1 : 0);
}
void SplineBase::InitBezier3(const Vector3* controls, index_type count, bool /*cyclic*/, index_type /*cyclic_point*/)
void SplineBase::InitBezier3(const Vector3* controls, index_type count, index_type /*cyclic_point*/)
{
index_type c = count / 3u * 3u;
index_type t = c / 3u;
+4 -4
View File
@@ -76,10 +76,10 @@ protected:
typedef float (SplineBase::*SegLenghtMethtod)(index_type) const;
static SegLenghtMethtod seglengths[ModesEnd];
void InitLinear(const Vector3*, index_type, bool, index_type);
void InitCatmullRom(const Vector3*, index_type, bool, index_type);
void InitBezier3(const Vector3*, index_type, bool, index_type);
typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type);
void InitLinear(const Vector3*, index_type, index_type);
void InitCatmullRom(const Vector3*, index_type, index_type);
void InitBezier3(const Vector3*, index_type, index_type);
typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, index_type);
static InitMethtod initializers[ModesEnd];
void UninitializedSpline() const { ASSERT(false);}
@@ -31,8 +31,8 @@ namespace WorldPackets
public:
struct ChannelPlayer
{
ChannelPlayer(ObjectGuid const& guid, uint32 realm, uint8 flags) :
Guid(guid), VirtualRealmAddress(realm), Flags(flags) { }
ChannelPlayer(ObjectGuid const& guid, uint32 virtualRealmAddress, uint8 flags) :
Guid(guid), VirtualRealmAddress(virtualRealmAddress), Flags(flags) { }
ObjectGuid Guid; ///< Player Guid
uint32 VirtualRealmAddress;
@@ -475,10 +475,10 @@ void WorldPackets::Party::PartyMemberStats::Initialize(Player const* player)
if (aurApp->GetFlags() & AFLAG_SCALABLE)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
{
float scale = 0.f;
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
float scale = 0.0f;
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
scale = float(eff->GetAmount());
aura.EffectScales.push_back(scale);
}
@@ -526,10 +526,10 @@ void WorldPackets::Party::PartyMemberStats::Initialize(Player const* player)
if (aurApp->GetFlags() & AFLAG_SCALABLE)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
{
float scale = 0.f;
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
float scale = 0.0f;
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
scale = float(eff->GetAmount());
aura.EffectScales.push_back(scale);
}
+6 -6
View File
@@ -1488,16 +1488,16 @@ class WorldSession
void HandleTransmogrifyItems(WorldPacket& recvData);
// Miscellaneous
void HandleSpellClick(WorldPackets::Spells::SpellClick& packet);
void HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& packet);
void HandleSpellClick(WorldPackets::Spells::SpellClick& spellClick);
void HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& getMirrorImageData);
void HandleRemoveGlyph(WorldPacket& recvData);
void HandleGuildSetFocusedAchievement(WorldPackets::Achievement::GuildSetFocusedAchievement& setFocusedAchievement);
void HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet);
void HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& packet);
void HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& packet);
void HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& saveEquipmentSet);
void HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& deleteEquipmentSet);
void HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& useEquipmentSet);
void HandleUITimeRequest(WorldPackets::Misc::UITimeRequest& /*request*/);
void HandleQueryQuestCompletionNPCs(WorldPackets::Query::QueryQuestCompletionNPCs& queryQuestCompletionNPCs);
void HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& packet);
void HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& questPoiQuery);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
void HandleViolenceLevel(WorldPackets::Misc::ViolenceLevel& violenceLevel);
+24 -24
View File
@@ -1132,8 +1132,8 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
{
case TARGET_OBJECT_TYPE_UNIT:
{
if (Unit* unitTarget = target->ToUnit())
AddUnitTarget(unitTarget, effMask, true, false);
if (Unit* unit = target->ToUnit())
AddUnitTarget(unit, effMask, true, false);
else
{
TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
@@ -1194,8 +1194,8 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
AddUnitTarget(unitTarget, effMask, false);
if (Unit* unit = (*itr)->ToUnit())
AddUnitTarget(unit, effMask, false);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
AddGOTarget(gObjTarget, effMask);
}
@@ -1273,8 +1273,8 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
AddUnitTarget(unitTarget, effMask, false, true, center);
if (Unit* unit = (*itr)->ToUnit())
AddUnitTarget(unit, effMask, false, true, center);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
AddGOTarget(gObjTarget, effMask);
}
@@ -1545,8 +1545,8 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType);
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (Unit* unitTarget = (*itr)->ToUnit())
AddUnitTarget(unitTarget, effMask, false);
if (Unit* unit = (*itr)->ToUnit())
AddUnitTarget(unit, effMask, false);
}
}
@@ -1601,12 +1601,12 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
if (m_spellInfo->CheckTarget(m_caster, *itr, true) != SPELL_CAST_OK)
continue;
if (Unit* unitTarget = (*itr)->ToUnit())
if (Unit* unit = (*itr)->ToUnit())
{
if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || unitTarget->GetVehicle())
if (m_caster == *itr || m_caster->IsOnVehicle(unit) || unit->GetVehicle())
continue;
if (Creature* creatureTarget = unitTarget->ToCreature())
if (Creature* creatureTarget = unit->ToCreature())
{
if (!(creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PROJECTILE_COLLISION))
continue;
@@ -1761,8 +1761,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint32 effIndex)
// player which not released his spirit is Unit, but target flag for it is TARGET_FLAG_CORPSE_MASK
if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK))
{
if (Unit* unitTarget = m_targets.GetUnitTarget())
target = unitTarget;
if (Unit* unit = m_targets.GetUnitTarget())
target = unit;
else if (targetMask & TARGET_FLAG_CORPSE_MASK)
{
if (Corpse* corpseTarget = m_targets.GetCorpseTarget())
@@ -1777,8 +1777,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint32 effIndex)
}
if (targetMask & TARGET_FLAG_ITEM_MASK)
{
if (Item* itemTarget = m_targets.GetItemTarget())
AddItemTarget(itemTarget, 1 << effIndex);
if (Item* item = m_targets.GetItemTarget())
AddItemTarget(item, 1 << effIndex);
return;
}
if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK)
@@ -1958,10 +1958,10 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar
uint32 maxHPDeficit = 0;
for (std::list<WorldObject*>::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
if (Unit* unit = (*itr)->ToUnit())
{
uint32 deficit = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unitTarget, jumpRadius) && target->IsWithinLOSInMap(unitTarget))
uint32 deficit = unit->GetMaxHealth() - unit->GetHealth();
if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unit, jumpRadius) && target->IsWithinLOSInMap(unit))
{
foundItr = itr;
maxHPDeficit = deficit;
@@ -5101,12 +5101,12 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_LEARN_PET_SPELL:
{
// check target only for unit target case
if (Unit* unitTarget = m_targets.GetUnitTarget())
if (Unit* unit = m_targets.GetUnitTarget())
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
Pet* pet = unitTarget->ToPet();
Pet* pet = unit->ToPet();
if (!pet || pet->GetOwner() != m_caster)
return SPELL_FAILED_BAD_TARGETS;
@@ -5503,8 +5503,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
int32 damage = CalculateDamage(effect->EffectIndex, target);
if (damage && int32(target->getLevel()) > damage)
int32 value = CalculateDamage(effect->EffectIndex, target);
if (value && int32(target->getLevel()) > value)
return SPELL_FAILED_HIGHLEVEL;
}
@@ -6587,8 +6587,8 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const* effect,
return false;
if (!target->GetCharmerGUID().IsEmpty())
return false;
if (int32 damage = CalculateDamage(effect->EffectIndex, target))
if ((int32)target->getLevel() > damage)
if (int32 value = CalculateDamage(effect->EffectIndex, target))
if ((int32)target->getLevel() > value)
return false;
break;
default:
+5 -5
View File
@@ -3119,9 +3119,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
uint32 eff_damage(std::max(weaponDamage, 0));
// Add melee damage bonuses (also check for negative)
uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
uint32 damageBonusDone = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo);
m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damageBonusDone, m_attackType, m_spellInfo);
}
void Spell::EffectThreat(SpellEffIndex /*effIndex*/)
@@ -3379,9 +3379,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 54426:
if (unitTarget)
{
int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5));
if (damage > 0)
m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget);
int32 decimateDamage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5));
if (decimateDamage > 0)
m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, decimateDamage, unitTarget);
}
return;
// Mirren's Drinking Hat
+3 -3
View File
@@ -3313,10 +3313,10 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
while (difficultyEntry)
{
SpellEffectInfoMap::const_iterator itr = _effects.find(difficulty);
if (itr != _effects.end())
SpellEffectInfoMap::const_iterator effectItr = _effects.find(difficulty);
if (effectItr != _effects.end())
{
for (SpellEffectInfo const* effect : itr->second)
for (SpellEffectInfo const* effect : effectItr->second)
{
// overwrite any existing effect from DIFFICULTY_NONE
if (effect)
+10 -10
View File
@@ -85,9 +85,9 @@ uint32 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEn
return mask;
}
bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
return (GetAffectedEffectsMask(spellEntry) & 1 << effIndex) != 0;
return (GetAffectedEffectsMask(spellEntry) & 1 << effIndexToCheck) != 0;
}
std::string _SpellScript::EffectHook::EffIndexToString()
@@ -189,14 +189,14 @@ std::string SpellScript::EffectHandler::ToString()
return "Index: " + EffIndexToString() + " Name: " +_SpellScript::EffectNameCheck::ToString();
}
bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndexToCheck);
}
void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndex)
void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndexToHandle)
{
(spellScript->*pEffectHandlerScript)(effIndex);
(spellScript->*pEffectHandlerScript)(effIndexToHandle);
}
SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript)
@@ -219,12 +219,12 @@ std::string SpellScript::TargetHook::ToString()
return oss.str();
}
bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
if (!targetType)
return false;
SpellEffectInfo const* effect = spellEntry->GetEffect(effIndex);
SpellEffectInfo const* effect = spellEntry->GetEffect(effIndexToCheck);
if (!effect)
return false;
@@ -781,9 +781,9 @@ void AuraScript::AuraDispelHandler::Call(AuraScript* auraScript, DispelInfo* _di
AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
: _SpellScript::EffectAuraNameCheck(_effName), _SpellScript::EffectHook(_effIndex) { }
bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndexToCheck);
}
std::string AuraScript::EffectBase::ToString()
+1 -1
View File
@@ -500,7 +500,7 @@ public:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
stmt->setUInt64(0, targetGuid.GetCounter());
PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
{
@@ -552,11 +552,11 @@ public:
YellTimer = 10000;
}
uint32 NextStep(uint32 Step)
uint32 NextStep(uint32 step)
{
Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
switch (Step)
switch (step)
{
case 0: return 9999999;
case 1:
@@ -464,13 +464,13 @@ public:
SayTimer = 8000;
}
uint32 NextStep(uint8 Step)
uint32 NextStep(uint8 step)
{
Creature* Spark = ObjectAccessor::GetCreature(*me, SparkGUID);
if (!Spark)
return 99999999;
switch (Step)
switch (step)
{
case 0:
Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
@@ -221,12 +221,12 @@ public:
}
}
void MovementInform(uint32 type, uint32 id) override
void MovementInform(uint32 type, uint32 point) override
{
if (type != POINT_MOTION_TYPE)
return;
if (id == 2 || id == 5 || id == 8 || id == 11)
if (point == 2 || point == 5 || point == 8 || point == 11)
{
movementCompleted = true;
me->SetReactState(REACT_AGGRESSIVE);
@@ -251,7 +251,7 @@ public:
}
nextMovementStarted = false;
nextWP = id + 1;
nextWP = point + 1;
}
// switch to "who" if nearer than current target.
@@ -176,8 +176,6 @@ class boss_gothik : public CreatureScript
}
uint32 waveCount;
typedef std::vector<Creature*> TriggerVct;
TriggerVct liveTrigger, deadTrigger;
bool mergedSides;
bool phaseTwo;
bool thirtyPercentReached;
@@ -220,11 +220,14 @@ public:
DoCast(SPELL_SUMMON_ETHEREAL_SPHERE_2);
break;
case EVENT_SUMMON_PLAYERS:
if (Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE, 150.0f))
sphere->GetAI()->DoAction(ACTION_SUMMON);
else if (Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE2, 150.0f))
sphere->GetAI()->DoAction(ACTION_SUMMON);
break;
{
Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE, 150.0f);
if (!sphere)
sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE2, 150.0f);
if (sphere)
sphere->GetAI()->DoAction(ACTION_SUMMON);
break;
}
default:
break;
}
@@ -364,21 +364,21 @@ class boss_vazruden_the_herald : public CreatureScript
}
}
void JustSummoned(Creature* summoned) override
void JustSummoned(Creature* summon) override
{
if (!summoned)
if (!summon)
return;
Unit* victim = me->GetVictim();
if (summoned->GetEntry() == NPC_NAZAN)
if (summon->GetEntry() == NPC_NAZAN)
{
summoned->SetDisableGravity(true);
summoned->SetSpeed(MOVE_FLIGHT, 2.5f);
summon->SetDisableGravity(true);
summon->SetSpeed(MOVE_FLIGHT, 2.5f);
if (victim)
AttackStartNoMove(victim);
}
else
if (victim)
summoned->AI()->AttackStart(victim);
summon->AI()->AttackStart(victim);
}
void SentryDownBy(Unit* killer)
@@ -127,18 +127,18 @@ class boss_warchief_kargath_bladefist : public CreatureScript
Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned) override
void JustSummoned(Creature* summon) override
{
switch (summoned->GetEntry())
switch (summon->GetEntry())
{
case NPC_HEARTHEN_GUARD:
case NPC_SHARPSHOOTER_GUARD:
case NPC_REAVER_GUARD:
summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
adds.push_back(summoned->GetGUID());
summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
adds.push_back(summon->GetGUID());
break;
case NPC_SHATTERED_ASSASSIN:
assassins.push_back(summoned->GetGUID());
assassins.push_back(summon->GetGUID());
break;
}
}
@@ -165,7 +165,6 @@ public:
void Reset() override
{
ryga = NULL;
}
// Override Evade Mode event, recast buff that was removed by standard handler
@@ -175,15 +174,6 @@ public:
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
}
void MoveInLineOfSight(Unit* who) override
{
if (!ryga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f))
if (Creature* temp = who->ToCreature())
ryga = temp;
npc_escortAI::MoveInLineOfSight(who);
}
void WaypointReached(uint32 waypointId) override
{
switch (waypointId)
@@ -238,9 +228,6 @@ public:
break;
}
}
private:
Creature* ryga;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -28,16 +28,16 @@ class SHA1Randx
public:
SHA1Randx(uint8* buff, uint32 size)
{
uint32 taken = size/2;
uint32 halfSize = size / 2;
sh.Initialize();
sh.UpdateData(buff, taken);
sh.UpdateData(buff, halfSize);
sh.Finalize();
memcpy(o1, sh.GetDigest(), 20);
sh.Initialize();
sh.UpdateData(buff + taken, size - taken);
sh.UpdateData(buff + halfSize, size - halfSize);
sh.Finalize();
memcpy(o2, sh.GetDigest(), 20);
@@ -503,7 +503,7 @@ class DatabaseWorkerPool
{
while (_connectionCount[type] != 0)
{
T* t = _connections[type][i--];
t = _connections[type][i--];
delete t;
--_connectionCount[type];
}
@@ -1008,9 +1008,9 @@ bool logChildren)
// Get the size of the child member
ULONG64 length;
SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_LENGTH, &length);
char buffer[50];
FormatOutputValue(buffer, basicType, length, (PVOID)address, sizeof(buffer));
symbolDetails.top().Value = buffer;
char buffer2[50];
FormatOutputValue(buffer2, basicType, length, (PVOID)address, sizeof(buffer));
symbolDetails.top().Value = buffer2;
}
bHandled = true;
return pszCurrBuffer;
@@ -1233,16 +1233,16 @@ size_t countOverride)
else
length = strlen((char*)pAddress);
if (length > bufferSize - 6)
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, (char*)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", (DWORD)(bufferSize - 6), (char*)pAddress);
else
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s\"", length, (char*)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s\"", (DWORD)length, (char*)pAddress);
break;
}
case btStdString:
{
std::string* value = static_cast<std::string*>(pAddress);
if (value->length() > bufferSize - 6)
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, value->c_str());
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", (DWORD)(bufferSize - 6), value->c_str());
else
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%s\"", value->c_str());
break;
@@ -1264,7 +1264,7 @@ size_t countOverride)
{
if (basicType == btFloat)
{
pszCurrBuffer += sprintf(pszCurrBuffer, "%lf",
pszCurrBuffer += sprintf(pszCurrBuffer, "%f",
*(double *)pAddress);
}
else
@@ -1274,9 +1274,9 @@ size_t countOverride)
else
{
#if _WIN64
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X", (DWORD64*)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X", (DWORD64)pAddress);
#else
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", (PDWORD)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", (DWORD)pAddress);
#endif
}
break;
@@ -1285,9 +1285,9 @@ size_t countOverride)
__except (EXCEPTION_EXECUTE_HANDLER)
{
#if _WIN64
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X <Unable to read memory>", (DWORD64*)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X <Unable to read memory>", (DWORD64)pAddress);
#else
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X <Unable to read memory>", (PDWORD)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X <Unable to read memory>", (DWORD)pAddress);
#endif
}
}
+20 -21
View File
@@ -22,20 +22,19 @@
# include <Windows.h>
#endif
AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags, uint64 fileSize):
Appender(id, name, APPENDER_FILE, level, _flags),
AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 fileSize):
Appender(id, name, APPENDER_FILE, level, flags),
logfile(NULL),
filename(_filename),
logDir(_logDir),
mode(_mode),
maxFileSize(fileSize),
fileSize(0)
_fileName(filename),
_logDir(logDir),
_maxFileSize(fileSize),
_fileSize(0)
{
dynamicName = std::string::npos != filename.find("%s");
backup = (_flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0;
_dynamicName = std::string::npos != _fileName.find("%s");
_backup = (flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0;
if (!dynamicName)
logfile = OpenFile(_filename, _mode, mode == "w" && backup);
if (!_dynamicName)
logfile = OpenFile(filename, mode, !strcmp(mode, "w") && _backup);
}
AppenderFile::~AppenderFile()
@@ -45,36 +44,36 @@ AppenderFile::~AppenderFile()
void AppenderFile::_write(LogMessage const* message)
{
bool exceedMaxSize = maxFileSize > 0 && (fileSize.load() + message->Size()) > maxFileSize;
bool exceedMaxSize = _maxFileSize > 0 && (_fileSize.load() + message->Size()) > _maxFileSize;
if (dynamicName)
if (_dynamicName)
{
char namebuf[TRINITY_PATH_MAX];
snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message->param1.c_str());
snprintf(namebuf, TRINITY_PATH_MAX, _fileName.c_str(), message->param1.c_str());
// always use "a" with dynamic name otherwise it could delete the log we wrote in last _write() call
FILE* file = OpenFile(namebuf, "a", backup || exceedMaxSize);
FILE* file = OpenFile(namebuf, "a", _backup || exceedMaxSize);
if (!file)
return;
fprintf(file, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(file);
fileSize += uint64(message->Size());
_fileSize += uint64(message->Size());
fclose(file);
return;
}
else if (exceedMaxSize)
logfile = OpenFile(filename, "w", true);
logfile = OpenFile(_fileName, "w", true);
if (!logfile)
return;
fprintf(logfile, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(logfile);
fileSize += uint64(message->Size());
_fileSize += uint64(message->Size());
}
FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup)
FILE* AppenderFile::OpenFile(std::string const& filename, std::string const& mode, bool backup)
{
std::string fullName(logDir + filename);
std::string fullName(_logDir + filename);
if (backup)
{
CloseFile();
@@ -87,7 +86,7 @@ FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mod
if (FILE* ret = fopen(fullName.c_str(), mode.c_str()))
{
fileSize = ftell(ret);
_fileSize = ftell(ret);
return ret;
}
+8 -9
View File
@@ -24,21 +24,20 @@
class AppenderFile: public Appender
{
public:
AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 maxSize);
AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 maxSize);
~AppenderFile();
FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup);
FILE* OpenFile(std::string const& name, std::string const& mode, bool backup);
private:
void CloseFile();
void _write(LogMessage const* message) override;
FILE* logfile;
std::string filename;
std::string logDir;
std::string mode;
bool dynamicName;
bool backup;
uint64 maxFileSize;
std::atomic<uint64> fileSize;
std::string _fileName;
std::string _logDir;
bool _dynamicName;
bool _backup;
uint64 _maxFileSize;
std::atomic<uint64> _fileSize;
};
#endif