Skip to content

Commit

Permalink
Core/Misc: MSVC /W4 warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Apr 6, 2016
1 parent 4a3a178 commit 08c27d3
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 59 deletions.
33 changes: 17 additions & 16 deletions src/common/Common.h
Expand Up @@ -21,27 +21,28 @@

#include "Define.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cmath>
#include <errno.h>
#include <signal.h>
#include <assert.h>

#include <set>
#include <unordered_set>
#include <algorithm>
#include <array>
#include <exception>
#include <list>
#include <string>
#include <map>
#include <unordered_map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <algorithm>
#include <memory>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <array>

#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cerrno>
#include <csignal>

#include <boost/optional.hpp>
#include <boost/utility/in_place_factory.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Battlefield/Battlefield.h
Expand Up @@ -35,7 +35,7 @@ enum BattlefieldIDs
BATTLEFIELD_BATTLEID_ASHRAN = 24 // Ashran
};

enum BattlefieldState
enum BattlefieldState : int8
{
BATTLEFIELD_INACTIVE = 0,
BATTLEFIELD_WARMUP = 1,
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Item/ItemTemplate.h
Expand Up @@ -362,7 +362,7 @@ enum InventoryType

#define MAX_INVTYPE 29

enum ItemClass
enum ItemClass : uint8
{
ITEM_CLASS_CONSUMABLE = 0,
ITEM_CLASS_CONTAINER = 1,
Expand Down
25 changes: 11 additions & 14 deletions src/server/game/Entities/Player/Player.cpp
Expand Up @@ -9921,8 +9921,7 @@ InventoryResult Player::CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, Ite
if (pItem2)
{
// can be merged at least partly
uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
if (res != EQUIP_ERR_OK)
if (pItem2->CanBeMergedPartlyWith(pProto) != EQUIP_ERR_OK)
continue;

// descrease at current stacksize
Expand Down Expand Up @@ -9972,8 +9971,7 @@ InventoryResult Player::CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 sl
if (pItem2)
{
// can be merged at least partly
uint8 res = pItem2->CanBeMergedPartlyWith(pProto);
if (res != EQUIP_ERR_OK)
if (pItem2->CanBeMergedPartlyWith(pProto) != EQUIP_ERR_OK)
continue;

// descrease at current stacksize
Expand Down Expand Up @@ -10436,7 +10434,7 @@ InventoryResult Player::CanStoreItems(Item** items, int count, uint32* offending
continue;

// search free slot in bags
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
for (uint8 t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{
if (Bag* bag = GetBagByPos(t))
{
Expand Down Expand Up @@ -11865,19 +11863,19 @@ void Player::DestroyConjuredItems(bool update)
Item* Player::GetItemByEntry(uint32 entry) const
{
// in inventory
for (int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem->GetEntry() == entry)
return pItem;

for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Bag* pBag = GetBagByPos(i))
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
if (Item* pItem = pBag->GetItemByPos(j))
if (pItem->GetEntry() == entry)
return pItem;

for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem->GetEntry() == entry)
return pItem;
Expand Down Expand Up @@ -13111,8 +13109,8 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
TC_LOG_ERROR("entities.player", "Player::ApplyEnchantment: Unknown item enchantment (ID: %u, DisplayType: %u) for player '%s' (%s)",
enchant_id, enchant_display_type, GetName().c_str(), GetGUID().ToString().c_str());
break;
} /*switch (enchant_display_type)*/
} /*for*/
}
}
}

// visualize enchantment at player and equipped items
Expand Down Expand Up @@ -17314,7 +17312,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)

GetSession()->GetCollectionMgr()->CheckHeirloomUpgrades(item);

uint8 err = EQUIP_ERR_OK;
InventoryResult err = EQUIP_ERR_OK;
// Item is not in bag
if (!bagGuid)
{
Expand Down Expand Up @@ -17390,7 +17388,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
else
{
TC_LOG_ERROR("entities.player", "Player::_LoadInventory: Player '%s' (%s) has item (%s, entry: %u) which can't be loaded into inventory (Bag %s, slot: %u) by reason %u. Item will be sent by mail.",
GetName().c_str(), GetGUID().ToString().c_str(), item->GetGUID().ToString().c_str(), item->GetEntry(), bagGuid.ToString().c_str(), slot, err);
GetName().c_str(), GetGUID().ToString().c_str(), item->GetGUID().ToString().c_str(), item->GetEntry(), bagGuid.ToString().c_str(), slot, uint32(err));
item->DeleteFromInventoryDB(trans);
problematicItems.push_back(item);
}
Expand Down Expand Up @@ -23184,8 +23182,7 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
return;

ItemPosCountVec off_dest;
uint8 off_msg = CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false);
if (off_msg == EQUIP_ERR_OK)
if (CanStoreItem(NULL_BAG, NULL_SLOT, off_dest, offItem, false) == EQUIP_ERR_OK)
{
RemoveItem(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND, true);
StoreItem(off_dest, offItem, true);
Expand Down
14 changes: 7 additions & 7 deletions src/server/game/Entities/Player/Player.h
Expand Up @@ -456,7 +456,7 @@ enum RuneCooldowns
RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
};

enum RuneType
enum RuneType : uint8
{
RUNE_BLOOD = 0,
RUNE_UNHOLY = 1,
Expand Down Expand Up @@ -739,7 +739,7 @@ enum PlayerSlots

#define INVENTORY_SLOT_BAG_0 255

enum EquipmentSlots // 19 slots
enum EquipmentSlots : uint8 // 19 slots
{
EQUIPMENT_SLOT_START = 0,
EQUIPMENT_SLOT_HEAD = 0,
Expand Down Expand Up @@ -767,13 +767,13 @@ enum EquipmentSlots // 19 slots
#define VISIBLE_ITEM_ENTRY_OFFSET 0
#define VISIBLE_ITEM_ENCHANTMENT_OFFSET 1

enum InventorySlots // 4 slots
enum InventorySlots : uint8 // 4 slots
{
INVENTORY_SLOT_BAG_START = 19,
INVENTORY_SLOT_BAG_END = 23
};

enum InventoryPackSlots // 16 slots
enum InventoryPackSlots : uint8 // 16 slots
{
INVENTORY_SLOT_ITEM_START = 23,
INVENTORY_SLOT_ITEM_END = 39
Expand Down Expand Up @@ -915,7 +915,7 @@ enum TeleportToOptions
};

/// Type of environmental damages
enum EnviromentalDamage
enum EnviromentalDamage : uint8
{
DAMAGE_EXHAUSTED = 0,
DAMAGE_DROWNING = 1,
Expand Down Expand Up @@ -1063,7 +1063,7 @@ enum ReferAFriendError
ERR_REFER_A_FRIEND_MAP_INCOMING_TRANSFER_NOT_ALLOWED = 15
};

enum PlayerRestState
enum PlayerRestState : uint8
{
REST_STATE_RESTED = 0x01,
REST_STATE_NOT_RAF_LINKED = 0x02,
Expand All @@ -1080,7 +1080,7 @@ enum PlayerCommandStates
CHEAT_WATERWALK = 0x10
};

enum PlayerLogXPReason
enum PlayerLogXPReason : uint8
{
LOG_XP_REASON_KILL = 0,
LOG_XP_REASON_NO_KILL = 1
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Unit/Unit.h
Expand Up @@ -612,7 +612,7 @@ enum UnitMoveType
TC_GAME_API extern float baseMoveSpeed[MAX_MOVE_TYPE];
TC_GAME_API extern float playerBaseMoveSpeed[MAX_MOVE_TYPE];

enum WeaponAttackType : uint16
enum WeaponAttackType : uint8
{
BASE_ATTACK = 0,
OFF_ATTACK = 1,
Expand Down Expand Up @@ -1132,7 +1132,7 @@ enum ReactStates
REACT_ASSIST = 3
};

enum CommandStates
enum CommandStates : uint8
{
COMMAND_STAY = 0,
COMMAND_FOLLOW = 1,
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Loot/LootMgr.h
Expand Up @@ -62,7 +62,7 @@ enum RollMask
#define MAX_NR_QUEST_ITEMS 32
// unrelated to the number of quest items shown, just for reserve

enum LootMethod
enum LootMethod : uint8
{
FREE_FOR_ALL = 0,
ROUND_ROBIN = 1,
Expand All @@ -83,7 +83,7 @@ enum PermissionTypes
NONE_PERMISSION = 6
};

enum LootType
enum LootType : uint8
{
LOOT_NONE = 0,

Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Miscellaneous/SharedDefines.h
Expand Up @@ -23,7 +23,7 @@
#include "DetourNavMesh.h"
#include <cassert>

enum SpellEffIndex
enum SpellEffIndex : uint8
{
EFFECT_0 = 0,
EFFECT_1 = 1,
Expand Down Expand Up @@ -4903,7 +4903,7 @@ enum RaidGroupReason
RAID_GROUP_ERR_REQUIREMENTS_UNMATCH = 4 // "You do not meet the requirements to enter this instance."
};

enum ResetFailedReason
enum ResetFailedReason : uint8
{
INSTANCE_RESET_FAILED = 0, // "Cannot reset %s. There are players still inside the instance."
INSTANCE_RESET_FAILED_ZONING = 1, // "Cannot reset %s. There are players in your party attempting to zone into an instance."
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Quests/QuestDef.h
Expand Up @@ -68,7 +68,7 @@ enum QuestFailedReason
QUEST_ERR_HAS_IN_PROGRESS = 30 // "Progress Bar objective not completed"
};

enum QuestPushReason
enum QuestPushReason : uint8
{
QUEST_PUSH_SUCCESS = 0, // "Sharing quest with %s..."
QUEST_PUSH_INVALID = 1, // "%s is not eligible for that quest"
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Services/WorldserverService.cpp
Expand Up @@ -98,7 +98,7 @@ uint32 Battlenet::GameUtilitiesService::HandleRealmJoinRequest(std::unordered_ma
{
auto realmAddress = params.find("Param_RealmAddress");
if (realmAddress != params.end())
return sRealmList->JoinRealm(realmAddress->second->uint_value(), realm.Build, boost::asio::ip::address::from_string(_session->GetRemoteAddress()), _session->GetRealmListSecret(),
return sRealmList->JoinRealm(uint32(realmAddress->second->uint_value()), realm.Build, boost::asio::ip::address::from_string(_session->GetRemoteAddress()), _session->GetRealmListSecret(),
_session->GetSessionDbcLocale(), _session->GetOS(), _session->GetAccountName(), response);

return ERROR_WOW_SERVICES_INVALID_JOIN_TICKET;
Expand Down
5 changes: 2 additions & 3 deletions src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -1995,8 +1995,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex /*effIndex*/)
else if (player->IsBankPos(pos))
{
ItemPosCountVec dest;
uint8 msg = player->CanBankItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true);
if (msg == EQUIP_ERR_OK)
if (player->CanBankItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true) == EQUIP_ERR_OK)
{
player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);

Expand All @@ -2019,7 +2018,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex /*effIndex*/)

player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);

uint8 msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);
InventoryResult msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);

if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CLIENT_LOCKED_OUT)
{
Expand Down
9 changes: 0 additions & 9 deletions src/server/shared/Packets/ByteBuffer.h
Expand Up @@ -24,15 +24,6 @@
#include "ByteConverter.h"
#include "Util.h"

#include <exception>
#include <list>
#include <map>
#include <string>
#include <vector>
#include <cstring>
#include <time.h>
#include <cmath>
#include <type_traits>

class MessageBuffer;

Expand Down

0 comments on commit 08c27d3

Please sign in to comment.