diff --git a/sql/mangos.sql b/sql/mangos.sql index f1e22a6ac..ae74d03e8 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_9622_01_mangos_gameobject` bit(1) default NULL + `required_9636_01_mangos_item_template` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -2252,7 +2252,7 @@ CREATE TABLE `item_template` ( `GemProperties` mediumint(9) NOT NULL default '0', `RequiredDisenchantSkill` smallint(6) NOT NULL default '-1', `ArmorDamageModifier` float NOT NULL default '0', - `Duration` int(11) NOT NULL default '0' COMMENT 'Duration in seconds. Negative value means realtime, postive value ingame time', + `Duration` int(11) UNSIGNED DEFAULT '0' NOT NULL COMMENT 'Duration in seconds.', `ItemLimitCategory` smallint(6) NOT NULL default '0', `HolidayId` int(11) UNSIGNED DEFAULT '0' NOT NULL, `ScriptName` varchar(64) NOT NULL default '', @@ -2260,7 +2260,7 @@ CREATE TABLE `item_template` ( `FoodType` tinyint(3) unsigned NOT NULL default '0', `minMoneyLoot` int(10) unsigned NOT NULL default '0', `maxMoneyLoot` int(10) unsigned NOT NULL default '0', - `NonConsumable` tinyint(1) UNSIGNED NOT NULL default '0', + `ExtraFlags` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY (`entry`), KEY `items_index` (`class`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Item System'; diff --git a/sql/updates/9636_01_mangos_item_template.sql b/sql/updates/9636_01_mangos_item_template.sql new file mode 100644 index 000000000..cf72ec433 --- /dev/null +++ b/sql/updates/9636_01_mangos_item_template.sql @@ -0,0 +1,14 @@ +ALTER TABLE db_version CHANGE COLUMN required_9622_01_mangos_gameobject required_9636_01_mangos_item_template bit; + +ALTER TABLE item_template + CHANGE COLUMN NonConsumable ExtraFlags tinyint(1) UNSIGNED DEFAULT '0' NOT NULL; + +UPDATE item_template + SET ExtraFlags = ExtraFlags | 0x2 WHERE Duration < 0 ; + +UPDATE item_template + SET Duration = abs(Duration); + +ALTER TABLE item_template + CHANGE COLUMN Duration Duration int(11) UNSIGNED DEFAULT '0' NOT NULL; + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index e43e04a01..a8f63ee8f 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -95,6 +95,7 @@ pkgdata_DATA = \ 9632_01_characters_characters.sql \ 9634_01_characters_corpse.sql \ 9635_01_characters_characters.sql \ + 9636_01_mangos_item_template.sql \ README ## Additional files to include when running 'make dist' @@ -170,4 +171,5 @@ EXTRA_DIST = \ 9632_01_characters_characters.sql \ 9634_01_characters_corpse.sql \ 9635_01_characters_characters.sql \ + 9636_01_mangos_item_template.sql \ README diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 5a61c4e93..c80b43e3c 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -1915,7 +1915,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if(!criteria) continue; - assert(criteria->requiredType < ACHIEVEMENT_CRITERIA_TYPE_TOTAL && "Not updated ACHIEVEMENT_CRITERIA_TYPE_TOTAL?"); + ASSERT(criteria->requiredType < ACHIEVEMENT_CRITERIA_TYPE_TOTAL && "Not updated ACHIEVEMENT_CRITERIA_TYPE_TOTAL?"); m_AchievementCriteriasByType[criteria->requiredType].push_back(criteria); m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria); diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index d68f1789f..75b9a2972 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -467,7 +467,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data ) else { SendAuctionCommandResult( 0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR ); - //this code isn't possible ... maybe there should be assert + //this code isn't possible ... maybe there should be ASSERT sLog.outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId ); return; } diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index 3b1a28aab..e0df5ea6d 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -136,7 +136,7 @@ uint32 Bag::GetFreeSlots() const void Bag::RemoveItem( uint8 slot, bool /*update*/ ) { - assert(slot < MAX_BAG_SIZE); + ASSERT(slot < MAX_BAG_SIZE); if (m_bagslot[slot]) m_bagslot[slot]->SetContainer(NULL); @@ -147,7 +147,7 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ ) void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ ) { - assert(slot < MAX_BAG_SIZE); + ASSERT(slot < MAX_BAG_SIZE); if( pItem ) { diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 3ddc3a965..84c94b868 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -210,7 +210,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) void BattleGroundAV::UpdateScore(BattleGroundTeamId team, int32 points ) { // note: to remove reinforcements points must be negative, for adding reinforcements points must be positive - assert( team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE); + ASSERT( team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE); m_TeamScores[team] += points; // m_TeamScores is int32 - so no problems here if (points < 0) @@ -449,7 +449,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team) // TODO implement quest 7122 // mine=0 northmine, mine=1 southmine // TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them - assert(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE); + ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE); if (m_Mine_Owner[mine] == int8(team)) return; @@ -533,7 +533,7 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node) { - assert(GetStatus() == STATUS_IN_PROGRESS); + ASSERT(GetStatus() == STATUS_IN_PROGRESS); uint32 team = GetTeamIndexByTeamId(player->GetTeam()); @@ -543,7 +543,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node) { // until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function // for neutral nodes.. but doing this just for snowfall will be a bit to much i think - assert(node == BG_AV_NODES_SNOWFALL_GRAVE); // currently the only neutral grave + ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); // currently the only neutral grave EventPlayerAssaultsPoint(player, node); return; } @@ -651,9 +651,9 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node) void BattleGroundAV::SendMineWorldStates(uint32 mine) { - assert(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE); - assert(m_Mine_PrevOwner[mine] == BG_TEAM_ALLIANCE || m_Mine_PrevOwner[mine] == BG_TEAM_HORDE || m_Mine_PrevOwner[mine] == BG_AV_NEUTRAL_TEAM); - assert(m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE || m_Mine_Owner[mine] == BG_AV_NEUTRAL_TEAM); + ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE); + ASSERT(m_Mine_PrevOwner[mine] == BG_TEAM_ALLIANCE || m_Mine_PrevOwner[mine] == BG_TEAM_HORDE || m_Mine_PrevOwner[mine] == BG_AV_NEUTRAL_TEAM); + ASSERT(m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE || m_Mine_Owner[mine] == BG_AV_NEUTRAL_TEAM); UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], 1); if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine]) @@ -717,11 +717,11 @@ uint32 BattleGroundAV::GetNodeName(BG_AV_Nodes node) void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint32 team) { - assert(team < 3); // alliance:0, horde:1, neutral:2 - assert(m_Nodes[node].TotalOwner != team); - assert(m_Nodes[node].Owner != team); + ASSERT(team < 3); // alliance:0, horde:1, neutral:2 + ASSERT(m_Nodes[node].TotalOwner != team); + ASSERT(m_Nodes[node].Owner != team); // only assault an assaulted node if no totalowner exists: - assert(m_Nodes[node].State != POINT_ASSAULTED || m_Nodes[node].TotalOwner == BG_AV_NEUTRAL_TEAM); + ASSERT(m_Nodes[node].State != POINT_ASSAULTED || m_Nodes[node].TotalOwner == BG_AV_NEUTRAL_TEAM); // the timer gets another time, if the previous owner was 0 == Neutral m_Nodes[node].Timer = (m_Nodes[node].PrevOwner != BG_AV_NEUTRAL_TEAM) ? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP; m_Nodes[node].PrevOwner = m_Nodes[node].Owner; @@ -732,7 +732,7 @@ void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint32 team) void BattleGroundAV::DestroyNode(BG_AV_Nodes node) { - assert(m_Nodes[node].State == POINT_ASSAULTED); + ASSERT(m_Nodes[node].State == POINT_ASSAULTED); m_Nodes[node].TotalOwner = m_Nodes[node].Owner; m_Nodes[node].PrevOwner = m_Nodes[node].Owner; @@ -743,7 +743,7 @@ void BattleGroundAV::DestroyNode(BG_AV_Nodes node) void BattleGroundAV::InitNode(BG_AV_Nodes node, uint32 team, bool tower) { - assert(team < 3); // alliance:0, horde:1, neutral:2 + ASSERT(team < 3); // alliance:0, horde:1, neutral:2 m_Nodes[node].TotalOwner = team; m_Nodes[node].Owner = team; m_Nodes[node].PrevOwner = team; @@ -759,10 +759,10 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, uint32 team, bool tower) void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint32 team) { - assert(team < 3); // alliance:0, horde:1, neutral:2 - assert(m_Nodes[node].TotalOwner == team); - assert(m_Nodes[node].Owner != team); - assert(m_Nodes[node].State != POINT_CONTROLLED); + ASSERT(team < 3); // alliance:0, horde:1, neutral:2 + ASSERT(m_Nodes[node].TotalOwner == team); + ASSERT(m_Nodes[node].Owner != team); + ASSERT(m_Nodes[node].State != POINT_CONTROLLED); m_Nodes[node].PrevOwner = m_Nodes[node].Owner; m_Nodes[node].Owner = team; m_Nodes[node].PrevState = m_Nodes[node].State; diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h index 2c8048d96..2ab34c63f 100644 --- a/src/game/CellImpl.h +++ b/src/game/CellImpl.h @@ -108,7 +108,7 @@ Cell::Visit(const CellPair &standing_cell, TypeContainerVisitor &v } default: { - assert( false ); + ASSERT( false ); break; } } diff --git a/src/game/ConfusedMovementGenerator.cpp b/src/game/ConfusedMovementGenerator.cpp index b44740640..4cf7bf2ce 100644 --- a/src/game/ConfusedMovementGenerator.cpp +++ b/src/game/ConfusedMovementGenerator.cpp @@ -140,7 +140,7 @@ bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) { // start moving unit.addUnitState(UNIT_STAT_CONFUSED_MOVE); - assert( i_nextMove <= MAX_CONF_WAYPOINTS ); + ASSERT( i_nextMove <= MAX_CONF_WAYPOINTS ); const float x = i_waypoints[i_nextMove][0]; const float y = i_waypoints[i_nextMove][1]; const float z = i_waypoints[i_nextMove][2]; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index d827eb094..e04ca300a 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -101,7 +101,7 @@ bool Corpse::Create( uint32 guidlow, Player *owner) void Corpse::SaveToDB() { // bones should not be saved to DB (would be deleted on startup anyway) - assert(GetType() != CORPSE_BONES); + ASSERT(GetType() != CORPSE_BONES); // prevent DB data inconsistence problems and duplicates CharacterDatabase.BeginTransaction(); @@ -126,7 +126,7 @@ void Corpse::SaveToDB() void Corpse::DeleteBonesFromWorld() { - assert(GetType() == CORPSE_BONES); + ASSERT(GetType() == CORPSE_BONES); Corpse* corpse = GetMap()->GetCorpse(GetGUID()); if (!corpse) @@ -141,7 +141,7 @@ void Corpse::DeleteBonesFromWorld() void Corpse::DeleteFromDB() { // bones should not be saved to DB (would be deleted on startup anyway) - assert(GetType() != CORPSE_BONES); + ASSERT(GetType() != CORPSE_BONES); // all corpses (not bones) CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID())); diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp index 424900606..1a0282322 100644 --- a/src/game/CreatureAISelector.cpp +++ b/src/game/CreatureAISelector.cpp @@ -69,7 +69,7 @@ namespace FactorySelector { const CreatureAICreator *factory = iter->second; const SelectableAI *p = dynamic_cast(factory); - assert( p != NULL ); + ASSERT( p != NULL ); int val = p->Permit(creature); if( val > best_val ) { @@ -89,7 +89,7 @@ namespace FactorySelector MovementGenerator* selectMovementGenerator(Creature *creature) { MovementGeneratorRegistry &mv_registry(MovementGeneratorRepository::Instance()); - assert( creature->GetCreatureInfo() != NULL ); + ASSERT( creature->GetCreatureInfo() != NULL ); const MovementGeneratorCreator *mv_factory = mv_registry.GetRegistryItem( creature->GetDefaultMovementType()); /* if( mv_factory == NULL ) @@ -101,7 +101,7 @@ namespace FactorySelector { const MovementGeneratorCreator *factory = mv_registry.GetRegistryItem((*iter).c_str()); const SelectableMovement *p = dynamic_cast(factory); - assert( p != NULL ); + ASSERT( p != NULL ); int val = p->Permit(creature); if( val > best_val ) { diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 0a8d0ee39..51feb835f 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -233,7 +233,7 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& f { sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize); - // assert must fail after function call + // ASSERT must fail after function call return false; } @@ -251,7 +251,7 @@ template inline void LoadDBC(LocalData& localeData,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename) { // compatibility format and C++ structure sizes - assert(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); + ASSERT(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFileLoader::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); std::string dbc_filename = dbc_path + filename; if(storage.Load(dbc_filename.c_str())) @@ -429,7 +429,7 @@ void LoadDBCStores(const std::string& dataPath) for(uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS) - assert(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data"); + ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatDistributionStore, dbcPath,"ScalingStatDistribution.dbc"); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 289ea07cb..561afd941 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -157,7 +157,7 @@ InstanceSave::InstanceSave(uint16 MapId, uint32 InstanceId, Difficulty difficult InstanceSave::~InstanceSave() { // the players and groups must be unbound before deleting the save - assert(m_playerList.empty() && m_groupList.empty()); + ASSERT(m_playerList.empty() && m_groupList.empty()); } /* @@ -171,7 +171,7 @@ void InstanceSave::SaveToDB() Map *map = sMapMgr.FindMap(GetMapId(),m_instanceid); if(map) { - assert(map->IsDungeon()); + ASSERT(map->IsDungeon()); InstanceData *iData = ((InstanceMap *)map)->GetInstanceData(); if(iData && iData->Save()) { @@ -225,7 +225,7 @@ bool InstanceSave::UnloadIfEmpty() void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...) { Tokens fieldTokens = StrSplit(fields, ", "); - assert(fieldTokens.size() != 0); + ASSERT(fieldTokens.size() != 0); va_list ap; char szQueryTail [MAX_QUERY_LEN]; diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 1c967ff89..16398af4c 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -159,7 +159,7 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto) if(!eff->item_count) //all items of a set were removed { - assert(eff == player->ItemSetEff[setindex]); + ASSERT(eff == player->ItemSetEff[setindex]); delete eff; player->ItemSetEff[setindex] = NULL; } @@ -268,7 +268,7 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner) SetSpellCharges(i,itemProto->Spells[i].SpellCharges); SetUInt32Value(ITEM_FIELD_FLAGS, itemProto->Flags); - SetUInt32Value(ITEM_FIELD_DURATION, abs(itemProto->Duration)); + SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration); return true; } @@ -403,20 +403,20 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) } // update duration if need, and remove if not need - if((proto->Duration==0) != (GetUInt32Value(ITEM_FIELD_DURATION)==0)) + if ((proto->Duration == 0) != (GetUInt32Value(ITEM_FIELD_DURATION) == 0)) { - SetUInt32Value(ITEM_FIELD_DURATION,abs(proto->Duration)); + SetUInt32Value(ITEM_FIELD_DURATION, proto->Duration); need_save = true; } // set correct owner - if(owner_guid != 0 && GetOwnerGUID() != owner_guid) + if (owner_guid != 0 && GetOwnerGUID() != owner_guid) { SetOwnerGUID(owner_guid); need_save = true; } - if(need_save) // normal item changed state set not work at loading + if (need_save) // normal item changed state set not work at loading { std::ostringstream ss; ss << "UPDATE item_instance SET data = '"; @@ -946,7 +946,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player ) if ( count > pProto->GetMaxStackSize()) count = pProto->GetMaxStackSize(); - assert(count !=0 && "pProto->Stackable==0 but checked at loading already"); + ASSERT(count !=0 && "pProto->Stackable==0 but checked at loading already"); Item *pItem = NewItemOrBag( pProto ); if( pItem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_ITEM), item, player) ) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 19b2c13cc..ee099ee8b 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -418,7 +418,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) data << pProto->GemProperties; data << pProto->RequiredDisenchantSkill; data << pProto->ArmorDamageModifier; - data << abs(pProto->Duration); // added in 2.4.2.8209, duration (seconds) + data << pProto->Duration; // added in 2.4.2.8209, duration (seconds) data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory data << pProto->HolidayId; // Holiday.dbc? SendPacket( &data ); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 0c74dcba1..380c0f25f 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -470,6 +470,14 @@ inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemS return 0; } +enum ItemExtraFlags +{ + ITEM_EXTRA_NON_CONSUMABLE = 0x01, // use as additional flag to spellcharges_N negative values, item not expire at no chanrges + ITEM_EXTRA_REAL_TIME_DURATION = 0x02, // if set and have Duration time, then offline time included in counting, if not set then counted only in game time + + ITEM_EXTRA_ALL // all used flags, used for check DB data +}; + // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform #if defined( __GNUC__ ) #pragma pack(1) @@ -579,7 +587,7 @@ struct ItemPrototype uint32 GemProperties; // id from GemProperties.dbc uint32 RequiredDisenchantSkill; float ArmorDamageModifier; - int32 Duration; // negative = realtime, positive = ingame time + uint32 Duration; // negative = realtime, positive = ingame time uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc uint32 HolidayId; // id from Holidays.dbc uint32 ScriptId; @@ -587,7 +595,7 @@ struct ItemPrototype uint32 FoodType; uint32 MinMoneyLoot; uint32 MaxMoneyLoot; - uint32 NonConsumable; + uint32 ExtraFlags; // see ItemExtraFlags // helpers bool CanChangeEquipStateInCombat() const diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 5c2b74c27..d682a9bb9 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -406,7 +406,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert(grid != NULL); + ASSERT(grid != NULL); if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) ) { ObjectGridLoader loader(*grid, this, cell); @@ -455,7 +455,7 @@ template void Map::Add(T *obj) { - assert(obj); + ASSERT(obj); CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) @@ -473,7 +473,7 @@ Map::Add(T *obj) EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert( grid != NULL ); + ASSERT( grid != NULL ); AddToGrid(obj,grid,cell); obj->AddToWorld(); @@ -706,7 +706,7 @@ void Map::Update(const uint32 &t_diff) NGridType *grid = i->getSource(); GridInfo *info = i->getSource()->getGridInfoRef(); ++i; // The update might delete the map and we need the next map before the iterator gets invalid - assert(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE); + ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE); si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, grid->getX(), grid->getY(), t_diff); } } @@ -753,7 +753,7 @@ void Map::Remove(Player *player, bool remove) DEBUG_LOG("Remove player %s from grid[%u,%u]", player->GetName(), cell.GridX(), cell.GridY()); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert(grid != NULL); + ASSERT(grid != NULL); RemoveFromGrid(player,grid,cell); @@ -818,7 +818,7 @@ Map::Remove(T *obj, bool remove) DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); - assert( grid != NULL ); + ASSERT( grid != NULL ); if(obj->isActiveObject()) RemoveFromActive(obj); @@ -845,7 +845,7 @@ Map::Remove(T *obj, bool remove) void Map::PlayerRelocation(Player *player, float x, float y, float z, float orientation) { - assert(player); + ASSERT(player); CellPair old_val = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); CellPair new_val = MaNGOS::ComputeCellPair(x, y); @@ -888,7 +888,7 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati void Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang) { - assert(CheckGridIntegrity(creature,false)); + ASSERT(CheckGridIntegrity(creature,false)); Cell old_cell = creature->GetCurrentCell(); @@ -933,7 +933,7 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang creature->SetNeedNotify(); } - assert(CheckGridIntegrity(creature,true)); + ASSERT(CheckGridIntegrity(creature,true)); } bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) @@ -1039,7 +1039,7 @@ bool Map::CreatureRespawnRelocation(Creature *c) bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce) { NGridType *grid = getNGrid(x, y); - assert( grid != NULL); + ASSERT( grid != NULL); { if(!pForce && ActiveObjectsNearGrid(x, y) ) @@ -1114,7 +1114,7 @@ uint32 Map::GetMaxPlayers() const return normalDiff ? normalDiff->maxPlayers : 0; } } - else // I'd rather assert(false); + else // I'd rather ASSERT(false); return 0; } @@ -2185,14 +2185,14 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y) if(x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS) { sLog.outError("map::setNGrid() Invalid grid coordinates found: %d, %d!",x,y); - assert(false); + ASSERT(false); } i_grids[x][y] = grid; } void Map::AddObjectToRemoveList(WorldObject *obj) { - assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId()); + ASSERT(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId()); obj->CleanupsBeforeDelete(); // remove or simplify at least cross referenced links @@ -2385,7 +2385,7 @@ bool InstanceMap::CanEnter(Player *player) if(player->GetMapRef().getTarget() == this) { sLog.outError("InstanceMap::CanEnter - player %s(%u) already in map %d,%d,%d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); - assert(false); + ASSERT(false); return false; } @@ -2442,7 +2442,7 @@ bool InstanceMap::Add(Player *player) if(playerBind->save != mapSave) { sLog.outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d,%d,%d,%d,%d,%d but he is being put in instance %d,%d,%d,%d,%d,%d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); - assert(false); + ASSERT(false); } } else @@ -2456,7 +2456,7 @@ bool InstanceMap::Add(Player *player) { sLog.outError("InstanceMap::Add: player %s(%d) is being put in instance %d,%d,%d,%d,%d,%d but he is in group %d and is bound to instance %d,%d,%d,%d,%d,%d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(pGroup->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if(groupBind) sLog.outError("InstanceMap::Add: the group is bound to instance %d,%d,%d,%d,%d,%d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); - assert(false); + ASSERT(false); } // bind to the group or keep using the group save if(!groupBind) @@ -2475,7 +2475,7 @@ bool InstanceMap::Add(Player *player) sLog.outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); else sLog.outError("GroupBind save NULL"); - assert(false); + ASSERT(false); } // if the group/leader is permanently bound to the instance // players also become permanently bound when they enter @@ -2495,7 +2495,7 @@ bool InstanceMap::Add(Player *player) player->BindToInstance(mapSave, false); else // cannot jump to a different instance without resetting it - assert(playerBind->save == mapSave); + ASSERT(playerBind->save == mapSave); } } } @@ -2720,7 +2720,7 @@ bool BattleGroundMap::CanEnter(Player * player) if(player->GetMapRef().getTarget() == this) { sLog.outError("BGMap::CanEnter - player %u already in map!", player->GetGUIDLow()); - assert(false); + ASSERT(false); return false; } diff --git a/src/game/Map.h b/src/game/Map.h index b22cad16f..30d34dd0b 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -321,7 +321,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj bool CreatureRespawnRelocation(Creature *c); // used only in CreatureRelocation and ObjectGridUnloader - // assert print helper + // ASSERT print helper bool CheckGridIntegrity(Creature* c, bool moved) const; uint32 GetInstanceId() const { return i_InstanceId; } diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 7e59bfd36..19e74eabd 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -170,12 +170,12 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, if (!sMapStore.LookupEntry(GetId())) { sLog.outError("CreateInstance: no entry for map %d", GetId()); - assert(false); + ASSERT(false); } if (!ObjectMgr::GetInstanceTemplate(GetId())) { sLog.outError("CreateInstance: no instance template for map %d", GetId()); - assert(false); + ASSERT(false); } // some instances only have one difficulty diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 261d7a05b..3240a05b7 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -99,7 +99,7 @@ void MapManager::checkAndCorrectGridStatesArray() if(!ok) ++i_GridStateErrorCount; if(i_GridStateErrorCount > 2) - assert(false); // force a crash. Too many errors + ASSERT(false); // force a crash. Too many errors } Map* @@ -123,7 +123,7 @@ MapManager::_createBaseMap(uint32 id) i_maps[id] = m; } - assert(m != NULL); + ASSERT(m != NULL); return m; } diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 7b9c6af92..ce1008cb3 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -65,7 +65,7 @@ MotionMaster::UpdateMotion(uint32 diff) { if( i_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE) ) return; - assert( !empty() ); + ASSERT( !empty() ); m_cleanFlag |= MMCF_UPDATE; if (!top()->Update(*i_owner, diff)) { @@ -112,7 +112,7 @@ MotionMaster::DirectClean(bool reset, bool all) if (!all && reset) { - assert( !empty() ); + ASSERT( !empty() ); top()->Reset(*i_owner); } } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index ca7ed8b60..99571da6d 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1047,7 +1047,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const { sLog.outError("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u",(set ? "set value to" : "get value from"),index,m_valuesCount,GetTypeId(),m_objectType); - // assert must fail after function call + // ASSERT must fail after function call return false; } @@ -1058,7 +1058,7 @@ void Object::BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_play if (iter == update_players.end()) { std::pair p = update_players.insert( UpdateDataMapType::value_type(pl, UpdateData()) ); - assert(p.second); + ASSERT(p.second); iter = p.first; } diff --git a/src/game/Object.h b/src/game/Object.h index 3b805df93..e95ced556 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -314,7 +314,7 @@ class MANGOS_DLL_SPEC Object PackedGuid m_PackGUID; - // for output helpfull error messages from asserts + // for output helpfull error messages from ASSERTs bool PrintIndexError(uint32 index, bool set) const; Object(const Object&); // prevent generation copy constructor Object& operator=(Object const&); // prevent generation assigment operator diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index d2330fc78..5aa316b68 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -129,7 +129,7 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid.GetRawValue()); if( iter == i_player2corpse.end() ) return NULL; - assert(iter->second->GetType() != CORPSE_BONES); + ASSERT(iter->second->GetType() != CORPSE_BONES); return iter->second; } @@ -137,7 +137,7 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid) void ObjectAccessor::RemoveCorpse(Corpse *corpse) { - assert(corpse && corpse->GetType() != CORPSE_BONES); + ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); @@ -157,10 +157,10 @@ ObjectAccessor::RemoveCorpse(Corpse *corpse) void ObjectAccessor::AddCorpse(Corpse *corpse) { - assert(corpse && corpse->GetType() != CORPSE_BONES); + ASSERT(corpse && corpse->GetType() != CORPSE_BONES); Guard guard(i_corpseGuard); - assert(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); + ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); i_player2corpse[corpse->GetOwnerGUID()] = corpse; // build mapid*cellid -> guid_set map diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index 9935ce23c..d42c7d4db 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -56,7 +56,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) Creature * c = iter->getSource(); - assert((!c->isPet() || !c->isVehicle()) && "ObjectGridRespawnMover don't must be called for pets"); + ASSERT((!c->isPet() || !c->isVehicle()) && "ObjectGridRespawnMover don't must be called for pets"); Cell const& cur_cell = c->GetCurrentCell(); diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b3fe062b8..02c8a1922 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -2072,28 +2072,37 @@ void ObjectMgr::LoadItemPrototypes() const_cast(proto)->HolidayId = 0; } - if(proto->NonConsumable) + if(proto->ExtraFlags) { - if (proto->NonConsumable > 1) - { - sLog.outErrorDb("Item (Entry: %u) has wrong NonConsumable (%u), must be 0..1",i,proto->NonConsumable); - const_cast(proto)->NonConsumable = 1; - } + if (proto->ExtraFlags & ~ITEM_EXTRA_ALL) + sLog.outErrorDb("Item (Entry: %u) has wrong ExtraFlags (%u) with unused bits set",i,proto->ExtraFlags); - bool can_be_need = false; - for (int j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j) + if (proto->ExtraFlags & ITEM_EXTRA_NON_CONSUMABLE) { - if(proto->Spells[j].SpellCharges < 0) + bool can_be_need = false; + for (int j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j) { - can_be_need = true; - break; + if(proto->Spells[j].SpellCharges < 0) + { + can_be_need = true; + break; + } + } + + if (!can_be_need) + { + sLog.outErrorDb("Item (Entry: %u) has redundant non-consumable flag in ExtraFlags, item not have negative charges", i); + const_cast(proto)->ExtraFlags &= ~ITEM_EXTRA_NON_CONSUMABLE; } } - if (!can_be_need) + if (proto->ExtraFlags & ITEM_EXTRA_REAL_TIME_DURATION) { - sLog.outErrorDb("Item (Entry: %u) has redundant NonConsumable (%u), item not have negative charges",i,proto->NonConsumable); - const_cast(proto)->NonConsumable = 0; + if (proto->Duration == 0) + { + sLog.outErrorDb("Item (Entry: %u) has redundant real-time duration flag in ExtraFlags, item not have duration", i); + const_cast(proto)->ExtraFlags &= ~ITEM_EXTRA_REAL_TIME_DURATION; + } } } } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 988102005..c9d0551a1 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -492,7 +492,7 @@ void Pet::Update(uint32 diff) { if( m_deathTimer <= diff ) { - assert(getPetType()!=SUMMON_PET && "Must be already removed."); + ASSERT(getPetType()!=SUMMON_PET && "Must be already removed."); Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER! return; } @@ -797,7 +797,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) { CreatureInfo const *cinfo = GetCreatureInfo(); - assert(cinfo); + ASSERT(cinfo); if(!owner) { diff --git a/src/game/Pet.h b/src/game/Pet.h index 2e35117cf..fdad92cef 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -260,11 +260,11 @@ class Pet : public Creature void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called { - assert(false); + ASSERT(false); } void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called { - assert(false); + ASSERT(false); } }; #endif diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 0c6079be5..d6bde1121 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -4178,7 +4178,7 @@ void Player::BuildPlayerRepop() if(GetCorpse()) { sLog.outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow()); - assert(false); + ASSERT(false); } // create a corpse and place it at the player's location @@ -4372,7 +4372,7 @@ void Player::CreateCorpse() // we don't SaveToDB for players in battlegrounds so don't do it for corpses either const MapEntry *entry = sMapStore.LookupEntry(corpse->GetMapId()); - assert(entry); + ASSERT(entry); if(entry->map_type != MAP_BATTLEGROUND) corpse->SaveToDB(); @@ -8285,7 +8285,7 @@ void Player::SendPetSkillWipeConfirm() void Player::SetVirtualItemSlot( uint8 i, Item* item) { - assert(i < 3); + ASSERT(i < 3); if(i < 2 && item) { if(!item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT)) @@ -11893,7 +11893,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) Item* item = *itr; ++itr; // current element can be erased in UpdateDuration - if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly) + if ((realtimeonly && (item->GetProto()->ExtraFlags & ITEM_EXTRA_REAL_TIME_DURATION)) || !realtimeonly) item->UpdateDuration(this,time); } } @@ -11902,7 +11902,7 @@ void Player::UpdateEnchantTime(uint32 time) { for(EnchantDurationList::iterator itr = m_enchantDuration.begin(),next;itr != m_enchantDuration.end();itr=next) { - assert(itr->item); + ASSERT(itr->item); next = itr; if (!itr->item->GetEnchantmentId(itr->slot)) { @@ -13176,7 +13176,7 @@ void Player::SendPetTameFailure(PetTameFailureReason reason) void Player::AddQuest( Quest const *pQuest, Object *questGiver ) { uint16 log_slot = FindQuestSlot( 0 ); - assert(log_slot < MAX_QUEST_LOG_SIZE); + ASSERT(log_slot < MAX_QUEST_LOG_SIZE); uint32 quest_id = pQuest->GetQuestId(); @@ -13565,7 +13565,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 for(; iter2 != end; ++iter2) { @@ -13600,7 +13600,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = sObjectMgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); - assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 + ASSERT(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 for(; iter2 != end; ++iter2) { @@ -13703,7 +13703,7 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) ObjectMgr::ExclusiveQuestGroups::const_iterator iter = sObjectMgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::const_iterator end = sObjectMgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup()); - assert(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0 + ASSERT(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0 for(; iter != end; ++iter) { @@ -14513,7 +14513,7 @@ void Player::SendQuestUpdateAddItem( Quest const* /*pQuest*/, uint32 /*item_idx* void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, ObjectGuid guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ) { - assert(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); + ASSERT(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); int32 entry = pQuest->ReqCreatureOrGOId[ creatureOrGO_idx ]; if (entry < 0) @@ -15176,7 +15176,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { // save source node as recall coord to prevent recall and fall from sky TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(node_id); - assert(nodeEntry); // checked in m_taxi.LoadTaxiDestinationsFromString + ASSERT(nodeEntry); // checked in m_taxi.LoadTaxiDestinationsFromString m_recallMap = nodeEntry->map_id; m_recallX = nodeEntry->x; m_recallY = nodeEntry->y; @@ -16139,7 +16139,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player bool has_solo = false; if(player) { player_guid = player->GetGUID(); if(!group) group = player->GetGroup(); } - assert(player_guid); + ASSERT(player_guid); // copy all binds to the group, when changing leader it's assumed the character // will not have any solo binds @@ -16230,7 +16230,7 @@ bool Player::_LoadHomeBind(QueryResult *result) void Player::SaveToDB() { - // we should assure this: assert((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE))); + // we should assure this: ASSERT((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE))); // delay auto save at any saves (manual, in code, or autosave) m_nextSave = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE); @@ -18944,7 +18944,7 @@ void Player::SetGroup(Group *group, int8 subgroup) else { // never use SetGroup without a subgroup unless you specify NULL for group - assert(subgroup >= 0); + ASSERT(subgroup >= 0); m_group.link(group, this); m_group.setSubGroup((uint8)subgroup); } @@ -20111,7 +20111,7 @@ void Player::SetOriginalGroup(Group *group, int8 subgroup) else { // never use SetOriginalGroup without a subgroup unless you specify NULL for group - assert(subgroup >= 0); + ASSERT(subgroup >= 0); m_originalGroup.link(group, this); m_originalGroup.setSubGroup((uint8)subgroup); } diff --git a/src/game/Player.h b/src/game/Player.h index 96ccc60a9..39c7306b9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -368,7 +368,7 @@ struct Runes struct EnchantDuration { EnchantDuration() : item(NULL), slot(MAX_ENCHANTMENT_SLOT), leftduration(0) {}; - EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { assert(item); }; + EnchantDuration(Item * _item, EnchantmentSlot _slot, uint32 _leftduration) : item(_item), slot(_slot), leftduration(_leftduration) { ASSERT(item); }; Item * item; EnchantmentSlot slot; @@ -1513,7 +1513,7 @@ class MANGOS_DLL_SPEC Player : public Unit void AddMItem(Item* it) { ASSERT( it ); - //assert deleted, because items can be added before loading + //ASSERT deleted, because items can be added before loading mMitems[it->GetGUIDLow()] = it; } diff --git a/src/game/PoolManager.cpp b/src/game/PoolManager.cpp index 1efbdf2a9..d94381d13 100644 --- a/src/game/PoolManager.cpp +++ b/src/game/PoolManager.cpp @@ -276,8 +276,8 @@ void PoolGroup::SpawnObject(SpawnedPoolData& spawns, uint32 limit, uint32 tri if (obj->guid == triggerFrom) { - assert(spawns.IsSpawnedObject(obj->guid)); - assert(spawns.GetSpawnedObjects(poolId) > 0); + ASSERT(spawns.IsSpawnedObject(obj->guid)); + ASSERT(spawns.GetSpawnedObjects(poolId) > 0); ReSpawn1Object(obj); triggerFrom = 0; continue; diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 5cdcdd62d..d0d7c2fe9 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -195,7 +195,7 @@ void ReputationMgr::SendVisible(FactionState const* faction) const m_player->SendDirectMessage(&data); } -void ReputationMgr::Initilize() +void ReputationMgr::Initialize() { m_factions.clear(); m_visibleFactionCount = 0; @@ -386,7 +386,7 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive) void ReputationMgr::LoadFromDB(QueryResult *result) { // Set initial reputations (so everything is nifty before DB data load) - Initilize(); + Initialize(); //QueryResult *result = CharacterDatabase.PQuery("SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'",GetGUIDLow()); diff --git a/src/game/ReputationMgr.h b/src/game/ReputationMgr.h index f3c9705d5..37d43126f 100644 --- a/src/game/ReputationMgr.h +++ b/src/game/ReputationMgr.h @@ -124,7 +124,7 @@ class ReputationMgr void SendStates() const; private: // internal helper functions - void Initilize(); + void Initialize(); uint32 GetDefaultStateFlags(const FactionEntry *factionEntry) const; bool SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); bool SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b922a28e5..655e7ba52 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3650,7 +3650,7 @@ void Spell::TakeCastItem() // item has limited charges if (proto->Spells[i].SpellCharges) { - if (proto->Spells[i].SpellCharges < 0 && !proto->NonConsumable) + if (proto->Spells[i].SpellCharges < 0 && !(proto->ExtraFlags & ITEM_EXTRA_NON_CONSUMABLE)) expendable = true; int32 charges = m_CastItem->GetSpellCharges(i); @@ -5557,7 +5557,7 @@ SpellCastResult Spell::CheckItems() { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); - if (proto->Spells[s].SpellCharges < 0 && !proto->NonConsumable && abs(charges) < 2) + if (proto->Spells[s].SpellCharges < 0 && !(proto->ExtraFlags & ITEM_EXTRA_NON_CONSUMABLE) && abs(charges) < 2) { ++itemcount; break; diff --git a/src/game/Spell.h b/src/game/Spell.h index f81692eb3..d3edfabe6 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -695,7 +695,7 @@ namespace MaNGOS template inline void Visit(GridRefManager &m) { - assert(i_data); + ASSERT(i_data); if(!i_originalCaster) return; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 56ba367ff..feabf4a5c 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -378,9 +378,9 @@ m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false), m_isRemovedOnShapeLost(true), m_in_use(0), m_deleted(false) { - assert(target); + ASSERT(target); - assert(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element"); + ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element"); m_spellProto = spellproto; @@ -8190,7 +8190,7 @@ void Aura::UnregisterSingleCastAura() else { sLog.outError("Couldn't find the caster of the single target aura (SpellId %u), may crash later!", GetId()); - assert(false); + ASSERT(false); } m_isSingleTargetAura = false; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b93d33c2a..e6181b72c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6383,7 +6383,7 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc) m_caster->_AddTotem(TotemSlot(slot),pTotem); pTotem->SetOwner(m_caster->GetGUID()); - pTotem->SetTypeBySummonSpell(m_spellInfo); // must be after Create call where m_spells initilized + pTotem->SetTypeBySummonSpell(m_spellInfo); // must be after Create call where m_spells initialized int32 duration=GetSpellDuration(m_spellInfo); if (Player* modOwner = m_caster->GetSpellModOwner()) @@ -7497,7 +7497,7 @@ void Spell::EffectBind(SpellEffectIndex eff_idx) data.Initialize(SMSG_PLAYERBOUND, 8+4); data << uint64(player->GetGUID()); data << uint32(area_id); - player->SendMessageToSet( &data, true ); + player->SendDirectMessage( &data ); } void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx ) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index e8ebf6ba3..5e5d64aec 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2554,7 +2554,7 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr void SpellMgr::LoadPetDefaultSpells() { - assert(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS); + ASSERT(MAX_CREATURE_SPELL_DATA_SLOT==CREATURE_MAX_SPELLS); mPetDefaultSpellsMap.clear(); diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 389d691a5..3f506fe46 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -291,7 +291,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile currentRef = (*iter); Unit* target = currentRef->getTarget(); - assert(target); // if the ref has status online the target must be there ! + ASSERT(target); // if the ref has status online the target must be there ! // some units are prefered in comparison to others if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE)) ) @@ -388,7 +388,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho if(!pVictim->isAlive() || !getOwner()->isAlive() ) return; - assert(getOwner()->GetTypeId()== TYPEID_UNIT); + ASSERT(getOwner()->GetTypeId()== TYPEID_UNIT); float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, crit, schoolMask, pThreatSpell); diff --git a/src/game/Traveller.h b/src/game/Traveller.h index ea0d7ca17..dd5fad5a0 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -48,7 +48,7 @@ struct MANGOS_DLL_DECL Traveller float GetPositionZ() const { return i_traveller.GetPositionZ(); } T& GetTraveller(void) { return i_traveller; } - float Speed(void) { assert(false); return 0.0f; } + float Speed(void) { ASSERT(false); return 0.0f; } float GetMoveDestinationTo(float x, float y, float z); uint32 GetTotalTrevelTimeTo(float x, float y, float z); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index aa104e097..7231b61b4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -269,9 +269,9 @@ Unit::~Unit() delete m_charmInfo; // those should be already removed at "RemoveFromWorld()" call - assert(m_gameObj.size() == 0); - assert(m_dynObjGUIDs.size() == 0); - assert(m_deletedAuras.size() == 0); + ASSERT(m_gameObj.size() == 0); + ASSERT(m_dynObjGUIDs.size() == 0); + ASSERT(m_deletedAuras.size() == 0); } void Unit::Update( uint32 p_time ) @@ -466,7 +466,7 @@ void Unit::resetAttackTimer(WeaponAttackType type) bool Unit::canReachWithAttack(Unit *pVictim) const { - assert(pVictim); + ASSERT(pVictim); float reach = GetFloatValue(UNIT_FIELD_COMBATREACH); if( reach <= 0.0f ) reach = 1.0f; @@ -860,10 +860,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // last damage from non duel opponent or opponent controlled creature if(duel_hasEnded) { - assert(pVictim->GetTypeId()==TYPEID_PLAYER); + ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER); Player *he = (Player*)pVictim; - assert(he->duel); + ASSERT(he->duel); he->duel->opponent->CombatStopWithPets(true); he->CombatStopWithPets(true); @@ -1037,10 +1037,10 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // last damage from duel opponent if(duel_hasEnded) { - assert(pVictim->GetTypeId()==TYPEID_PLAYER); + ASSERT(pVictim->GetTypeId()==TYPEID_PLAYER); Player *he = (Player*)pVictim; - assert(he->duel); + ASSERT(he->duel); he->SetHealth(1); @@ -3346,7 +3346,7 @@ void Unit::_UpdateAutoRepeatSpell() void Unit::SetCurrentCastedSpell( Spell * pSpell ) { - assert(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells + ASSERT(pSpell); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer(); @@ -3417,7 +3417,7 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell ) void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool sendAutoRepeatCancelToClient) { - assert(spellType < CURRENT_MAX_SPELL); + ASSERT(spellType < CURRENT_MAX_SPELL); if (m_currentSpells[spellType] && (withDelayed || m_currentSpells[spellType]->getState() != SPELL_STATE_DELAYED) ) { @@ -4668,7 +4668,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const void Unit::AddGameObject(GameObject* gameObj) { - assert(gameObj && gameObj->GetOwnerGUID()==0); + ASSERT(gameObj && gameObj->GetOwnerGUID()==0); m_gameObj.push_back(gameObj); gameObj->SetOwnerGUID(GetGUID()); @@ -4684,7 +4684,7 @@ void Unit::AddGameObject(GameObject* gameObj) void Unit::RemoveGameObject(GameObject* gameObj, bool del) { - assert(gameObj && gameObj->GetOwnerGUID()==GetGUID()); + ASSERT(gameObj && gameObj->GetOwnerGUID()==GetGUID()); gameObj->SetOwnerGUID(0); @@ -11091,7 +11091,7 @@ void Unit::DeleteThreatList() void Unit::TauntApply(Unit* taunter) { - assert(GetTypeId()== TYPEID_UNIT); + ASSERT(GetTypeId()== TYPEID_UNIT); if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster())) return; @@ -11114,7 +11114,7 @@ void Unit::TauntApply(Unit* taunter) void Unit::TauntFadeOut(Unit *taunter) { - assert(GetTypeId()== TYPEID_UNIT); + ASSERT(GetTypeId()== TYPEID_UNIT); if(!taunter || (taunter->GetTypeId() == TYPEID_PLAYER && ((Player*)taunter)->isGameMaster())) return; @@ -11152,7 +11152,7 @@ bool Unit::SelectHostileTarget() //next-victim-selection algorithm and evade mode are called //threat list sorting etc. - assert(GetTypeId()== TYPEID_UNIT); + ASSERT(GetTypeId()== TYPEID_UNIT); if (!this->isAlive()) return false; diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h index 45d50f5e0..4233db67a 100644 --- a/src/game/Vehicle.h +++ b/src/game/Vehicle.h @@ -48,11 +48,11 @@ class Vehicle : public Creature private: void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called { - assert(false); + ASSERT(false); } void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called { - assert(false); + ASSERT(false); } }; #endif diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index b6e649ebe..40ec6b814 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -103,7 +103,7 @@ void WaypointManager::Load() WaypointPath &path = m_pathMap[id]; // the cleanup queries make sure the following is true - assert(point >= 1 && point <= path.size()); + ASSERT(point >= 1 && point <= path.size()); WaypointNode &node = path[point-1]; node.x = fields[0].GetFloat(); @@ -191,7 +191,7 @@ void WaypointManager::Cleanup() WorldDatabase.DirectExecute("UPDATE creature_movement AS T SET point = (SELECT COUNT(*) FROM temp WHERE id = T.id AND point <= T.point)"); WorldDatabase.DirectExecute("ALTER TABLE creature_movement ADD PRIMARY KEY (id, point)"); WorldDatabase.DirectExecute("DROP TABLE temp"); - assert(!(result = WorldDatabase.Query("SELECT 1 from creature_movement As T WHERE point <> (SELECT COUNT(*) FROM creature_movement WHERE id = T.id AND point <= T.point) LIMIT 1"))); + ASSERT(!(result = WorldDatabase.Query("SELECT 1 from creature_movement As T WHERE point <> (SELECT COUNT(*) FROM creature_movement WHERE id = T.id AND point <= T.point) LIMIT 1"))); } } diff --git a/src/game/World.cpp b/src/game/World.cpp index f2e2b2d87..99fe0ba53 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1244,7 +1244,7 @@ void World::SetInitialWorldSettings() mail_timer_expires = uint32( (DAY * IN_MILISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); sLog.outDebug("Mail timer set to: %u, mail return is called every %u minutes", mail_timer, mail_timer_expires); - ///- Initilize static helper structures + ///- Initialize static helper structures AIRegistry::Initialize(); Player::InitVisibleBits(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index cec523f42..7caa79a75 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9635" + #define REVISION_NR "9640" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 0180f132e..ab52b04fa 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_9635_01_characters_characters" - #define REVISION_DB_MANGOS "required_9622_01_mangos_gameobject" + #define REVISION_DB_MANGOS "required_9636_01_mangos_item_template" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #endif // __REVISION_SQL_H__