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

(cherry picked from commit a22e4e121a1e54b2f4154d59623ee4a94a449176)

Conflicts:
	cmake/compiler/msvc/settings.cmake
	src/server/game/DataStores/DBCStores.cpp
	src/server/game/Entities/GameObject/GameObject.cpp
	src/server/game/Entities/Object/Object.cpp
	src/server/game/Entities/Object/Object.h
	src/server/game/Entities/Pet/Pet.cpp
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Garrison/Garrison.cpp
	src/server/game/Garrison/GarrisonMgr.cpp
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Globals/ObjectMgr.h
	src/server/game/Guilds/GuildMgr.cpp
	src/server/game/Handlers/CharacterHandler.cpp
	src/server/game/Handlers/QueryHandler.cpp
	src/server/game/Handlers/QuestHandler.cpp
	src/server/game/Handlers/SpellHandler.cpp
	src/server/game/Server/Packets/ChannelPackets.h
	src/server/game/Server/Packets/PartyPackets.cpp
	src/server/game/Server/WorldSession.h
	src/server/game/Spells/Spell.cpp
	src/server/game/Spells/SpellInfo.cpp
	src/server/game/Spells/SpellScript.cpp
	src/server/scripts/Commands/cs_list.cpp
This commit is contained in:
Shauren authored and DDuarte committed 2015-07-24 11:51:48 +01:00
1 parent b703d53073
commit b4adf3f5dd
30 files changed
+216 -226

No files matched your search

+4
View File
@@ -51,6 +51,10 @@ message(STATUS "MSVC: Disabled NON-SECURE warnings")
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
message(STATUS "MSVC: Disabled POSIX warnings")
# 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")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512")
@@ -895,8 +895,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);
}
@@ -1721,7 +1721,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;
@@ -1734,11 +1734,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());
@@ -1377,10 +1377,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");
@@ -495,62 +495,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);
@@ -567,7 +567,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);
@@ -578,22 +578,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:
{
@@ -601,7 +601,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);
@@ -612,20 +612,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);
}
@@ -634,24 +634,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)
@@ -661,7 +661,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))
{
@@ -673,7 +673,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))
{
@@ -688,25 +688,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:
@@ -717,7 +717,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))
{
@@ -732,17 +732,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))
{
@@ -754,16 +754,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)]);
}
}
}
@@ -778,7 +778,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;
@@ -968,7 +968,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)
{
@@ -1013,9 +1013,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
@@ -2253,12 +2253,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.groupLootRules && !IsLootAllowedFor(target))
flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
goFlags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
fieldBuffer << flags;
fieldBuffer << goFlags;
}
else
fieldBuffer << m_uint32Values[index]; // other cases
+2 -2
View File
@@ -343,10 +343,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->setUInt32(0, owner->GetGUIDLow());
stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
PreparedQueryResult result = CharacterDatabase.Query(stmt);
result = CharacterDatabase.Query(stmt);
if (result)
{
+3 -3
View File
@@ -7266,7 +7266,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->setUInt32(0, guidLow);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
result = CharacterDatabase.Query(stmt);
if (!result)
return 0;
@@ -18006,8 +18006,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
std::map<uint32, Item*>::iterator invalidBagItr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), invalidBagItr->second) != problematicItems.end())
err = EQUIP_ERR_INT_BAG_ERROR;
}
else
+10 -10
View File
@@ -443,24 +443,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;
WorldPacket newDataPacket;
player->BuildValuesUpdateBlockForPlayer(&newData, member);
player->BuildValuesUpdateBlockForPlayer(&newData, existingMember);
if (newData.HasData())
{
newData.BuildPacket(&newDataPacket);
member->SendDirectMessage(&newDataPacket);
existingMember->SendDirectMessage(&newDataPacket);
}
}
}
@@ -1989,8 +1989,8 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
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());
}
@@ -1983,9 +1983,9 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
stmt->setUInt32(0, oldReputation);
stmt->setUInt32(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
@@ -853,16 +853,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
@@ -204,7 +204,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)
@@ -212,10 +212,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;
@@ -235,7 +235,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));
@@ -268,7 +268,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);}
+24 -24
View File
@@ -1066,8 +1066,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);
@@ -1132,8 +1132,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);
}
@@ -1213,8 +1213,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);
}
@@ -1472,8 +1472,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);
}
}
@@ -1528,12 +1528,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;
@@ -1682,8 +1682,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 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())
@@ -1698,8 +1698,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 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)
@@ -1876,10 +1876,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;
@@ -5011,12 +5011,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;
@@ -5398,8 +5398,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
int32 damage = CalculateDamage(i, target);
if (damage && int32(target->getLevel()) > damage)
int32 value = CalculateDamage(i, target);
if (value && int32(target->getLevel()) > value)
return SPELL_FAILED_HIGHLEVEL;
}
@@ -6471,8 +6471,8 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff, Position const* lo
return false;
if (target->GetCharmerGUID())
return false;
if (int32 damage = CalculateDamage(eff, target))
if ((int32)target->getLevel() > damage)
if (int32 value = CalculateDamage(eff, target))
if ((int32)target->getLevel() > value)
return false;
break;
default:
+5 -5
View File
@@ -3408,9 +3408,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*/)
@@ -3664,9 +3664,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
+9 -9
View File
@@ -84,9 +84,9 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEnt
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()
@@ -182,14 +182,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)
@@ -212,7 +212,7 @@ 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;
@@ -758,9 +758,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->setUInt32(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:
@@ -465,13 +465,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