aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp1
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp4
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp4
-rwxr-xr-xsrc/server/game/Maps/Map.cpp36
-rwxr-xr-xsrc/server/game/Maps/Map.h18
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp31
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
8 files changed, 50 insertions, 48 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 84dad3a9b3f..64655c0d50a 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -209,7 +209,6 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
uint32 spellCount = 0;
SpellInfo const* tempSpell = NULL;
- SpellRangeEntry const* tempRange = NULL;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index fef515de325..b067b482b4b 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -1075,7 +1075,7 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
}
//towers
- for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_MAX; i++)
+ for (uint8 i = BG_AV_NODES_DUNBALDAR_SOUTH; i < BG_AV_NODES_MAX; ++i)
for (uint8 j =1; j <= 3; j+=2)
{//j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3));
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 786aa71e297..55f4f124f83 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -11418,7 +11418,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool
return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE;
// if swap ignore item (equipped also)
- InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT);
+ InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? eslot : uint8(NULL_SLOT));
if (res2 != EQUIP_ERR_OK)
return res2;
@@ -14292,6 +14292,8 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
return source->ToCreature()->GetCreatureInfo()->GossipMenuId;
case TYPEID_GAMEOBJECT:
return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
+ default:
+ break;
}
return 0;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 57032c13aaf..57db119f932 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3421,8 +3421,6 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura* aura)
{
SpellInfo const* spellProto = aura->GetSpellInfo();
- uint32 spellId = spellProto->Id;
-
// passive spell special case (only non stackable with ranks)
if (spellProto->IsPassiveStackableWithRanks())
return;
@@ -15231,7 +15229,6 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura)
{
// aura can be deleted at casts
SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
- uint32 effIdx = triggeredByAura->GetEffIndex();
int32 heal = triggeredByAura->GetAmount();
uint64 caster_guid = triggeredByAura->GetCasterGUID();
@@ -15293,7 +15290,6 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
}
uint64 caster_guid = triggeredByAura->GetCasterGUID();
- uint32 effIdx = triggeredByAura->GetEffIndex();
// jumps
int32 jumps = triggeredByAura->GetBase()->GetCharges()-1;
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index cfd5dafbfb8..1137e2f95dd 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -31,6 +31,19 @@
#include "ObjectMgr.h"
#include "Group.h"
+
+union u_map_magic
+{
+ char asChar[4];
+ uint32 asUInt;
+};
+
+u_map_magic MapMagic = { {'M','A','P','S'} };
+u_map_magic MapVersionMagic = { {'v','1','.','1'} };
+u_map_magic MapAreaMagic = { {'A','R','E','A'} };
+u_map_magic MapHeightMagic = { {'M','H','G','T'} };
+u_map_magic MapLiquidMagic = { {'M','L','I','Q'} };
+
#define DEFAULT_GRID_EXPIRY 300
#define MAX_GRID_LOAD_TIME 50
#define MAX_CREATURE_ATTACK_RADIUS (45.0f * sWorld->getRate(RATE_CREATURE_AGGRO))
@@ -72,12 +85,12 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy)
map_fileheader header;
if (fread(&header, sizeof(header), 1, pf) == 1)
{
- if (header.mapMagic != uint32(MAP_MAGIC) || header.versionMagic != uint32(MAP_VERSION_MAGIC))
+ if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt)
sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
else
ret = true;
}
- fclose(pf);
+ fclose(pf);
}
delete [] tmp;
return ret;
@@ -799,15 +812,10 @@ void Map::MoveAllCreaturesInMoveList()
// get data and remove element;
CreatureMoveList::iterator iter = i_creaturesToMove.begin();
Creature* c = iter->first;
- CreatureMover cm = iter->second;
- i_creaturesToMove.erase(iter);
-
- // calculate cells
- CellPair new_val = Trinity::ComputeCellPair(cm.x, cm.y);
- Cell new_cell(new_val);
+ const CreatureMover &cm = iter->second;
// do move or do move to respawn or remove creature if previous all fail
- if (CreatureCellRelocation(c, new_cell))
+ if (CreatureCellRelocation(c, Cell(Trinity::ComputeCellPair(cm.x, cm.y))))
{
// update pos
c->Relocate(cm.x, cm.y, cm.z, cm.ang);
@@ -827,6 +835,8 @@ void Map::MoveAllCreaturesInMoveList()
AddObjectToRemoveList(c);
}
}
+
+ i_creaturesToMove.erase(iter);
}
}
@@ -1059,7 +1069,7 @@ bool GridMap::loadData(char *filename)
return false;
}
- if (header.mapMagic == uint32(MAP_MAGIC) && header.versionMagic == uint32(MAP_VERSION_MAGIC))
+ if (header.mapMagic == MapMagic.asUInt && header.versionMagic == MapVersionMagic.asUInt)
{
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
@@ -1110,7 +1120,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/)
map_areaHeader header;
fseek(in, offset, SEEK_SET);
- if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_AREA_MAGIC))
+ if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapAreaMagic.asUInt)
return false;
m_gridArea = header.gridArea;
@@ -1128,7 +1138,7 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/)
map_heightHeader header;
fseek(in, offset, SEEK_SET);
- if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_HEIGHT_MAGIC))
+ if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapHeightMagic.asUInt)
return false;
m_gridHeight = header.gridHeight;
@@ -1174,7 +1184,7 @@ bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/)
map_liquidHeader header;
fseek(in, offset, SEEK_SET);
- if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != uint32(MAP_LIQUID_MAGIC))
+ if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt)
return false;
m_liquidType = header.liquidType;
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 4ce4f3ea357..63cb10a8f89 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -63,12 +63,6 @@ struct ScriptAction
// ******************************************
// Map file format defines
// ******************************************
-#define MAP_MAGIC 'SPAM'
-#define MAP_VERSION_MAGIC '1.1v'
-#define MAP_AREA_MAGIC 'AERA'
-#define MAP_HEIGHT_MAGIC 'TGHM'
-#define MAP_LIQUID_MAGIC 'QILM'
-
struct map_fileheader
{
uint32 mapMagic;
@@ -201,7 +195,7 @@ public:
struct CreatureMover
{
- CreatureMover() : x(0), y(0), z(0), ang(0) {}
+ CreatureMover() : x(0.0f), y(0.0f), z(0.0f), ang(0.0f) {}
CreatureMover(float _x, float _y, float _z, float _ang) : x(_x), y(_y), z(_z), ang(_ang) {}
float x, y, z, ang;
@@ -625,16 +619,6 @@ class BattlegroundMap : public Map
Battleground* m_bg;
};
-/*inline
-uint64
-Map::CalculateGridMask(const uint32 &y) const
-{
- uint64 mask = 1;
- mask <<= y;
- return mask;
-}
-*/
-
template<class T, class CONTAINER>
inline void
Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 7080d7629a9..751ab8d0393 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1679,6 +1679,7 @@ bool Spell::UpdateChanneledTargetList()
if (IsValidDeadOrAliveTarget(unit))
{
if (channelAuraMask & ihit->effectMask)
+ {
if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID))
{
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit, range))
@@ -1690,6 +1691,7 @@ bool Spell::UpdateChanneledTargetList()
}
else // aura is dispelled
continue;
+ }
channelTargetEffectMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target
}
@@ -2020,6 +2022,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(cur - TARGET_UNIT_PASSENGER_0))
AddUnitTarget(unit, i);
break;
+ default:
+ break;
}
break;
}
@@ -2068,6 +2072,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
case TARGET_UNIT_TARGET_CLASS_RAID:
pushType = PUSH_CASTER_CENTER; // not real
break;
+ default:
+ break;
}
break;
}
@@ -2097,6 +2103,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i));
break;
+ default:
+ break;
}
if (!target)
@@ -2302,6 +2310,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
m_targets.SetDst(*target);
break;
}
+ default:
+ break;
}
break;
}
@@ -2334,6 +2344,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
case TARGET_DEST_CHANNEL_CASTER:
m_targets.SetDst(*m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->GetCaster());
break;
+ default:
+ break;
}
break;
}
@@ -2401,6 +2413,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_CHAINHEAL);
break;
+ default:
+ break;
}
CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i));
@@ -2623,6 +2637,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
AddUnitTarget(m_targets.GetUnitTarget(), i);
break;
}
+ default:
+ break;
}
break;
}
@@ -4420,20 +4436,15 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
void Spell::TakeRunePower(bool didHit)
{
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- Player* player = m_caster->ToPlayer();
-
- if (player->getClass() != CLASS_DEATH_KNIGHT)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER || m_caster->getClass() != CLASS_DEATH_KNIGHT)
return;
SpellRuneCostEntry const *runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID);
-
if (!runeCostData || (runeCostData->NoRuneCost() && runeCostData->NoRunicPowerGain()))
return;
- m_runesState = player->GetRunesState(); // store previous state
+ Player *player = m_caster->ToPlayer();
+ m_runesState = player->GetRunesState(); // store previous state
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
@@ -4451,7 +4462,7 @@ void Spell::TakeRunePower(bool didHit)
RuneType rune = player->GetCurrentRune(i);
if (!player->GetRuneCooldown(i) && runeCost[rune] > 0)
{
- player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : RUNE_MISS_COOLDOWN);
+ player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN));
player->SetLastUsedRune(rune);
runeCost[rune]--;
}
@@ -4466,7 +4477,7 @@ void Spell::TakeRunePower(bool didHit)
RuneType rune = player->GetCurrentRune(i);
if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH)
{
- player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : RUNE_MISS_COOLDOWN);
+ player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN));
player->SetLastUsedRune(rune);
runeCost[rune]--;
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 5c41744b664..48deb028625 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1168,7 +1168,7 @@ class spell_gen_launch : public SpellScriptLoader
{
PrepareSpellScript(spell_gen_launch_SpellScript);
- void HandleScript(SpellEffIndex effIndex)
+ void HandleScript(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetHitPlayer())
player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE,player); // prevents falling damage