From d3fec0355cc782ab25d981b748dfc71f07bdc0fc Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 29 Aug 2009 16:40:50 +0400 Subject: [PATCH 1/8] [8434] Fxied typo in account data loading. Signed-off-by: VladimirMangos --- src/game/WorldSession.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 534cdef1e..a94981e0d 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -582,7 +582,7 @@ void WorldSession::LoadGlobalAccountData() void WorldSession::LoadAccountData(QueryResult* result, uint32 mask) { for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) - if(mask & (1 < i)) + if (mask & (1 << i)) m_accountData[i] = AccountData(); if(!result) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3f145e25c..e361e6317 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 "8433" + #define REVISION_NR "8434" #endif // __REVISION_NR_H__ From a33ba233c75ef4f46131eab38bbd49c7d1d0b5ec Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 29 Aug 2009 21:04:04 +0400 Subject: [PATCH 2/8] [8435] More work in repally passives at spelmod apply/remove. * Fixed infinity recursion at reapply spell mod aura by self triggering. * Reapply pet/totems passives. --- src/game/SpellAuras.cpp | 41 ++++++++++++++++++++++++++++++---------- src/game/SpellAuras.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 55b228730..4fe953a79 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1249,6 +1249,26 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const return false; } +void Aura::ReapplyAffectedPassiveAuras( Unit* target ) +{ + std::set affectedPassives; + + for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr) + // permanent passive + if (itr->second->IsPassive() && itr->second->IsPermanent() && + // non deleted and not same aura (any with same spell id) + !itr->second->IsDeleted() && itr->second->GetId() != GetId() && + // only applied by self and affected by aura + itr->second->GetCasterGUID() == target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto())) + affectedPassives.insert(itr->second->GetId()); + + for(std::set::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr) + { + target->RemoveAurasDueToSpell(*set_itr); + target->CastSpell(m_target, *set_itr, true); + } +} + /*********************************************************/ /*** BASIC AURA FUNCTION ***/ /*********************************************************/ @@ -1305,18 +1325,19 @@ void Aura::HandleAddModifier(bool apply, bool Real) ((Player*)m_target)->AddSpellMod(m_spellmod, apply); - // reaplly talents to own passive persistent auras - std::set affectedPassives; + // reapply talents to own passive persistent auras + ReapplyAffectedPassiveAuras(m_target); - for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().begin(); itr != m_target->GetAuras().end(); ++itr) - if (itr->second->IsPassive() && itr->second->IsPermanent() && - itr->second->GetCasterGUID() == m_target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto())) - affectedPassives.insert(itr->second->GetId()); - - for(std::set::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr) + // re-aplly talents and passives applied to pet (it affected by player spellmods) + if (m_target->GetTypeId() == TYPEID_PLAYER) { - m_target->RemoveAurasDueToSpell(*set_itr); - m_target->CastSpell(m_target, *set_itr, true); + if(Pet* pet = m_target->GetPet()) + ReapplyAffectedPassiveAuras(pet); + + for(int i = 0; i < MAX_TOTEM; ++i) + if(m_target->m_TotemSlot[i]) + if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i])) + ReapplyAffectedPassiveAuras(totem); } } void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index c84415440..fd230cebf 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -341,6 +341,7 @@ class MANGOS_DLL_SPEC Aura void PeriodicDummyTick(); bool IsCritFromAbilityAura(Unit* caster, uint32& damage); + void ReapplyAffectedPassiveAuras(Unit* target); Modifier m_modifier; SpellModifier *m_spellmod; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e361e6317..dd122e764 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 "8434" + #define REVISION_NR "8435" #endif // __REVISION_NR_H__ From a86abcf9775b310052babfc1d6435a137a7655de Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 29 Aug 2009 21:28:10 +0400 Subject: [PATCH 3/8] [8436] Return CMSG_SET_ACTIVE_VOICE_CHANNEL to STATUS_AUTHED. It sent not only just after logout but also just before login packet. --- src/game/Opcodes.cpp | 2 +- src/game/WorldSession.cpp | 6 +++++- src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 8ba1de0de..a79a5efad 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -1005,7 +1005,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3D0*/ { "CMSG_TARGET_CAST", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D1*/ { "CMSG_TARGET_SCRIPT_CAST", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D2*/ { "CMSG_CHANNEL_DISPLAY_LIST", STATUS_LOGGEDIN, &WorldSession::HandleChannelDisplayListQuery }, - /*0x3D3*/ { "CMSG_SET_ACTIVE_VOICE_CHANNEL", STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, &WorldSession::HandleSetActiveVoiceChannel }, + /*0x3D3*/ { "CMSG_SET_ACTIVE_VOICE_CHANNEL", STATUS_AUTHED, &WorldSession::HandleSetActiveVoiceChannel }, /*0x3D4*/ { "CMSG_GET_CHANNEL_MEMBER_COUNT", STATUS_LOGGEDIN, &WorldSession::HandleGetChannelMemberCount }, /*0x3D5*/ { "SMSG_CHANNEL_MEMBER_COUNT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3D6*/ { "CMSG_CHANNEL_VOICE_ON", STATUS_LOGGEDIN, &WorldSession::HandleChannelVoiceOnOpcode }, diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index a94981e0d..de93c1a79 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -234,7 +234,11 @@ bool WorldSession::Update(uint32 /*diff*/) break; } - m_playerRecentlyLogout = false; + // single from authed time opcodes send in to after logout time + // and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes. + if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL) + m_playerRecentlyLogout = false; + (this->*opHandle.handler)(*packet); if (sLog.IsOutDebug() && packet->rpos() < packet->wpos()) LogUnprocessedTail(packet); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dd122e764..7597af264 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 "8435" + #define REVISION_NR "8436" #endif // __REVISION_NR_H__ From a1d29f50a09626da0084c9a2535ac1941d61f75c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 29 Aug 2009 22:38:40 +0400 Subject: [PATCH 4/8] [8437] Remove redundent player typeid check. --- src/game/SpellAuras.cpp | 19 ++++++++++--------- src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4fe953a79..c281e0320 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1254,13 +1254,17 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target ) std::set affectedPassives; for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr) + { // permanent passive if (itr->second->IsPassive() && itr->second->IsPermanent() && // non deleted and not same aura (any with same spell id) !itr->second->IsDeleted() && itr->second->GetId() != GetId() && // only applied by self and affected by aura itr->second->GetCasterGUID() == target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto())) + { affectedPassives.insert(itr->second->GetId()); + } + } for(std::set::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr) { @@ -1329,16 +1333,13 @@ void Aura::HandleAddModifier(bool apply, bool Real) ReapplyAffectedPassiveAuras(m_target); // re-aplly talents and passives applied to pet (it affected by player spellmods) - if (m_target->GetTypeId() == TYPEID_PLAYER) - { - if(Pet* pet = m_target->GetPet()) - ReapplyAffectedPassiveAuras(pet); + if(Pet* pet = m_target->GetPet()) + ReapplyAffectedPassiveAuras(pet); - for(int i = 0; i < MAX_TOTEM; ++i) - if(m_target->m_TotemSlot[i]) - if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i])) - ReapplyAffectedPassiveAuras(totem); - } + for(int i = 0; i < MAX_TOTEM; ++i) + if(m_target->m_TotemSlot[i]) + if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i])) + ReapplyAffectedPassiveAuras(totem); } void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7597af264..83212e8d3 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 "8436" + #define REVISION_NR "8437" #endif // __REVISION_NR_H__ From 016dc29e5db0bafb885ac9f71e3833be748b65db Mon Sep 17 00:00:00 2001 From: Fog Date: Sat, 29 Aug 2009 23:30:41 +0400 Subject: [PATCH 5/8] [8438] Correctly update achievement at bank bag slot buy instead next login. Signed-off-by: VladimirMangos --- src/game/ItemHandler.cpp | 3 ++- src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index c5635225f..eccab500d 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -853,9 +853,10 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) if (_player->GetMoney() < price) return; - _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT, slot); _player->SetBankBagSlotCount(slot); _player->ModifyMoney(-int32(price)); + + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT); } void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 83212e8d3..f35a59933 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 "8437" + #define REVISION_NR "8438" #endif // __REVISION_NR_H__ From 4d413e4a87fad44eae20752ab983493b72a82605 Mon Sep 17 00:00:00 2001 From: win Date: Sat, 29 Aug 2009 23:36:08 +0400 Subject: [PATCH 6/8] [8439] Fixed counting loaded extra spell bonuses. Signed-off-by: VladimirMangos --- src/game/SpellMgr.cpp | 2 ++ src/shared/revision_nr.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 20ef326b3..b42be1e5d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1000,6 +1000,8 @@ void SpellMgr::LoadSpellBonusess() DoSpellBonusess worker(sbe); doForHighRanks(entry,worker); + ++count; + } while( result->NextRow() ); delete result; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f35a59933..1f89d3cff 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 "8438" + #define REVISION_NR "8439" #endif // __REVISION_NR_H__ From c9f475dfa001bf0d3a2768f5dc474f5dcfae2456 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 30 Aug 2009 00:22:44 +0400 Subject: [PATCH 7/8] [8440] Reset cooldown for triggred spell 61848 before it casting. This is second case simialr hack, maybe possible find more nice way for this... --- src/game/SpellAuras.cpp | 6 ++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c281e0320..370ea566b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5711,7 +5711,13 @@ void Aura::HandleSpellSpecificBoosts(bool apply) } // Aspect of the Dragonhawk dodge else if (GetSpellProto()->SpellFamilyFlags2 & 0x00001000) + { spellId1 = 61848; + + // triggered spell have same category as main spell and cooldown + if (apply && m_target->GetTypeId()==TYPEID_PLAYER) + ((Player*)m_target)->RemoveSpellCooldown(61848); + } else return; break; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1f89d3cff..7f65cc3a9 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 "8439" + #define REVISION_NR "8440" #endif // __REVISION_NR_H__ From 8a7b77c0883eeefa6977f12c4395ab54f2bcc9fb Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 30 Aug 2009 14:04:18 +0400 Subject: [PATCH 8/8] [8441] Implement check DBs versions (required_* fields) at mangosd/realmd loading. * git_id updated to generate revision_sql.h file with required_* fields strings. * mangosd/realmd changed to include header and check this strings at startup. * mangosd/realmd will terminated if related strings not match in DB content. In most cases this meaning that not all expected sql updates applied. Current required_* field stored in DB output in error to help find what last sql updates applied. IMPORTNAT NOTE for mangos devs: please update used git_id before adding next commits with sql updates! --- contrib/git_id/git_id.cpp | 55 ++++++++++++++++++++++++++++---- src/mangosd/Master.cpp | 10 ++++++ src/realmd/Main.cpp | 4 +++ src/shared/Database/Database.cpp | 40 +++++++++++++++++++++++ src/shared/Database/Database.h | 1 + src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 6 ++++ 7 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 src/shared/revision_sql.h diff --git a/contrib/git_id/git_id.cpp b/contrib/git_id/git_id.cpp index df81ac522..14bdf9165 100644 --- a/contrib/git_id/git_id.cpp +++ b/contrib/git_id/git_id.cpp @@ -58,7 +58,8 @@ char remotes[NUM_REMOTES][MAX_REMOTE] = { }; char remote_branch[MAX_REMOTE] = "master"; -char rev_file[MAX_PATH] = "src/shared/revision_nr.h"; +char rev_nr_file[MAX_PATH] = "src/shared/revision_nr.h"; +char rev_sql_file[MAX_PATH] = "src/shared/revision_sql.h"; char sql_update_dir[MAX_PATH] = "sql/updates"; char new_index_file[MAX_PATH] = ".git/git_id_index"; @@ -80,6 +81,12 @@ char db_sql_file[NUM_DATABASES][MAX_PATH] = { "sql/realmd.sql" }; +char db_sql_rev_field[NUM_DATABASES][MAX_PATH] = { + "REVISION_DB_CHARACTERS", + "REVISION_DB_MANGOS", + "REVISION_DB_REALMD" +}; + bool allow_replace = false; bool local = false; bool do_fetch = false; @@ -257,7 +264,7 @@ bool find_rev() return rev > 0; } -std::string generateHeader(char const* rev_str) +std::string generateNrHeader(char const* rev_str) { std::ostringstream newData; newData << "#ifndef __REVISION_NR_H__" << std::endl; @@ -267,6 +274,17 @@ std::string generateHeader(char const* rev_str) return newData.str(); } +std::string generateSqlHeader() +{ + std::ostringstream newData; + newData << "#ifndef __REVISION_SQL_H__" << std::endl; + newData << "#define __REVISION_SQL_H__" << std::endl; + for(int i = 0; i < NUM_DATABASES; ++i) + newData << " #define " << db_sql_rev_field[i] << " \"required_" << last_sql_update[i] << "\"" << std::endl; + newData << "#endif // __REVISION_SQL_H__" << std::endl; + return newData.str(); +} + void system_switch_index(const char *cmd) { // do the command for the original index and then for the new index @@ -280,15 +298,39 @@ void system_switch_index(const char *cmd) if(putenv(old_index_cmd) != 0) return; } -bool write_rev() +bool write_rev_nr() { printf("+ writing revision_nr.h\n"); char rev_str[256]; sprintf(rev_str, "%d", rev); - std::string header = generateHeader(rev_str); + std::string header = generateNrHeader(rev_str); char prefixed_file[MAX_PATH]; - snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_file); + snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_nr_file); + + if(FILE* OutputFile = fopen(prefixed_file, "wb")) + { + fprintf(OutputFile,"%s", header.c_str()); + fclose(OutputFile); + + // add the file to both indices, to be committed later + snprintf(cmd, MAX_CMD, "git add %s", prefixed_file); + system_switch_index(cmd); + + return true; + } + + return false; +} + +bool write_rev_sql() +{ + if(new_sql_updates.empty()) return true; + printf("+ writing revision_sql.h\n"); + std::string header = generateSqlHeader(); + + char prefixed_file[MAX_PATH]; + snprintf(prefixed_file, MAX_PATH, "%s%s", path_prefix, rev_sql_file); if(FILE* OutputFile = fopen(prefixed_file, "wb")) { @@ -846,12 +888,13 @@ int main(int argc, char *argv[]) if(do_sql) DO( find_sql_updates() ); DO( prepare_new_index() ); - DO( write_rev() ); + DO( write_rev_nr() ); if(do_sql) { DO( convert_sql_updates() ); DO( generate_sql_makefile() ); DO( change_sql_database() ); + DO( write_rev_sql() ); } DO( amend_commit() ); DO( cleanup_new_index() ); diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 996cade19..7cb6c1011 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -38,6 +38,7 @@ #include "RASocket.h" #include "ScriptCalls.h" #include "Util.h" +#include "revision_sql.h" #include "sockets/TcpSocket.h" #include "sockets/Utility.h" @@ -416,6 +417,9 @@ bool Master::_StartDB() return false; } + if(!WorldDatabase.CheckRequiredField("db_version",REVISION_DB_MANGOS)) + return false; + if(!sConfig.GetString("CharacterDatabaseInfo", &dbstring)) { sLog.outError("Character Database not specified in configuration file"); @@ -430,6 +434,9 @@ bool Master::_StartDB() return false; } + if(!CharacterDatabase.CheckRequiredField("character_db_version",REVISION_DB_CHARACTERS)) + return false; + ///- Get login database info from configuration file if(!sConfig.GetString("LoginDatabaseInfo", &dbstring)) { @@ -445,6 +452,9 @@ bool Master::_StartDB() return false; } + if(!loginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) + return false; + ///- Get the realm Id from the configuration file realmID = sConfig.GetIntDefault("RealmID", 0); if(!realmID) diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 777ad05c8..9080cf06f 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -31,6 +31,7 @@ #include "SystemConfig.h" #include "revision.h" #include "revision_nr.h" +#include "revision_sql.h" #include "Util.h" #include #include @@ -325,6 +326,9 @@ bool StartDB(std::string &dbstring) return false; } + if(!loginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) + return false; + return true; } diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 58dc18c47..6bca7c967 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -189,3 +189,43 @@ bool Database::DirectPExecute(const char * format,...) return DirectExecute(szQuery); } + +bool Database::CheckRequiredField( char const* table_name, char const* required_name ) +{ + // check required field + QueryResult* result = PQuery("SELECT %s FROM %s LIMIT 1",required_name,table_name); + if(result) + { + delete result; + return true; + } + + // check fail, prepare readabale error message + + // search current required_* field in DB + QueryNamedResult* result2 = PQueryNamed("SELECT * FROM %s LIMIT 1",table_name); + if(result2) + { + QueryFieldNames const& namesMap = result2->GetFieldNames(); + std::string reqName; + for(QueryFieldNames::const_iterator itr = namesMap.begin(); itr != namesMap.end(); ++itr) + { + if(itr->substr(0,9)=="required_") + { + reqName = *itr; + break; + } + } + + delete result; + + if(!reqName.empty()) + { + sLog.outErrorDb("Table `%s` have field `%s` but expected `%s`! Not all sql updates applied?",table_name,reqName.c_str(),required_name); + return false; + } + } + + sLog.outErrorDb("Table `%s` not have required_* field but expected `%s`! Not all sql updates applied?",table_name,required_name); + return false; +} \ No newline at end of file diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index d7dfd23e2..5935692d2 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -129,6 +129,7 @@ class MANGOS_DLL_SPEC Database // sets the result queue of the current thread, be careful what thread you call this from void SetResultQueue(SqlResultQueue * queue); + bool CheckRequiredField(char const* table_name, char const* required_name); private: bool m_logSQL; std::string m_logsDir; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7f65cc3a9..82bc4742b 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 "8440" + #define REVISION_NR "8441" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h new file mode 100644 index 000000000..6dfab5a59 --- /dev/null +++ b/src/shared/revision_sql.h @@ -0,0 +1,6 @@ +#ifndef __REVISION_SQL_H__ +#define __REVISION_SQL_H__ + #define REVISION_DB_CHARACTERS "required_8433_01_characters_character_account_data" + #define REVISION_DB_MANGOS "required_8416_01_mangos_spell_learn_spell" + #define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters" +#endif // __REVISION_SQL_H__