mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Apply style fix pt2
This commit is contained in:
parent
35405dd549
commit
1392c131e7
77 changed files with 1318 additions and 817 deletions
|
|
@ -828,7 +828,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
{
|
||||
Chance = MaxChance - (ratio * (MaxChance / 10));
|
||||
}
|
||||
else { Chance = 1; }
|
||||
else
|
||||
{
|
||||
Chance = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -847,7 +850,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
{
|
||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||
}
|
||||
else { Chance = 1; }
|
||||
else
|
||||
{
|
||||
Chance = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -862,9 +868,15 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
{
|
||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||
}
|
||||
else { Chance = 0; }
|
||||
else
|
||||
{
|
||||
Chance = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Chance = 0;
|
||||
}
|
||||
else { Chance = 0; }
|
||||
}
|
||||
uint32 RandNum = urand(1, ChanceRatio);
|
||||
if (RandNum <= Chance)
|
||||
|
|
@ -1056,8 +1068,14 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
|||
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance))
|
||||
{
|
||||
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance))
|
||||
if (urand(0, 5) == 0) { PlaceBidToEntry(auction, bidPrice); }
|
||||
else { BuyEntry(auction); }
|
||||
if (urand(0, 5) == 0)
|
||||
{
|
||||
PlaceBidToEntry(auction, bidPrice);
|
||||
}
|
||||
else
|
||||
{
|
||||
BuyEntry(auction);
|
||||
}
|
||||
else
|
||||
{ BuyEntry(auction); }
|
||||
}
|
||||
|
|
@ -1093,7 +1111,10 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//== AuctionBotSeller functions ============================
|
||||
|
|
@ -1898,7 +1919,10 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
|
|||
items = sAuctionBotConfig.GetItemPerCycleBoost();
|
||||
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
|
||||
}
|
||||
else { items = sAuctionBotConfig.GetItemPerCycleNormal(); }
|
||||
else
|
||||
{
|
||||
items = sAuctionBotConfig.GetItemPerCycleNormal();
|
||||
}
|
||||
|
||||
uint32 houseid;
|
||||
switch (config.GetHouseType())
|
||||
|
|
|
|||
|
|
@ -607,7 +607,10 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -651,7 +654,10 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -684,7 +690,10 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -716,7 +725,10 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -756,7 +768,10 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
if (team == teamId)
|
||||
{
|
||||
|
|
@ -1286,7 +1301,10 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
{
|
||||
plr->ClearAfkReports();
|
||||
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
if (!team)
|
||||
{
|
||||
team = plr->GetTeam();
|
||||
}
|
||||
|
||||
// if arena, remove the specific arena auras
|
||||
if (isArena())
|
||||
|
|
|
|||
|
|
@ -363,7 +363,10 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
|||
else
|
||||
{ PSendSysMessage("You are INdoor"); }
|
||||
}
|
||||
else { PSendSysMessage("no VMAP available for area info"); }
|
||||
else
|
||||
{
|
||||
PSendSysMessage("no VMAP available for area info");
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_MAP_POSITION,
|
||||
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),
|
||||
|
|
|
|||
|
|
@ -5464,7 +5464,10 @@ bool ChatHandler::HandleListAurasCommand(char* /*args*/)
|
|||
for (int i = 0; i < TOTAL_AURAS; ++i)
|
||||
{
|
||||
Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i));
|
||||
if (uAuraList.empty()) { continue; }
|
||||
if (uAuraList.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
|
||||
for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
|
||||
{
|
||||
|
|
@ -7226,7 +7229,10 @@ bool ChatHandler::HandleCastSelfCommand(char* args)
|
|||
bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
|
||||
{
|
||||
Player* player = getSelectedPlayer();
|
||||
if (!player) { player = m_session->GetPlayer(); }
|
||||
if (!player)
|
||||
{
|
||||
player = m_session->GetPlayer();
|
||||
}
|
||||
uint32 counter = 0;
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -447,7 +447,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
{ return false; }
|
||||
|
||||
Player* player = getSelectedPlayer();
|
||||
if (!player) { player = m_session->GetPlayer(); }
|
||||
if (!player)
|
||||
{
|
||||
player = m_session->GetPlayer();
|
||||
}
|
||||
|
||||
if (!list_queue && !check_all)
|
||||
{
|
||||
|
|
@ -461,7 +464,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
}
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!item) { continue; }
|
||||
if (!item)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!item->IsBag())
|
||||
{
|
||||
if (item->GetState() == state)
|
||||
|
|
@ -489,7 +495,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||
{
|
||||
Item* item = updateQueue[i];
|
||||
if (!item) { continue; }
|
||||
if (!item)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Bag* container = item->GetContainer();
|
||||
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
|
||||
|
|
@ -524,7 +533,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
}
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!item) { continue; }
|
||||
if (!item)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item->GetSlot() != i)
|
||||
{
|
||||
|
|
@ -587,7 +599,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
|
||||
{
|
||||
Item* item2 = bag->GetItemByPos(j);
|
||||
if (!item2) { continue; }
|
||||
if (!item2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item2->GetSlot() != j)
|
||||
{
|
||||
|
|
@ -658,7 +673,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||
{
|
||||
Item* item = updateQueue[i];
|
||||
if (!item) { continue; }
|
||||
if (!item)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item->GetOwnerGuid() != player->GetObjectGuid())
|
||||
{
|
||||
|
|
@ -675,7 +693,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
error = true; continue;
|
||||
}
|
||||
|
||||
if (item->GetState() == ITEM_REMOVED) { continue; }
|
||||
if (item->GetState() == ITEM_REMOVED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
||||
|
||||
if (test == NULL)
|
||||
|
|
|
|||
|
|
@ -2173,7 +2173,10 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (bcontinue) { continue; }
|
||||
if (bcontinue)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -379,7 +379,10 @@ struct VendorItemData
|
|||
|
||||
VendorItem* GetItem(uint32 slot) const
|
||||
{
|
||||
if (slot >= m_items.size()) { return NULL; }
|
||||
if (slot >= m_items.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return m_items[slot];
|
||||
}
|
||||
bool Empty() const { return m_items.empty(); }
|
||||
|
|
|
|||
|
|
@ -74,17 +74,50 @@ namespace MaNGOS
|
|||
|
||||
inline uint32 GetZeroDifference(uint32 pl_level)
|
||||
{
|
||||
if (pl_level < 8) { return 5; }
|
||||
if (pl_level < 10) { return 6; }
|
||||
if (pl_level < 12) { return 7; }
|
||||
if (pl_level < 16) { return 8; }
|
||||
if (pl_level < 20) { return 9; }
|
||||
if (pl_level < 30) { return 11; }
|
||||
if (pl_level < 40) { return 12; }
|
||||
if (pl_level < 45) { return 13; }
|
||||
if (pl_level < 50) { return 14; }
|
||||
if (pl_level < 55) { return 15; }
|
||||
if (pl_level < 60) { return 16; }
|
||||
if (pl_level < 8)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
if (pl_level < 10)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
if (pl_level < 12)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
if (pl_level < 16)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
if (pl_level < 20)
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
if (pl_level < 30)
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
if (pl_level < 40)
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
if (pl_level < 45)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
if (pl_level < 50)
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
if (pl_level < 55)
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
if (pl_level < 60)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
return 17;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -815,7 +815,10 @@ bool GameObject::IsTransport() const
|
|||
{
|
||||
// If something is marked as a transport, don't transmit an out of range packet for it.
|
||||
GameObjectInfo const* gInfo = GetGOInfo();
|
||||
if (!gInfo) { return false; }
|
||||
if (!gInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -941,7 +941,10 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
if (state != ITEM_UNCHANGED)
|
||||
{
|
||||
// new items must stay in new state until saved
|
||||
if (uState != ITEM_NEW) { uState = state; }
|
||||
if (uState != ITEM_NEW)
|
||||
{
|
||||
uState = state;
|
||||
}
|
||||
|
||||
if (forplayer || GetOwnerGuid())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,7 +104,10 @@ void LoadRandomEnchantmentsTable()
|
|||
|
||||
uint32 GetItemEnchantMod(int32 entry)
|
||||
{
|
||||
if (!entry) { return 0; }
|
||||
if (!entry)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EnchantmentStore::const_iterator tab;
|
||||
if (entry > 0)
|
||||
|
|
@ -134,7 +137,10 @@ uint32 GetItemEnchantMod(int32 entry)
|
|||
{
|
||||
fCount += ench_iter->chance;
|
||||
|
||||
if (fCount > dRoll) { return ench_iter->ench; }
|
||||
if (fCount > dRoll)
|
||||
{
|
||||
return ench_iter->ench;
|
||||
}
|
||||
}
|
||||
|
||||
// we could get here only if sum of all enchantment chances is lower than 100%
|
||||
|
|
@ -145,7 +151,10 @@ uint32 GetItemEnchantMod(int32 entry)
|
|||
{
|
||||
fCount += ench_iter->chance;
|
||||
|
||||
if (fCount > dRoll) { return ench_iter->ench; }
|
||||
if (fCount > dRoll)
|
||||
{
|
||||
return ench_iter->ench;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -670,7 +670,10 @@ QuestItemList* Loot::FillFFALoot(Player* player)
|
|||
|
||||
QuestItemList* Loot::FillQuestLoot(Player* player)
|
||||
{
|
||||
if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; }
|
||||
if (items.size() == MAX_NR_LOOT_ITEMS)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
QuestItemList* ql = new QuestItemList();
|
||||
|
||||
for (uint8 i = 0; i < m_questItems.size(); ++i)
|
||||
|
|
|
|||
|
|
@ -782,7 +782,10 @@ void Object::ClearUpdateMask(bool remove)
|
|||
|
||||
bool Object::LoadValues(const char* data)
|
||||
{
|
||||
if (!m_uint32Values) { _InitValues(); }
|
||||
if (!m_uint32Values)
|
||||
{
|
||||
_InitValues();
|
||||
}
|
||||
|
||||
Tokens tokens = StrSplit(data, " ");
|
||||
|
||||
|
|
@ -1318,7 +1321,10 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
|||
|
||||
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
|
||||
{
|
||||
if (!IsInMap(obj)) { return false; }
|
||||
if (!IsInMap(obj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
float ox, oy, oz;
|
||||
obj->GetPosition(ox, oy, oz);
|
||||
return(IsWithinLOS(ox, oy, oz));
|
||||
|
|
|
|||
|
|
@ -617,10 +617,19 @@ class ObjectMgr
|
|||
|
||||
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
|
||||
{
|
||||
if (race >= MAX_RACES) { return NULL; }
|
||||
if (class_ >= MAX_CLASSES) { return NULL; }
|
||||
if (race >= MAX_RACES)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (class_ >= MAX_CLASSES)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
PlayerInfo const* info = &playerInfo[race][class_];
|
||||
if (info->displayId_m == 0 || info->displayId_f == 0) { return NULL; }
|
||||
if (info->displayId_m == 0 || info->displayId_f == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const;
|
||||
|
|
@ -963,7 +972,10 @@ class ObjectMgr
|
|||
CreatureDataPair const* GetCreatureDataPair(uint32 guid) const
|
||||
{
|
||||
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
||||
if (itr == mCreatureDataMap.end()) { return NULL; }
|
||||
if (itr == mCreatureDataMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &*itr;
|
||||
}
|
||||
|
||||
|
|
@ -992,7 +1004,10 @@ class ObjectMgr
|
|||
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
||||
{
|
||||
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
|
||||
if (itr == mCreatureLocaleMap.end()) { return NULL; }
|
||||
if (itr == mCreatureLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -1001,14 +1016,20 @@ class ObjectMgr
|
|||
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
||||
{
|
||||
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
||||
if (itr == mGameObjectLocaleMap.end()) { return NULL; }
|
||||
if (itr == mGameObjectLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
ItemLocale const* GetItemLocale(uint32 entry) const
|
||||
{
|
||||
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
||||
if (itr == mItemLocaleMap.end()) { return NULL; }
|
||||
if (itr == mItemLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -1017,7 +1038,10 @@ class ObjectMgr
|
|||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||
{
|
||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||
if (itr == mQuestLocaleMap.end()) { return NULL; }
|
||||
if (itr == mQuestLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -1026,7 +1050,10 @@ class ObjectMgr
|
|||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||
{
|
||||
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
||||
if (itr == mNpcTextLocaleMap.end()) { return NULL; }
|
||||
if (itr == mNpcTextLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
@ -1037,28 +1064,40 @@ class ObjectMgr
|
|||
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
||||
{
|
||||
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
||||
if (itr == mPageTextLocaleMap.end()) { return NULL; }
|
||||
if (itr == mPageTextLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
||||
{
|
||||
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
||||
if (itr == mGossipMenuItemsLocaleMap.end()) { return NULL; }
|
||||
if (itr == mGossipMenuItemsLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
||||
{
|
||||
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
||||
if (itr == mPointOfInterestLocaleMap.end()) { return NULL; }
|
||||
if (itr == mPointOfInterestLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
GameObjectDataPair const* GetGODataPair(uint32 guid) const
|
||||
{
|
||||
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
||||
if (itr == mGameObjectDataMap.end()) { return NULL; }
|
||||
if (itr == mGameObjectDataMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &*itr;
|
||||
}
|
||||
|
||||
|
|
@ -1087,7 +1126,10 @@ class ObjectMgr
|
|||
MangosStringLocale const* GetMangosStringLocale(int32 entry) const
|
||||
{
|
||||
MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry);
|
||||
if (itr == mMangosStringLocaleMap.end()) { return NULL; }
|
||||
if (itr == mMangosStringLocaleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
uint32 GetLoadedStringsCount(int32 minEntry) const
|
||||
|
|
@ -1142,7 +1184,10 @@ class ObjectMgr
|
|||
GameTele const* GetGameTele(uint32 id) const
|
||||
{
|
||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||
if (itr == m_GameTeleMap.end()) { return NULL; }
|
||||
if (itr == m_GameTeleMap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1173,8 +1173,14 @@ class Player : public Unit
|
|||
void SetGMVisible(bool on);
|
||||
void SetPvPDeath(bool on)
|
||||
{
|
||||
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
|
||||
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
|
||||
if (on)
|
||||
{
|
||||
m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH;
|
||||
}
|
||||
}
|
||||
|
||||
// 0 = own auction, -1 = enemy auction, 1 = goblin auction
|
||||
|
|
|
|||
|
|
@ -2197,7 +2197,10 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
|
|||
|
||||
void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||
{
|
||||
if (damageInfo == 0) { return; }
|
||||
if (damageInfo == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Unit* pVictim = damageInfo->target;
|
||||
|
||||
if (!this || !pVictim)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,10 @@ class MapReference : public Reference<Map, Player>
|
|||
void targetObjectDestroyLink() override
|
||||
{
|
||||
// called from unlink()
|
||||
if (isValid()) { getTarget()->m_mapRefManager.decSize(); }
|
||||
if (isValid())
|
||||
{
|
||||
getTarget()->m_mapRefManager.decSize();
|
||||
}
|
||||
}
|
||||
void sourceObjectDestroyLink() override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -485,7 +485,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
||||
delete result;
|
||||
}
|
||||
else { incHighest = false; }
|
||||
else
|
||||
{
|
||||
incHighest = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
|
||||
|
|
@ -528,7 +531,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
{
|
||||
if (!fgets(buf, 32000, fin))
|
||||
{
|
||||
if (feof(fin)) { break; }
|
||||
if (feof(fin))
|
||||
{
|
||||
break;
|
||||
}
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1471,8 +1471,8 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
/*
|
||||
|
||||
valid examples:
|
||||
|cff00aa00|Hcurrency:391|h[Рекомендательный значок Тол Барада]|h|r
|
||||
|cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[Каражан]|h|r NYI
|
||||
|cff00aa00|Hcurrency:391|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r
|
||||
|cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r NYI
|
||||
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|
||||
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|
||||
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
|
||||
|
|
|
|||
|
|
@ -114,8 +114,14 @@ class Map : public GridRefManager<NGridType>
|
|||
// currently unused for normal maps
|
||||
bool CanUnload(uint32 diff)
|
||||
{
|
||||
if (!m_unloadTimer) { return false; }
|
||||
if (m_unloadTimer <= diff) { return true; }
|
||||
if (!m_unloadTimer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (m_unloadTimer <= diff)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
m_unloadTimer -= diff;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7121,8 +7121,14 @@ void Aura::HandleShapeshiftBoosts(bool apply)
|
|||
const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
|
||||
{
|
||||
if (itr->second.state == PLAYERSPELL_REMOVED) { continue; }
|
||||
if (itr->first == spellId1 || itr->first == spellId2) { continue; }
|
||||
if (itr->second.state == PLAYERSPELL_REMOVED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (itr->first == spellId1 || itr->first == spellId2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||
if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3034,13 +3034,25 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
|
|||
{
|
||||
float stat = 0.0f;
|
||||
// strength
|
||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); }
|
||||
if (GetStat(STAT_STRENGTH) > stat)
|
||||
{
|
||||
trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH);
|
||||
}
|
||||
// agility
|
||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); }
|
||||
if (GetStat(STAT_AGILITY) > stat)
|
||||
{
|
||||
trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY);
|
||||
}
|
||||
// intellect
|
||||
if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);}
|
||||
if (GetStat(STAT_INTELLECT) > stat)
|
||||
{
|
||||
trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);
|
||||
}
|
||||
// spirit
|
||||
if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
|
||||
if (GetStat(STAT_SPIRIT) > stat)
|
||||
{
|
||||
trigger_spell_id = 60235;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// case 55580: break: // Mana Link
|
||||
|
|
@ -3093,18 +3105,30 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
|
|||
{
|
||||
float stat = 0.0f;
|
||||
// strength
|
||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); }
|
||||
if (GetStat(STAT_STRENGTH) > stat)
|
||||
{
|
||||
trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH);
|
||||
}
|
||||
// agility
|
||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
|
||||
if (GetStat(STAT_AGILITY) > stat)
|
||||
{
|
||||
trigger_spell_id = 67703;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
|
||||
{
|
||||
float stat = 0.0f;
|
||||
// strength
|
||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); }
|
||||
if (GetStat(STAT_STRENGTH) > stat)
|
||||
{
|
||||
trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH);
|
||||
}
|
||||
// agility
|
||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
|
||||
if (GetStat(STAT_AGILITY) > stat)
|
||||
{
|
||||
trigger_spell_id = 67772;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 69023: // Mirrored Soul
|
||||
|
|
|
|||
|
|
@ -298,7 +298,10 @@ class BIH
|
|||
while (n > 0)
|
||||
{
|
||||
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst);
|
||||
if (stopAtFirst && hit) { return; }
|
||||
if (stopAtFirst && hit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
--n;
|
||||
++offset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,20 +313,35 @@ namespace VMAP
|
|||
{
|
||||
char chunk[8];
|
||||
// general info
|
||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { success = false; }
|
||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
char tiled=0;
|
||||
if (success && fread(&tiled, sizeof(char), 1, rf) != 1) { success = false; }
|
||||
if (success && fread(&tiled, sizeof(char), 1, rf) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
iIsTiled = bool(tiled);
|
||||
// Nodes
|
||||
if (success && !readChunk(rf, chunk, "NODE", 4)) { success = false; }
|
||||
if (success) { success = iTree.readFromFile(rf); }
|
||||
if (success && !readChunk(rf, chunk, "NODE", 4))
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
success = iTree.readFromFile(rf);
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
iNTreeValues = iTree.primCount();
|
||||
iTreeValues = new ModelInstance[iNTreeValues];
|
||||
}
|
||||
|
||||
if (success && !readChunk(rf, chunk, "GOBJ", 4)) { success = false; }
|
||||
if (success && !readChunk(rf, chunk, "GOBJ", 4))
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
// global model spawns
|
||||
// only non-tiled maps have them, and if so exactly one (so far at least...)
|
||||
ModelSpawn spawn;
|
||||
|
|
|
|||
|
|
@ -229,9 +229,15 @@ namespace VMAP
|
|||
}
|
||||
uint32 nameLen = spawn.name.length();
|
||||
check += fwrite(&nameLen, sizeof(uint32), 1, wf);
|
||||
if (check != uint32(has_bound ? 17 : 11)) { return false; }
|
||||
if (check != uint32(has_bound ? 17 : 11))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf);
|
||||
if (check != nameLen) { return false; }
|
||||
if (check != nameLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ namespace VMAP
|
|||
{
|
||||
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
|
||||
{
|
||||
if (fread(dest, sizeof(char), len, rf) != len) { return false; }
|
||||
if (fread(dest, sizeof(char), len, rf) != len)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return memcmp(dest, compare, len) == 0;
|
||||
}
|
||||
|
||||
|
|
@ -130,16 +133,31 @@ namespace VMAP
|
|||
}
|
||||
|
||||
// general info
|
||||
if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) { success = false; }
|
||||
if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
uint32 globalTileID = StaticMapTree::packTileID(65, 65);
|
||||
pair<TileMap::iterator, TileMap::iterator> globalRange = map_iter->second->TileEntries.equal_range(globalTileID);
|
||||
char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO
|
||||
if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) { success = false; }
|
||||
if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
// Nodes
|
||||
if (success && fwrite("NODE", 4, 1, mapfile) != 1) { success = false; }
|
||||
if (success) { success = pTree.writeToFile(mapfile); }
|
||||
if (success && fwrite("NODE", 4, 1, mapfile) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
success = pTree.writeToFile(mapfile);
|
||||
}
|
||||
// global map spawns (WDT), if any (most instances)
|
||||
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) { success = false; }
|
||||
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
|
||||
for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob)
|
||||
{
|
||||
|
|
@ -169,9 +187,15 @@ namespace VMAP
|
|||
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
|
||||
FILE* tilefile = fopen(tilefilename.str().c_str(), "wb");
|
||||
// file header
|
||||
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) { success = false; }
|
||||
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
// write number of tile spawns
|
||||
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) { success = false; }
|
||||
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
// write tile spawns
|
||||
for (uint32 s = 0; s < nSpawns; ++s)
|
||||
{
|
||||
|
|
@ -183,7 +207,10 @@ namespace VMAP
|
|||
success = success && ModelSpawn::writeToFile(tilefile, spawn2);
|
||||
// MapTree nodes to update when loading tile:
|
||||
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
|
||||
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) { success = false; }
|
||||
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1)
|
||||
{
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
fclose(tilefile);
|
||||
}
|
||||
|
|
@ -250,7 +277,10 @@ namespace VMAP
|
|||
printf("spawning Map %d\n", mapID);
|
||||
mapData[mapID] = current = new MapSpawns();
|
||||
}
|
||||
else { current = (*map_iter).second; }
|
||||
else
|
||||
{
|
||||
current = (*map_iter).second;
|
||||
}
|
||||
current->UniqueEntries.insert(pair<uint32, ModelSpawn>(spawn.ID, spawn));
|
||||
current->TileEntries.insert(pair<uint32, uint32>(StaticMapTree::packTileID(tileX, tileY), spawn.ID));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,14 +229,32 @@ namespace VMAP
|
|||
bool WmoLiquid::writeToFile(FILE* wf)
|
||||
{
|
||||
bool result = true;
|
||||
if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
uint32 size = (iTilesX + 1) * (iTilesY + 1);
|
||||
if (result && fwrite(iHeight, sizeof(float), size, wf) != size) { result = false; }
|
||||
if (result && fwrite(iHeight, sizeof(float), size, wf) != size)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
size = iTilesX * iTilesY;
|
||||
if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) { result = false; }
|
||||
if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -244,16 +262,34 @@ namespace VMAP
|
|||
{
|
||||
bool result = true;
|
||||
WmoLiquid* liquid = new WmoLiquid();
|
||||
if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1);
|
||||
liquid->iHeight = new float[size];
|
||||
if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) { result = false; }
|
||||
if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
size = liquid->iTilesX * liquid->iTilesY;
|
||||
liquid->iFlags = new uint8[size];
|
||||
if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) { result = false; }
|
||||
if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
delete liquid;
|
||||
|
|
@ -290,41 +326,89 @@ namespace VMAP
|
|||
bool result = true;
|
||||
uint32 chunkSize, count;
|
||||
|
||||
if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// write vertices
|
||||
if (result && fwrite("VERT", 1, 4, wf) != 4) { result = false; }
|
||||
if (result && fwrite("VERT", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
count = vertices.size();
|
||||
chunkSize = sizeof(uint32) + sizeof(Vector3) * count;
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) { result = false; }
|
||||
if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// write triangle mesh
|
||||
if (result && fwrite("TRIM", 1, 4, wf) != 4) { result = false; }
|
||||
if (result && fwrite("TRIM", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
count = triangles.size();
|
||||
chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count;
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (count)
|
||||
if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) { result = false; }
|
||||
if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// write mesh BIH
|
||||
if (result && fwrite("MBIH", 1, 4, wf) != 4) { result = false; }
|
||||
if (result) { result = meshTree.writeToFile(wf); }
|
||||
if (result && fwrite("MBIH", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
result = meshTree.writeToFile(wf);
|
||||
}
|
||||
|
||||
// write liquid data
|
||||
if (result && fwrite("LIQU", 1, 4, wf) != 4) { result = false; }
|
||||
if (result && fwrite("LIQU", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
chunkSize = iLiquid ? iLiquid->GetFileSize() : 0;
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (chunkSize)
|
||||
if (result) { result = iLiquid->writeToFile(wf); }
|
||||
if (result)
|
||||
{
|
||||
result = iLiquid->writeToFile(wf);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -340,38 +424,89 @@ namespace VMAP
|
|||
delete iLiquid;
|
||||
iLiquid = 0;
|
||||
|
||||
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// read vertices
|
||||
if (result && !readChunk(rf, chunk, "VERT", 4)) { result = false; }
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && !readChunk(rf, chunk, "VERT", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (result) { vertices.resize(count); }
|
||||
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) { result = false; }
|
||||
if (result)
|
||||
{
|
||||
vertices.resize(count);
|
||||
}
|
||||
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// read triangle mesh
|
||||
if (result && !readChunk(rf, chunk, "TRIM", 4)) { result = false; }
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && !readChunk(rf, chunk, "TRIM", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (count)
|
||||
{
|
||||
if (result) { triangles.resize(count); }
|
||||
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) { result = false; }
|
||||
if (result)
|
||||
{
|
||||
triangles.resize(count);
|
||||
}
|
||||
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
// read mesh BIH
|
||||
if (result && !readChunk(rf, chunk, "MBIH", 4)) { result = false; }
|
||||
if (result) { result = meshTree.readFromFile(rf); }
|
||||
if (result && !readChunk(rf, chunk, "MBIH", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
result = meshTree.readFromFile(rf);
|
||||
}
|
||||
|
||||
// read liquid data
|
||||
if (result && !readChunk(rf, chunk, "LIQU", 4)) { result = false; }
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && !readChunk(rf, chunk, "LIQU", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && chunkSize > 0)
|
||||
{
|
||||
result = WmoLiquid::readFromFile(rf, iLiquid);
|
||||
|
|
@ -386,7 +521,10 @@ namespace VMAP
|
|||
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/)
|
||||
{
|
||||
bool result = IntersectTriangle(triangles[entry], vertices, ray, distance);
|
||||
if (result) { hit = true; }
|
||||
if (result)
|
||||
{
|
||||
hit = true;
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
std::vector<Vector3>::const_iterator vertices;
|
||||
|
|
@ -455,7 +593,10 @@ namespace VMAP
|
|||
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit)
|
||||
{
|
||||
bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit);
|
||||
if (result) { hit = true; }
|
||||
if (result)
|
||||
{
|
||||
hit = true;
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
std::vector<GroupModel>::const_iterator models;
|
||||
|
|
@ -561,25 +702,46 @@ namespace VMAP
|
|||
|
||||
uint32 chunkSize, count;
|
||||
bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8;
|
||||
if (result && fwrite("WMOD", 1, 4, wf) != 4) { result = false; }
|
||||
if (result && fwrite("WMOD", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
chunkSize = sizeof(uint32) + sizeof(uint32);
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// write group models
|
||||
count = groupModels.size();
|
||||
if (count)
|
||||
{
|
||||
if (result && fwrite("GMOD", 1, 4, wf) != 4) { result = false; }
|
||||
if (result && fwrite("GMOD", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
// chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count;
|
||||
// if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false;
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
for (uint32 i = 0; i < groupModels.size() && result; ++i)
|
||||
{ result = groupModels[i].writeToFile(wf); }
|
||||
|
||||
// write group BIH
|
||||
if (result && fwrite("GBIH", 1, 4, wf) != 4) { result = false; }
|
||||
if (result) { result = groupTree.writeToFile(wf); }
|
||||
if (result && fwrite("GBIH", 1, 4, wf) != 4)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
result = groupTree.writeToFile(wf);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(wf);
|
||||
|
|
@ -598,26 +760,50 @@ namespace VMAP
|
|||
uint32 chunkSize = 0;
|
||||
uint32 count = 0;
|
||||
char chunk[8]; // Ignore the added magic header
|
||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { result = false; }
|
||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (result && !readChunk(rf, chunk, "WMOD", 4)) { result = false; }
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result && !readChunk(rf, chunk, "WMOD", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
// read group models
|
||||
if (result && readChunk(rf, chunk, "GMOD", 4))
|
||||
{
|
||||
// if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false;
|
||||
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
||||
if (result) { groupModels.resize(count); }
|
||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
groupModels.resize(count);
|
||||
}
|
||||
// if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false;
|
||||
for (uint32 i = 0; i < count && result; ++i)
|
||||
{ result = groupModels[i].readFromFile(rf); }
|
||||
|
||||
// read group BIH
|
||||
if (result && !readChunk(rf, chunk, "GBIH", 4)) { result = false; }
|
||||
if (result) { result = groupTree.readFromFile(rf); }
|
||||
if (result && !readChunk(rf, chunk, "GBIH", 4))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
if (result)
|
||||
{
|
||||
result = groupTree.readFromFile(rf);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(rf);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ BigNumber::BigNumber(uint32 val)
|
|||
BigNumber::~BigNumber()
|
||||
{
|
||||
BN_free(_bn);
|
||||
if (_array) { delete[] _array; }
|
||||
if (_array)
|
||||
{
|
||||
delete[] _array;
|
||||
}
|
||||
}
|
||||
|
||||
void BigNumber::SetDword(uint32 val)
|
||||
|
|
|
|||
|
|
@ -210,7 +210,10 @@ void Database::InitDelayThread()
|
|||
|
||||
void Database::HaltDelayThread()
|
||||
{
|
||||
if (!m_threadBody || !m_delayThread) { return; }
|
||||
if (!m_threadBody || !m_delayThread)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_threadBody->Stop(); // Stop event
|
||||
m_delayThread->wait(); // Wait for flush to DB
|
||||
|
|
@ -329,7 +332,10 @@ bool Database::PExecuteLog(const char* format, ...)
|
|||
|
||||
QueryResult* Database::PQuery(const char* format, ...)
|
||||
{
|
||||
if (!format) { return NULL; }
|
||||
if (!format)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
char szQuery [MAX_QUERY_LEN];
|
||||
|
|
@ -348,7 +354,10 @@ QueryResult* Database::PQuery(const char* format, ...)
|
|||
|
||||
QueryNamedResult* Database::PQueryNamed(const char* format, ...)
|
||||
{
|
||||
if (!format) { return NULL; }
|
||||
if (!format)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_list ap;
|
||||
char szQuery [MAX_QUERY_LEN];
|
||||
|
|
|
|||
|
|
@ -234,7 +234,10 @@ bool SqlQueryHolderEx::Execute(SqlConnection* conn)
|
|||
{
|
||||
/// execute all queries in the holder and pass the results
|
||||
char const* sql = queries[i].first;
|
||||
if (sql) { m_holder->SetResult(i, conn->Query(sql)); }
|
||||
if (sql)
|
||||
{
|
||||
m_holder->SetResult(i, conn->Query(sql));
|
||||
}
|
||||
}
|
||||
|
||||
/// sync with the caller thread
|
||||
|
|
|
|||
|
|
@ -87,7 +87,10 @@ void BarGoLink::step()
|
|||
|
||||
int i, n;
|
||||
|
||||
if (num_rec == 0) { return; }
|
||||
if (num_rec == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
++rec_no;
|
||||
n = rec_no * indic_len / num_rec;
|
||||
if (n != rec_pos)
|
||||
|
|
|
|||
|
|
@ -133,7 +133,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
|
|||
{
|
||||
if (sep.find(*i) != std::string::npos)
|
||||
{
|
||||
if (s.length()) { r.push_back(s); }
|
||||
if (s.length())
|
||||
{
|
||||
r.push_back(s);
|
||||
}
|
||||
s = "";
|
||||
}
|
||||
else
|
||||
|
|
@ -141,7 +144,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
|
|||
s += *i;
|
||||
}
|
||||
}
|
||||
if (s.length()) { r.push_back(s); }
|
||||
if (s.length())
|
||||
{
|
||||
r.push_back(s);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,10 @@ void WINAPI ServiceMain(DWORD argc, char* argv[])
|
|||
|
||||
for (i = 0; i < std::strlen(path); ++i)
|
||||
{
|
||||
if (path[i] == '\\') { last_slash = i; }
|
||||
if (path[i] == '\\')
|
||||
{
|
||||
last_slash = i;
|
||||
}
|
||||
}
|
||||
|
||||
path[last_slash] = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue