aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-08-01 18:02:08 +0200
committerShauren <shauren.trinity@gmail.com>2013-08-01 18:02:08 +0200
commitab6be8c603c9af110392bb7019472d2775dae60d (patch)
treeebfc4aececc1ef570b089f10fc5fe17a0bfe415c
parentf04217300c13586faef25fbf1804272f28313eae (diff)
Core/Battlegrounds: Fixed error with counting AB owned nodes (and warning fixes)
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp10
-rw-r--r--src/server/game/Chat/Chat.cpp2
-rw-r--r--src/server/game/Loot/LootMgr.cpp2
3 files changed, 6 insertions, 8 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index bef0e995988..2114fc4ef66 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -359,21 +359,19 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
+ if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
+ return;
+
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- {
- if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
+ if (m_Nodes[i] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
- }
if (capturedNodes >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
if (capturedNodes >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
- if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
- return;
-
Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL;//0-6 spirit guides
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 5218c9c9e55..0b18a04c5ca 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -80,8 +80,8 @@ ChatCommand* ChatHandler::getCommandTable()
// cache top-level commands
size_t added = 0;
commandTableCache = (ChatCommand*)malloc(sizeof(ChatCommand) * total);
+ ASSERT(commandTableCache);
memset(commandTableCache, 0, sizeof(ChatCommand) * total);
- ACE_ASSERT(commandTableCache);
for (std::vector<ChatCommand*>::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it)
added += appendCommandTable(commandTableCache + added, *it);
}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index d04a7efa2a8..33c21163a4a 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -417,7 +417,7 @@ void Loot::AddItem(LootStoreItem const& item)
return;
uint32 count = urand(item.mincountOrRef, item.maxcount);
- uint32 stacks = count / proto->GetMaxStackSize() + (count % proto->GetMaxStackSize() ? 1 : 0);
+ uint32 stacks = count / proto->GetMaxStackSize() + ((count % proto->GetMaxStackSize()) ? 1 : 0);
std::vector<LootItem>& lootItems = item.needs_quest ? quest_items : items;
uint32 limit = item.needs_quest ? MAX_NR_QUEST_ITEMS : MAX_NR_LOOT_ITEMS;