diff --git a/contrib/extractor/.gitignore b/contrib/extractor/.gitignore index 4b5584e53..bbf017c83 100644 --- a/contrib/extractor/.gitignore +++ b/contrib/extractor/.gitignore @@ -12,6 +12,7 @@ *.bsc *.ncb +*.pdb *.suo debug release diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index ade687260..d86af0b14 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -39,7 +39,7 @@ enum Extract }; int extract = EXTRACT_MAP | EXTRACT_DBC; -static char* const langs[]={"deDE", "enGB", "enUS", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; +static char* const langs[]={"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; #define LANG_COUNT 12 #define ADT_RES 64 @@ -167,11 +167,11 @@ void ExtractMapsFromMpq() path += "/maps/"; CreateDir(path); - for(int x = 0; x < ADT_RES; ++x) + for(unsigned int x = 0; x < ADT_RES; ++x) { - for(int y = 0; y < ADT_RES; ++y) + for(unsigned int y = 0; y < ADT_RES; ++y) { - for(int z = 0; z < map_count; ++z) + for(unsigned int z = 0; z < map_count; ++z) { sprintf(mpq_filename,"World\\Maps\\%s\\%s_%u_%u.adt",map_ids[z].name,map_ids[z].name,x,y); sprintf(output_filename,"%s/maps/%03u%02u%02u.map",output_path,map_ids[z].id,y,x); @@ -189,7 +189,7 @@ void ExtractMapsFromMpq() //bool WMO(char* filename); -void ExtractDBCFiles() +void ExtractDBCFiles(int locale, bool basicLocale) { printf("Extracting dbc files...\n"); @@ -198,26 +198,30 @@ void ExtractDBCFiles() // get DBC file list for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) { - vector files = (*i)->GetFileList(); + vector files; + (*i)->GetFileListTo(files); for (vector::iterator iter = files.begin(); iter != files.end(); ++iter) if (iter->rfind(".dbc") == iter->length() - strlen(".dbc")) dbcfiles.insert(*iter); } - std::string path = output_path; + string path = output_path; path += "/dbc/"; CreateDir(path); + if(!basicLocale) + { + path += langs[locale]; + path += "/"; + CreateDir(path); + } // extract DBCs int count = 0; for (set::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter) { - string filename = output_path; - filename += "/dbc/"; + string filename = path; filename += (iter->c_str() + strlen("DBFilesClient\\")); - //cout << filename << endl; - FILE *output=fopen(filename.c_str(),"wb"); if(!output) { @@ -231,27 +235,10 @@ void ExtractDBCFiles() fclose(output); ++count; } - printf("Extracted %u DBC files\n", count); + printf("Extracted %u DBC files\n\n", count); } -int GetLocale() -{ - for (int i = 0; i < LANG_COUNT; i++) - { - char tmp1[512]; - sprintf(tmp1, "%s/Data/%s/locale-%s.MPQ", input_path, langs[i], langs[i]); - if (FileExists(tmp1)) - { - printf("Detected locale: %s\n", langs[i]); - return i; - } - } - - printf("Could not detect locale.\n"); - return -1; -} - -void LoadMPQFiles(int const locale) +void LoadLocaleMPQFiles(int const locale) { char filename[512]; @@ -265,58 +252,100 @@ void LoadMPQFiles(int const locale) sprintf(ext, "-%i", i); sprintf(filename,"%s/Data/%s/patch-%s%s.MPQ",input_path,langs[locale],langs[locale],ext); - if(!FileExists(filename)) - break; - new MPQArchive(filename); - } - - //need those files only if extract maps - if(extract & EXTRACT_MAP) - { - sprintf(filename,"%s/Data/common-2.MPQ",input_path); - new MPQArchive(filename); - sprintf(filename,"%s/Data/lichking.MPQ",input_path); - new MPQArchive(filename); - sprintf(filename,"%s/Data/expansion.MPQ",input_path); - new MPQArchive(filename); - - for(int i = 1; i < 5; ++i) - { - char ext[3] = ""; - if(i > 1) - sprintf(ext, "-%i", i); - - sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext); - if(!FileExists(filename)) - break; + if(FileExists(filename)) new MPQArchive(filename); - } } } +void LoadCommonMPQFiles() +{ + char filename[512]; + + sprintf(filename,"%s/Data/common-2.MPQ",input_path); + new MPQArchive(filename); + sprintf(filename,"%s/Data/lichking.MPQ",input_path); + new MPQArchive(filename); + sprintf(filename,"%s/Data/expansion.MPQ",input_path); + new MPQArchive(filename); + + for(int i = 1; i < 5; ++i) + { + char ext[3] = ""; + if(i > 1) + sprintf(ext, "-%i", i); + + sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext); + if(FileExists(filename)) + new MPQArchive(filename); + } +} + +inline void CloseMPQFiles() +{ + for(ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end();++j) (*j)->close(); + gOpenArchives.clear(); +} + int main(int argc, char * arg[]) { printf("Map & DBC Extractor\n"); - printf("===================\n"); + printf("===================\n\n"); HandleArgs(argc, arg); - int const locale = GetLocale(); - if(locale < 0) - return 1; + int FirstLocale = -1; - LoadMPQFiles(locale); + for (int i = 0; i < LANG_COUNT; i++) + { + char tmp1[512]; + sprintf(tmp1, "%s/Data/%s/locale-%s.MPQ", input_path, langs[i], langs[i]); + if (FileExists(tmp1)) + { + printf("Detected locale: %s\n", langs[i]); - if(extract & EXTRACT_DBC) - ExtractDBCFiles(); + //Open MPQs + LoadLocaleMPQFiles(i); - if(extract & EXTRACT_MAP) + if((extract & EXTRACT_DBC) == 0) + { + FirstLocale=i; + break; + } + + //Extract DBC files + if(FirstLocale<0) + { + ExtractDBCFiles(i, true); + FirstLocale = i; + } + else + ExtractDBCFiles(i, false); + + //Close MPQs + CloseMPQFiles(); + } + } + + if(FirstLocale<0) + { + printf("No locales detected\n"); + return 0; + } + + if (extract & EXTRACT_MAP) + { + printf("Using locale: %s\n", langs[FirstLocale]); + + // Open MPQs + LoadLocaleMPQFiles(FirstLocale); + LoadCommonMPQFiles(); + + // Extract maps ExtractMapsFromMpq(); - //Close MPQs - for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) - (*i)->close(); - gOpenArchives.clear(); + // Close MPQs + CloseMPQFiles(); + } return 0; } diff --git a/contrib/extractor/VC71_ad.vcproj b/contrib/extractor/VC71_ad.vcproj index b11541382..2bd27e526 100644 --- a/contrib/extractor/VC71_ad.vcproj +++ b/contrib/extractor/VC71_ad.vcproj @@ -52,10 +52,10 @@ BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="0" - PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + PrecompiledHeaderFile="$(IntDir)ad.pch" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" @@ -149,10 +149,10 @@ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="0" UsePrecompiledHeader="0" - PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + PrecompiledHeaderFile="$(IntDir)ad.pch" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" WarningLevel="3" SuppressStartupBanner="true" /> diff --git a/contrib/extractor/VC80_ad.vcproj b/contrib/extractor/VC80_ad.vcproj index ddf423c4b..30657907f 100644 --- a/contrib/extractor/VC80_ad.vcproj +++ b/contrib/extractor/VC80_ad.vcproj @@ -54,10 +54,11 @@ BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="0" - PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + PrecompiledHeaderFile="$(IntDir)ad.pch" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" + XMLDocumentationFileName="$(IntDir)\" BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" @@ -80,7 +81,7 @@ OutputFile="ad debug.exe" LinkIncremental="1" SuppressStartupBanner="true" - AdditionalLibraryDirectories="./debug/" + AdditionalLibraryDirectories="./debug" IgnoreDefaultLibraryNames="LIBCD.lib" GenerateDebugInformation="true" ProgramDatabaseFile="./ad debug.pdb" @@ -153,9 +154,10 @@ RuntimeLibrary="0" UsePrecompiledHeader="0" PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" + XMLDocumentationFileName="$(IntDir)\" WarningLevel="3" SuppressStartupBanner="true" /> @@ -176,7 +178,7 @@ OutputFile="./ad.exe" LinkIncremental="1" SuppressStartupBanner="true" - AdditionalLibraryDirectories="./release/" + AdditionalLibraryDirectories="./release" IgnoreDefaultLibraryNames="LIBC.lib" ProgramDatabaseFile="./ad.pdb" SubSystem="1" diff --git a/contrib/extractor/VC90_ad.vcproj b/contrib/extractor/VC90_ad.vcproj index 148c33643..14aa824a0 100644 --- a/contrib/extractor/VC90_ad.vcproj +++ b/contrib/extractor/VC90_ad.vcproj @@ -4,6 +4,7 @@ Version="9,00" Name="ad" ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}" + RootNamespace="ad" TargetFrameworkVersion="131072" > @@ -53,11 +54,13 @@ BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="0" - PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + PrecompiledHeaderFile="$(IntDir)ad.pch" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" + XMLDocumentationFileName="$(IntDir)\" BrowseInformation="1" + BrowseInformationFile="$(IntDir)" WarningLevel="3" SuppressStartupBanner="true" DebugInformationFormat="4" @@ -149,10 +152,11 @@ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="0" UsePrecompiledHeader="0" - PrecompiledHeaderFile="c:\windows\temp/ad.pch" - AssemblerListingLocation="c:\windows\temp/" - ObjectFile="c:\windows\temp/" - ProgramDataBaseFileName="c:\windows\temp/" + PrecompiledHeaderFile="$(IntDir)ad.pch" + AssemblerListingLocation="$(IntDir)\" + ObjectFile="$(IntDir)\" + ProgramDataBaseFileName="$(IntDir)\" + XMLDocumentationFileName="$(IntDir)\" WarningLevel="3" SuppressStartupBanner="true" /> diff --git a/contrib/extractor/libmpq/mpq.cpp b/contrib/extractor/libmpq/mpq.cpp index 9582b72b5..c6a5d7d7b 100644 --- a/contrib/extractor/libmpq/mpq.cpp +++ b/contrib/extractor/libmpq/mpq.cpp @@ -199,7 +199,7 @@ int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype) { /* * This function returns some useful file information. */ -int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number) { +int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const unsigned int number) { int blockindex = number; //-1; int i = 0; mpq_block *mpq_b = NULL; diff --git a/contrib/extractor/libmpq/mpq.h b/contrib/extractor/libmpq/mpq.h index 0a136f95f..55b72ad75 100644 --- a/contrib/extractor/libmpq/mpq.h +++ b/contrib/extractor/libmpq/mpq.h @@ -198,7 +198,7 @@ extern int libmpq_archive_open(mpq_archive *mpq_a, unsigned char *mpq_filename); extern int libmpq_archive_close(mpq_archive *mpq_a); extern int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype); //extern int libmpq_file_extract(mpq_archive *mpq_a, const int number); -extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number); +extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const unsigned int number); extern char *libmpq_file_name(mpq_archive *mpq_a, const int number); extern int libmpq_file_number(mpq_archive *mpq_a, const char *name); extern int libmpq_file_check(mpq_archive *mpq_a, void *file, int type); diff --git a/contrib/extractor/libmpq/parser.cpp b/contrib/extractor/libmpq/parser.cpp index b7a70400f..435395b87 100644 --- a/contrib/extractor/libmpq/parser.cpp +++ b/contrib/extractor/libmpq/parser.cpp @@ -79,7 +79,7 @@ int libmpq_conf_parse_line(char *line, char *search_value, char *return_value, i } /* now search for comment in this line */ - for (i = 0; i < strlen(line); i++) { + for (i = 0; i < int(strlen(line)); i++) { if (line[i] == '#') { pos = i - 1; break; diff --git a/contrib/extractor/mpq_libmpq.cpp b/contrib/extractor/mpq_libmpq.cpp index 98d114c57..41253b242 100644 --- a/contrib/extractor/mpq_libmpq.cpp +++ b/contrib/extractor/mpq_libmpq.cpp @@ -71,7 +71,7 @@ MPQFile::MPQFile(const char* filename): continue; //file not found } - int fileno = blockindex; + uint32 fileno = blockindex; //int fileno = libmpq_file_number(&mpq_a, filename); //if(fileno == LIBMPQ_EFILE_NOT_FOUND) diff --git a/contrib/extractor/mpq_libmpq.h b/contrib/extractor/mpq_libmpq.h index 542e7b21d..9b4984a50 100644 --- a/contrib/extractor/mpq_libmpq.h +++ b/contrib/extractor/mpq_libmpq.h @@ -51,14 +51,12 @@ public: return nullhash; } - vector GetFileList() { - vector filelist; - + void GetFileListTo(vector& filelist) { mpq_hash hash = GetHashEntry("(listfile)"); uint32 blockindex = hash.blockindex; if ((blockindex == 0xFFFFFFFF) || (blockindex == 0)) - return filelist; + return; uint32 size = libmpq_file_info(&mpq_a, LIBMPQ_FILE_UNCOMPRESSED_SIZE, blockindex); char *buffer = new char[size]; @@ -79,8 +77,7 @@ public: token = strtok(NULL, seps); } - delete buffer; - return filelist; + delete[] buffer; } }; typedef std::deque ArchiveSet; diff --git a/src/framework/Dynamic/ObjectRegistry.h b/src/framework/Dynamic/ObjectRegistry.h index 9e9121418..3cec26bbf 100644 --- a/src/framework/Dynamic/ObjectRegistry.h +++ b/src/framework/Dynamic/ObjectRegistry.h @@ -24,6 +24,7 @@ #include "Policies/Singleton.h" #include +#include #include /** ObjectRegistry holds all registry item of the same type diff --git a/src/framework/Utilities/Callback.h b/src/framework/Utilities/Callback.h index d76bed2e8..1e2e07ab9 100644 --- a/src/framework/Utilities/Callback.h +++ b/src/framework/Utilities/Callback.h @@ -140,7 +140,7 @@ namespace MaNGOS void _Execute() { (*m_method)(m_param1, m_param2, m_param3); } public: _SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3) - : m_method(method), m_param1(param1), m_param2(param2) {} + : m_method(method), m_param1(param1), m_param2(param2), m_param3(param3) {} _SCallback(_SCallback < ParamType1, ParamType2, ParamType3 > const& cb) : m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {} }; diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index b8796f61a..06336fe70 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -57,13 +57,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam Name = ArenaTeamName; Type = type; - QueryResult *result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); - if( result ) - { - Id = (*result)[0].GetUInt32()+1; - delete result; - } - else Id = 1; + Id = objmgr.GenerateArenaTeamId(); // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB CharacterDatabase.escape_string(ArenaTeamName); diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index baf5d77b6..4438aec1f 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -674,7 +674,7 @@ void BattleGround::Reset() m_PlayerScores.clear(); // reset BGSubclass - this->ResetBGSubclass(); + ResetBGSubclass(); } void BattleGround::StartBattleGround() @@ -1034,7 +1034,7 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float if(!pCreature) { sLog.outError("Can't create Spirit guide. BattleGround not created!"); - this->EndNow(); + EndNow(); return false; } diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 5eb6d6286..18d08595d 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -133,10 +133,10 @@ void BattleGroundEY::Update(time_t diff) /*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times but we can count of players on current point in CheckSomeoneLeftPoint */ - this->CheckSomeoneJoinedPoint(); + CheckSomeoneJoinedPoint(); //check if player left point - this->CheckSomeoneLeftPoint(); - this->UpdatePointStatuses(); + CheckSomeoneLeftPoint(); + UpdatePointStatuses(); m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME; } } @@ -221,7 +221,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() { m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); - this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); } else { @@ -264,17 +264,17 @@ void BattleGroundEY::UpdatePointStatuses() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); if (plr) { - this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); + UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); //if point owner changed we must evoke event! if (pointOwnerTeamId != m_PointOwnedByTeam[point]) { //point was uncontrolled and player is from team which captured point if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId) - this->EventTeamCapturedPoint(plr, point); + EventTeamCapturedPoint(plr, point); //point was under control and player isn't from team which controlled it if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point]) - this->EventTeamLostPoint(plr, point); + EventTeamLostPoint(plr, point); } } } @@ -350,7 +350,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid) if(m_FlagKeeper == guid) { if(plr) - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); else { SetFlagPicker(0); @@ -610,7 +610,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source) void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) { - if(GetStatus() != STATUS_IN_PROGRESS || this->IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) + if(GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) return; const char *message; @@ -750,7 +750,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) { - if(GetStatus() != STATUS_IN_PROGRESS || this->GetFlagPickerGUID() != Source->GetGUID()) + if(GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) return; uint8 type = 0; diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index e26ed0146..3b744f043 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -310,7 +310,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) // if the player is dead, resurrect him before teleport if(!_player->isAlive()) { - _player->ResurrectPlayer(1.0f,false); + _player->ResurrectPlayer(1.0f); _player->SpawnCorpseBones(); } diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index c07639b8d..5e83ce9f5 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -80,7 +80,7 @@ void BattleGroundQueue::AddPlayer(Player *plr, uint32 bgTypeId) else ++m_QueuedPlayers[queue_id].Horde; - this->Update(bgTypeId, queue_id); + Update(bgTypeId, queue_id); if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) ) { @@ -183,7 +183,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id) } //if no players in queue ... do nothing - if (this->m_QueuedPlayers[queue_id].Alliance == 0 && this->m_QueuedPlayers[queue_id].Horde == 0) + if (m_QueuedPlayers[queue_id].Alliance == 0 && m_QueuedPlayers[queue_id].Horde == 0) return; //battleground with free slot for player should be always the last in this queue @@ -628,7 +628,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID) { // set invited player counters: - BattleGround* bg = this->GetBattleGround(bgInstanceGUID); + BattleGround* bg = GetBattleGround(bgInstanceGUID); if(!bg) return; diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 4334304d6..23c90a763 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -217,7 +217,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if(Source->GetTeam() == ALLIANCE) { - if (!this->IsHordeFlagPickedup()) + if (!IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) @@ -234,7 +234,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) } else { - if (!this->IsAllianceFlagPickedup()) + if (!IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) @@ -293,7 +293,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) if(Source->GetTeam() == ALLIANCE) { - if(!this->IsHordeFlagPickedup()) + if(!IsHordeFlagPickedup()) return; if(GetHordeFlagPickerGUID() == Source->GetGUID()) { @@ -308,7 +308,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) } else { - if(!this->IsAllianceFlagPickedup()) + if(!IsAllianceFlagPickedup()) return; if(GetAllianceFlagPickerGUID() == Source->GetGUID()) { @@ -345,12 +345,12 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target if(GetStatus() != STATUS_IN_PROGRESS) return; - const char *message; + const char *message = NULL; uint8 type = 0; //alliance flag picked up from base - if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE + && m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { message = GetMangosString(LANG_BG_WS_PICKEDUP_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; @@ -365,8 +365,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //horde flag picked up from base - if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE + && m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { message = GetMangosString(LANG_BG_WS_PICKEDUP_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; @@ -381,7 +381,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //Alliance flag on ground(not in base) (returned or picked up again from ground!) - if(this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if(GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { if(Source->GetTeam() == ALLIANCE) { @@ -410,7 +410,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target } //Horde flag on ground(not in base) (returned or picked up again) - if(this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) + if(GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) { if(Source->GetTeam() == HORDE) { @@ -455,22 +455,22 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid) if(!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - this->SetAllianceFlagPicker(0); - this->RespawnFlag(ALLIANCE, false); + SetAllianceFlagPicker(0); + RespawnFlag(ALLIANCE, false); } else - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); } if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid) { if(!plr) { sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); - this->SetHordeFlagPicker(0); - this->RespawnFlag(HORDE, false); + SetHordeFlagPicker(0); + RespawnFlag(HORDE, false); } else - this->EventPlayerDroppedFlag(plr); + EventPlayerDroppedFlag(plr); } } diff --git a/src/game/Cell.h b/src/game/Cell.h index 5fc4177d3..b0ff85d89 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -119,7 +119,7 @@ struct MANGOS_DLL_DECL Cell Cell& operator=(const Cell &cell) { - this->data.All = cell.data.All; + data.All = cell.data.All; return *this; } @@ -154,7 +154,7 @@ struct MANGOS_DLL_DECL CellLock operator const Cell &(void) const { return i_cell; } CellLock& operator=(const CellLock &cell) { - this->~CellLock(); + ~CellLock(); new (this) CellLock(cell); return *this; } diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 1523fe673..dae0ba95d 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -137,7 +137,7 @@ void Corpse::DeleteFromDB() CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID())); } -bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId) +bool Corpse::LoadFromDB(uint32 guid, QueryResult *result) { bool external = (result != NULL); if (!external) diff --git a/src/game/Corpse.h b/src/game/Corpse.h index 1b8310f5b..08c772c75 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -59,7 +59,7 @@ class Corpse : public WorldObject bool Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang ); void SaveToDB(); - bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); + bool LoadFromDB(uint32 guid, QueryResult *result); bool LoadFromDB(uint32 guid, Field *fields); void DeleteBonesFromWorld(); diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp index a66cc4278..e551dd004 100644 --- a/src/game/CreatureAI.cpp +++ b/src/game/CreatureAI.cpp @@ -17,10 +17,7 @@ */ #include "CreatureAI.h" -#include "HateMatrix.h" CreatureAI::~CreatureAI() { } - -uint32 HateBinder::si_noHateValue=0; diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp index 0a7b65cc5..79fdb492a 100644 --- a/src/game/GMTicketHandler.cpp +++ b/src/game/GMTicketHandler.cpp @@ -105,7 +105,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) CharacterDatabase.escape_string(ticketText); - if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) + if(ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) { WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); data << uint32(1); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index e9841e4fc..53b56b5fa 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -423,7 +423,7 @@ void GameObject::Update(uint32 /*p_time*/) //burning flags in some battlegrounds, if you find better condition, just add it if (GetGoAnimProgress() > 0) { - SendObjectDeSpawnAnim(this->GetGUID()); + SendObjectDeSpawnAnim(GetGUID()); //reset flags SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); } @@ -571,7 +571,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) } uint32 entry = data->id; - uint32 map_id = data->mapid; + //uint32 map_id = data->mapid; // already used before call float x = data->posX; float y = data->posY; float z = data->posZ; diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 1a22438e7..862f434fb 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -472,7 +472,7 @@ namespace MaNGOS return false; } - template bool operator()(NOT_INTERESTED* u) { return false; } + template bool operator()(NOT_INTERESTED*) { return false; } private: Unit* const i_funit; float i_range; diff --git a/src/game/GridStates.cpp b/src/game/GridStates.cpp index abbac8054..339dad86e 100644 --- a/src/game/GridStates.cpp +++ b/src/game/GridStates.cpp @@ -48,7 +48,7 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c } void -IdleState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, const uint32 &y, const uint32 &) const +IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &) const { m.ResetGridExpiry(grid); grid.SetGridState(GRID_STATE_REMOVAL); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 36bccee2f..cb03edabd 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1305,7 +1305,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed ) void Roll::targetObjectBuildLink() { // called from link() - this->getTarget()->addLootValidatorRef(this); + getTarget()->addLootValidatorRef(this); } void Group::SetDifficulty(uint8 difficulty) diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 5b112c095..218326448 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -636,7 +636,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleRaidReadyCheckFinishOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRaidReadyCheckFinishOpcode( WorldPacket & /*recv_data*/ ) { //Group* group = GetPlayer()->GetGroup(); //if(!group) diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index a9a8737dd..0dbcda15e 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -69,13 +69,7 @@ bool Guild::create(uint64 lGuid, std::string gname) guildbank_money = 0; purchased_tabs = 0; - QueryResult *result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); - if( result ) - { - Id = (*result)[0].GetUInt32()+1; - delete result; - } - else Id = 1; + Id = objmgr.GenerateGuildId(); // gname already assigned to Guild::name, use it to encode string for DB CharacterDatabase.escape_string(gname); @@ -110,8 +104,17 @@ bool Guild::create(uint64 lGuid, std::string gname) bool Guild::AddMember(uint64 plGuid, uint32 plRank) { - if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild - return false; + Player* pl = objmgr.GetPlayer(plGuid); + if(pl) + { + if(pl->GetGuildId() != 0) + return false; + } + else + { + if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild + return false; + } // remove all player signs from another petitions // this will be prevent attempt joining player to many guilds and corrupt guild data integrity @@ -140,7 +143,6 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank) CharacterDatabase.PExecute("INSERT INTO guild_member (guildid,guid,rank,pnote,offnote) VALUES ('%u', '%u', '%u','%s','%s')", Id, GUID_LOPART(plGuid), newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str()); - Player* pl = objmgr.GetPlayer(plGuid); if(pl) { pl->SetInGuild(Id); @@ -410,18 +412,16 @@ void Guild::LoadPlayerStatsByGuid(uint64 guid) void Guild::SetLeader(uint64 guid) { leaderGuid = guid; - this->ChangeRank(guid, GR_GUILDMASTER); + ChangeRank(guid, GR_GUILDMASTER); CharacterDatabase.PExecute("UPDATE guild SET leaderguid='%u' WHERE guildid='%u'", GUID_LOPART(guid), Id); } void Guild::DelMember(uint64 guid, bool isDisbanding) { - if(this->leaderGuid == guid && !isDisbanding) + if(leaderGuid == guid && !isDisbanding) { - std::ostringstream ss; - ss<<"SELECT guid FROM guild_member WHERE guildid='"<SetLeader(newLeaderGUID); + SetLeader(newLeaderGUID); newLeader = objmgr.GetPlayer(newLeaderGUID); if(newLeader) @@ -453,20 +453,20 @@ void Guild::DelMember(uint64 guid, bool isDisbanding) data << (uint8)2; data << oldLeaderName; data << newLeaderName; - this->BroadcastPacket(&data); + BroadcastPacket(&data); data.Initialize(SMSG_GUILD_EVENT, (1+1+oldLeaderName.size()+1)); data << (uint8)GE_LEFT; data << (uint8)1; data << oldLeaderName; - this->BroadcastPacket(&data); + BroadcastPacket(&data); } sLog.outDebug( "WORLD: Sent (SMSG_GUILD_EVENT)" ); } else { - this->Disband(); + Disband(); return; } } @@ -658,11 +658,20 @@ void Guild::SetRankRights(uint32 rankId, uint32 rights) CharacterDatabase.PExecute("UPDATE guild_rank SET rights='%u' WHERE rid='%u' AND guildid='%u'", rights, (rankId+1), Id); } +int32 Guild::GetRank(uint32 LowGuid) +{ + MemberList::iterator itr = members.find(LowGuid); + if (itr==members.end()) + return -1; + + return itr->second.RankId; +} + void Guild::Disband() { WorldPacket data(SMSG_GUILD_EVENT, 1); data << (uint8)GE_DISBANDED; - this->BroadcastPacket(&data); + BroadcastPacket(&data); while (!members.empty()) { @@ -763,11 +772,11 @@ void Guild::Query(WorldSession *session) void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor) { - this->EmblemStyle = emblemStyle; - this->EmblemColor = emblemColor; - this->BorderStyle = borderStyle; - this->BorderColor = borderColor; - this->BackgroundColor = backgroundColor; + EmblemStyle = emblemStyle; + EmblemColor = emblemColor; + BorderStyle = borderStyle; + BorderColor = borderColor; + BackgroundColor = backgroundColor; CharacterDatabase.PExecute("UPDATE guild SET EmblemStyle=%u, EmblemColor=%u, BorderStyle=%u, BorderColor=%u, BackgroundColor=%u WHERE guildid = %u", EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, Id); } @@ -951,15 +960,10 @@ void Guild::DisplayGuildBankMoneyUpdate() WorldPacket data(SMSG_GUILD_BANK_LIST, 8+1+4+1+1); data << uint64(GetGuildBankMoney()); - data << uint8(0); - // remaining slots for today - - size_t rempos = data.wpos(); - data << uint32(0); // will be filled later + data << uint8(0); // TabId, default 0 + data << uint32(0); // slot withdrow, default 0 data << uint8(0); // Tell client this is a tab content packet - data << uint8(0); // not send items - BroadcastPacket(&data); sLog.outDebug("WORLD: Sent (SMSG_GUILD_BANK_LIST)"); @@ -1981,7 +1985,7 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId) bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const { for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) - if(itr->slot == this->slot) + if(itr->slot == slot) return true; return false; diff --git a/src/game/Guild.h b/src/game/Guild.h index 7190edfab..11af9a70e 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -327,6 +327,11 @@ class Guild { return ((GetRankRights(rankId) & right) != GR_RIGHT_EMPTY) ? true : false; } + int32 GetRank(uint32 LowGuid); + bool IsMember(uint32 LowGuid) + { + return (members.find(LowGuid) != members.end()); + } void Roster(WorldSession *session); void Query(WorldSession *session); diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index a97a2d7da..1ac528222 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -150,10 +150,6 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) CHECK_PACKET_SIZE(recvPacket, 1); std::string plName; - uint64 plGuid; - uint32 plGuildId; - Guild *guild; - Player *player; //sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE"); @@ -162,45 +158,34 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - - if(player) - { - plGuid = player->GetGUID(); - plGuildId = player->GetGuildId(); - } - else - { - plGuid = objmgr.GetPlayerGUIDByName(plName); - plGuildId = Player::GetGuildIdFromDB(plGuid); - } - + Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - if(!plGuid) - { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); - return; - } - if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE)) { SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); return; } + uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + + if(!plGuid) + { + SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); + return; + } + if(plGuid == guild->GetLeader()) { SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE); return; } - if(GetPlayer()->GetGuildId() != plGuildId) + if(!guild->IsMember(GUID_LOPART(plGuid))) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; @@ -294,11 +279,6 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) CHECK_PACKET_SIZE(recvPacket, 1); std::string plName; - uint64 plGuid; - uint32 plGuildId; - uint32 plRankId; - Player *player; - Guild *guild; //sLog.outDebug("WORLD: Received CMSG_GUILD_PROMOTE"); @@ -307,27 +287,21 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(player) - { - plGuid = player->GetGUID(); - plGuildId = player->GetGuildId(); - plRankId = player->GetRank(); - } - else - { - plGuid = objmgr.GetPlayerGUIDByName(plName); - plGuildId = Player::GetGuildIdFromDB(plGuid); - plRankId = Player::GetRankFromDB(plGuid); - } - + Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if(!plGuid) + if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE)) + { + SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + return; + } + + uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + + if(!plGuid) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); return; @@ -337,24 +311,15 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID); return; } - else if(GetPlayer()->GetGuildId() != plGuildId) + + int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); + if(plRankId == -1) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - else if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE)) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + if(plRankId < 2 || (plRankId-1) < GetPlayer()->GetRank()) return; - } - else if((plRankId-1) == 0 || (plRankId-1) < this->GetPlayer()->GetRank()) - return; - - if(plRankId < 1) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_INTERNAL); - return; - } uint32 newRankId = plRankId < guild->GetNrRanks() ? plRankId-1 : guild->GetNrRanks()-1; @@ -376,11 +341,6 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) CHECK_PACKET_SIZE(recvPacket, 1); std::string plName; - uint64 plGuid; - uint32 plGuildId; - uint32 plRankId; - Player *player; - Guild *guild; //sLog.outDebug("WORLD: Received CMSG_GUILD_DEMOTE"); @@ -389,20 +349,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(plName)) return; - player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(player) - { - plGuid = player->GetGUID(); - plGuildId = player->GetGuildId(); - plRankId = player->GetRank(); - } - else - { - plGuid = objmgr.GetPlayerGUIDByName(plName); - plGuildId = Player::GetGuildIdFromDB(plGuid); - plRankId = Player::GetRankFromDB(plGuid); - } + Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); if(!guild) { @@ -410,6 +357,14 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) return; } + if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE)) + { + SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + return; + } + + uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + if( !plGuid ) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); @@ -422,19 +377,13 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) return; } - if(GetPlayer()->GetGuildId() != plGuildId) + int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); + if(plRankId == -1) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - - if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE)) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); - return; - } - - if((plRankId+1) >= guild->GetNrRanks() || plRankId <= this->GetPlayer()->GetRank()) + if((plRankId+1) >= guild->GetNrRanks() || plRankId <= GetPlayer()->GetRank()) return; guild->ChangeRank(plGuid, (plRankId+1)); @@ -521,9 +470,6 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) CHECK_PACKET_SIZE(recvPacket, 1); std::string name; - Player *newLeader; - uint64 newLeaderGUID; - uint32 newLeaderGuild; Player *oldLeader = GetPlayer(); Guild *guild; @@ -534,39 +480,32 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(name)) return; - newLeader = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); - if(newLeader) - { - newLeaderGUID = newLeader->GetGUID(); - newLeaderGuild = newLeader->GetGuildId(); - } - else - { - newLeaderGUID = objmgr.GetPlayerGUIDByName(name); - newLeaderGuild = Player::GetGuildIdFromDB(newLeaderGUID); - } guild = objmgr.GetGuildById(oldLeader->GetGuildId()); - if(!guild) + if (!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if(!newLeaderGUID) + + if (oldLeader->GetGUID() != guild->GetLeader()) + { + SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + return; + } + + uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name); + + if (!newLeaderGUID) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); return; } - if(oldLeader->GetGuildId() != newLeaderGuild) + if (!guild->IsMember(GUID_LOPART(newLeaderGUID))) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - if(oldLeader->GetGUID() != guild->GetLeader()) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); - return; - } guild->SetLeader(newLeaderGUID); guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER); @@ -620,10 +559,6 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket, 1); - Guild *guild; - Player *player; - uint64 plGuid; - uint32 plGuildId; std::string name,PNOTE; //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE"); @@ -633,39 +568,33 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) if(!normalizePlayerName(name)) return; - player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(player) - { - plGuid = player->GetGUID(); - plGuildId = player->GetGuildId(); - } - else - { - plGuid = objmgr.GetPlayerGUIDByName(name); - plGuildId = Player::GetGuildIdFromDB(plGuid); - } + Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(!guild) + if (!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if(!plGuid) + + if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE)) + { + SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + return; + } + + uint64 plGuid = objmgr.GetPlayerGUIDByName(name); + + if (!plGuid) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); return; } - else if(GetPlayer()->GetGuildId() != plGuildId) + + if (!guild->IsMember(GUID_LOPART(plGuid))) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE)) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); - return; - } recvPacket >> PNOTE; guild->SetPNOTE(plGuid, PNOTE); @@ -677,52 +606,41 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket, 1); - Guild *guild; - Player *player; - uint64 plGuid; - uint32 plGuildId; std::string plName, OFFNOTE; //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE"); recvPacket >> plName; - if(!normalizePlayerName(plName)) + if (!normalizePlayerName(plName)) return; - player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); - guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(player) - { - plGuid = player->GetGUID(); - plGuildId = player->GetGuildId(); - } - else - { - plGuid = objmgr.GetPlayerGUIDByName(plName); - plGuildId = Player::GetGuildIdFromDB(plGuid); - } + Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId()); - if(!guild) + if (!guild) { SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); return; } - else if( !plGuid ) + if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE)) + { + SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); + return; + } + + uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + + if (!plGuid) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); return; } - else if(GetPlayer()->GetGuildId() != plGuildId) + + if (!guild->IsMember(GUID_LOPART(plGuid))) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE)) - { - SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); - return; - } recvPacket >> OFFNOTE; guild->SetOFFNOTE(plGuid, OFFNOTE); @@ -1168,7 +1086,6 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data ) uint8 BankTab, BankTabSlot, AutoStore, AutoStoreCount, PlayerSlot, PlayerBag, SplitedAmount = 0; uint8 BankTabDst, BankTabSlotDst, unk2, ToChar = 1; uint32 ItemEntry, unk1; - bool BankToChar = false; CHECK_PACKET_SIZE(recv_data,8+1); recv_data >> GoGuid >> BankToBank; diff --git a/src/game/HateMatrix.h b/src/game/HateMatrix.h deleted file mode 100644 index ab03e34c8..000000000 --- a/src/game/HateMatrix.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2005-2008 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_HATEMATRIX_H -#define MANGOS_HATEMATRIX_H - -#include "Utilities/HashMap.h" -#include - -class Unit; - -struct MANGOS_DLL_DECL HateMatrix -{ - typedef hash_map HateMatrixMapType; - - inline uint32 operator[](Unit *unit) const - { - HateMatrixMapType::const_iterator iter = i_hateValues.find(unit); - return (iter == i_hateValues.end() ? 0 : iter->second); - } - - inline uint32& operator[](Unit *unit) - { - HateMatrixMapType::iterator iter = i_hateValues.find(unit); - if( iter == i_hateValues.end() ) - { - std::pair p = i_hateValues.insert( HateMatrixMapType::value_type(unit, 0) ); - assert(p.second); - iter = p.first; - } - - return iter->second; - } - - inline void ClearMatrix(void) { i_hateValues.clear(); } - - inline void RemoveValue(Unit *unit) - { - HateMatrixMapType::iterator iter = i_hateValues.find(unit); - if( iter != i_hateValues.end() ) - i_hateValues.erase( iter ); - } - - inline void AddValue(Unit *unit, uint32 val) - { - (*this)[unit] += val; - } - - private: - HateMatrixMapType i_hateValues; -}; - -struct HateBinder -{ - static uint32 si_noHateValue; - uint32 &i_hateValue; - Unit *i_unit; - HateBinder(uint32 &val, Unit *u) : i_hateValue(val), i_unit(u) {} - HateBinder() : i_hateValue(si_noHateValue), i_unit(NULL) {} - HateBinder(const HateBinder &obj) : i_hateValue(obj.i_hateValue), i_unit(obj.i_unit) {} - - HateBinder& operator=(const HateBinder &obj) - { - i_hateValue = obj.i_hateValue; - i_unit = obj.i_unit; - return *this; - } -}; -#endif diff --git a/src/game/IdleMovementGenerator.cpp b/src/game/IdleMovementGenerator.cpp index dd1c4d0bf..217ca35b4 100644 --- a/src/game/IdleMovementGenerator.cpp +++ b/src/game/IdleMovementGenerator.cpp @@ -39,7 +39,7 @@ DistractMovementGenerator::Finalize(Unit& owner) } bool -DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff) +DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff) { if(time_diff > m_timer) return false; diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 1debe2491..2f1833480 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -222,7 +222,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const va_list ap; char szQueryTail [MAX_QUERY_LEN]; va_start(ap, queryTail); - int res = vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap ); + vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap ); va_end(ap); QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail); @@ -246,8 +246,6 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const void InstanceSaveManager::CleanupInstances() { - uint64 now = (uint64)time(NULL); - barGoLink bar(2); bar.step(); diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 49cfb3ed5..23d0ae052 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -49,7 +49,7 @@ bool ChatHandler::HandleHelpCommand(const char* args) return true; } -bool ChatHandler::HandleCommandsCommand(const char* args) +bool ChatHandler::HandleCommandsCommand(const char* /*args*/) { ShowHelpForCommand(getCommandTable(), ""); return true; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index f5e4234b5..37b8b1493 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -438,8 +438,6 @@ bool ChatHandler::HandleGonameCommand(const char* args) Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr); if(cMap->Instanceable()) { - Map* pMap = MapManager::Instance().GetMap(_player->GetMapId(),_player); - // we have to go to instance, and can go to player only if: // 1) we are in his group (either as leader or as member) // 2) we are not bound to any group and have GM mode on @@ -1932,7 +1930,6 @@ bool ChatHandler::HandleSendMailCommand(const char* args) return false; } - uint32 mailId = objmgr.GenerateMailID(); uint32 sender_guidlo = m_session->GetPlayer()->GetGUIDLow(); uint32 messagetype = MAIL_NORMAL; uint32 stationery = MAIL_STATIONERY_GM; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index cb7024b42..c9b3b351d 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -749,7 +749,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args) return true; } -bool ChatHandler::HandleNameCommand(const char* args) +bool ChatHandler::HandleNameCommand(const char* /*args*/) { /* Temp. disabled if(!*args) @@ -3591,7 +3591,7 @@ bool ChatHandler::HandleLookupEventCommand(const char* args) return true; } -bool ChatHandler::HandleEventActiveListCommand(const char* args) +bool ChatHandler::HandleEventActiveListCommand(const char* /*args*/) { uint32 counter = 0; @@ -3850,8 +3850,6 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) if(!Utf8toWStr(args,wnamepart)) return false; - uint32 counter = 0; // Counter for figure out that we found smth. - // converting string that we try to find to lower case wstrToLower( wnamepart ); @@ -4117,7 +4115,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleNpcTameCommand(const char* args) +bool ChatHandler::HandleNpcTameCommand(const char* /*args*/) { Creature *creatureTarget = getSelectedCreature (); if (!creatureTarget || creatureTarget->isPet ()) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 0f13a89b1..9f23f99e0 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -159,7 +159,7 @@ bool ChatHandler::HandleReloadAllItemCommand(const char*) return true; } -bool ChatHandler::HandleReloadAllLocalesCommand(const char* args) +bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/) { HandleReloadLocalesCreatureCommand("a"); HandleReloadLocalesGameobjectCommand("a"); @@ -170,7 +170,7 @@ bool ChatHandler::HandleReloadAllLocalesCommand(const char* args) return true; } -bool ChatHandler::HandleReloadConfigCommand(const char* arg) +bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/) { sLog.outString( "Re-Loading config settings..." ); sWorld.LoadConfigSettings(true); @@ -5756,7 +5756,7 @@ bool ChatHandler::HandleCastBackCommand(const char* args) caster->BuildHeartBeatMsg(&data); caster->SendMessageToSet(&data,true); - caster->CastSpell(m_session->GetPlayer(),spell,false); + caster->CastSpell(m_session->GetPlayer(),spell,triggered); return true; } @@ -5847,7 +5847,7 @@ bool ChatHandler::HandleCastTargetCommand(const char* args) caster->BuildHeartBeatMsg(&data); caster->SendMessageToSet(&data,true); - caster->CastSpell(caster->getVictim(),spell,false); + caster->CastSpell(caster->getVictim(),spell,triggered); return true; } diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index b88169161..c61e22b7e 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -58,7 +58,7 @@ class LootTemplate::LootGroup // A set of loot def void Verify(LootStore const& lootstore, uint32 id, uint32 group_id) const; void CollectLootIds(LootIdSet& set) const; - void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const; + void CheckLootRefs(LootIdSet* ref_set) const; private: LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance @@ -206,7 +206,7 @@ void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set) void LootStore::CheckLootRefs(LootIdSet* ref_set) const { for(LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr) - ltItr->second->CheckLootRefs(m_LootTemplates,ref_set); + ltItr->second->CheckLootRefs(ref_set); } void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const @@ -855,7 +855,7 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint } } -void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const +void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const { for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr) { @@ -1009,7 +1009,7 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const // TODO: References validity checks } -void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const +void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const { for(LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr) { @@ -1023,7 +1023,7 @@ void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_se } for(LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr) - grItr->CheckLootRefs(store,ref_set); + grItr->CheckLootRefs(ref_set); } void LoadLootTemplates_Creature() diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 4885dd4fc..56fd6da3f 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -172,7 +172,7 @@ class LootTemplate // Checks integrity of the template void Verify(LootStore const& store, uint32 Id) const; - void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const; + void CheckLootRefs(LootIdSet* ref_set) const; private: LootStoreItemList Entries; // not grouped only LootGroups Groups; // groups have own (optimised) processing, grouped entries go there diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index df25832b4..ff1decf5a 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -346,13 +346,13 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data ) } } - SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, 0, m->mailTemplateId); + SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId); delete m; //we can deallocate old mail pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0); } -void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint32 COD, uint16 mailTemplateId ) +void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId ) { if(messageType != MAIL_NORMAL) // return only to players { diff --git a/src/game/Makefile.am b/src/game/Makefile.am index 671f078f8..823681525 100644 --- a/src/game/Makefile.am +++ b/src/game/Makefile.am @@ -127,7 +127,6 @@ libmangosgame_a_SOURCES = \ Guild.cpp \ Guild.h \ GuildHandler.cpp \ - HateMatrix.h \ HomeMovementGenerator.cpp \ HomeMovementGenerator.h \ HostilRefManager.cpp \ diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 25f616e83..d21c81eb7 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -418,7 +418,7 @@ Map::LoadGrid(const Cell& cell, bool no_unload) bool Map::Add(Player *player) { - player->SetInstanceId(this->GetInstanceId()); + player->SetInstanceId(GetInstanceId()); // update player state for other player and visa-versa CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index 741e0a996..79a8b88d4 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -24,7 +24,7 @@ #include "InstanceSaveMgr.h" #include "World.h" -MapInstanced::MapInstanced(uint32 id, time_t expiry, uint32 aInstanceId) : Map(id, expiry, 0, 0) +MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, 0) { // initialize instanced maps list m_InstancedMaps.clear(); diff --git a/src/game/MapInstanced.h b/src/game/MapInstanced.h index d4535b42f..08482dbd5 100644 --- a/src/game/MapInstanced.h +++ b/src/game/MapInstanced.h @@ -28,7 +28,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map public: typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; - MapInstanced(uint32 id, time_t, uint32 aInstanceId); + MapInstanced(uint32 id, time_t expiry); ~MapInstanced() {} // functions overwrite Map versions diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index d8a628978..6f04d2535 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -109,7 +109,7 @@ MapManager::_GetBaseMap(uint32 id) const MapEntry* entry = sMapStore.LookupEntry(id); if (entry && entry->IsDungeon()) { - m = new MapInstanced(id, i_gridCleanUpDelay, 0); + m = new MapInstanced(id, i_gridCleanUpDelay); } else { @@ -221,7 +221,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player) return true; } -void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode) +void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId) { Map *m = _GetBaseMap(mapid); if (m && m->Instanceable()) diff --git a/src/game/MapManager.h b/src/game/MapManager.h index 4dacca09d..71a627b43 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -43,7 +43,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton(this)->_GetBaseMap(id); } - void DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode); + void DeleteInstance(uint32 mapid, uint32 instanceId); inline uint16 GetAreaFlag(uint32 mapid, float x, float y) const { diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index d88b35222..469a4aa60 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -110,7 +110,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() { if( mEntry->IsDungeon() ) { - GetPlayer()->ResurrectPlayer(0.5f,false); + GetPlayer()->ResurrectPlayer(0.5f); GetPlayer()->SpawnCorpseBones(); GetPlayer()->SaveToDB(); } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 8a5a2b244..1c8b00cb8 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -372,7 +372,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data ) void WorldSession::SendSpiritResurrect() { - _player->ResurrectPlayer(0.5f,false, true); + _player->ResurrectPlayer(0.5f, true); _player->DurabilityLossAll(0.25f,true); diff --git a/src/game/Object.h b/src/game/Object.h index 45d86efaa..5fbe8a542 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -98,8 +98,8 @@ struct WorldLocation float y; float z; float o; - explicit WorldLocation(uint32 mapid = 0, float x = 0, float y = 0, float z = 0, float o = 0) - : mapid(mapid), x(x), y(y), z(z), o(o) {} + explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0) + : mapid(_mapid), x(_x), y(_y), z(_z), o(_o) {} WorldLocation(WorldLocation const &loc) : mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {} }; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a048cab07..bbfb1df4d 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -355,7 +355,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction ) sLog.outDebug( "AuctionWon body string : %s", msgAuctionWonBody.str().c_str() ); //prepare mail data... : - uint32 itemTextId = this->CreateItemText( msgAuctionWonBody.str() ); + uint32 itemTextId = CreateItemText( msgAuctionWonBody.str() ); // set owner to bidder (to prevent delete item with sender char deleting) // owner in `data` will set at mail receive and item extracting @@ -406,7 +406,7 @@ void ObjectMgr::SendAuctionSalePendingMail( AuctionEntry * auction ) sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); - uint32 itemTextId = this->CreateItemText( msgAuctionSalePendingBody.str() ); + uint32 itemTextId = CreateItemText( msgAuctionSalePendingBody.str() ); WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION); } @@ -438,7 +438,7 @@ void ObjectMgr::SendAuctionSuccessfulMail( AuctionEntry * auction ) sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); - uint32 itemTextId = this->CreateItemText( auctionSuccessfulBody.str() ); + uint32 itemTextId = CreateItemText( auctionSuccessfulBody.str() ); uint32 profit = auction->bid + auction->deposit - auctionCut; @@ -1470,7 +1470,7 @@ void ObjectMgr::LoadAuctions() aItem->deposit = fields[10].GetUInt32(); aItem->location = fields[11].GetUInt8(); //check if sold item exists - if ( this->GetAItem( aItem->item_guidlow ) ) + if ( GetAItem( aItem->item_guidlow ) ) { GetAuctionsMap( aItem->location )->AddAuction(aItem); } @@ -5068,13 +5068,8 @@ void ObjectMgr::SetHighestGuids() delete result; } - result = CharacterDatabase.Query( "SELECT MAX(id) FROM character_pet" ); - if( result ) - { - m_hiPetGuid = (*result)[0].GetUInt32()+1; - - delete result; - } + // pet guids are not saved to DB, set to 0 (pet guid != pet id) + m_hiPetGuid = 0; result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" ); if( result ) @@ -5137,6 +5132,44 @@ void ObjectMgr::SetHighestGuids() delete result; } + + result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); + if (result) + { + m_arenaTeamId = (*result)[0].GetUInt32()+1; + + delete result; + } + + result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); + if (result) + { + m_guildId = (*result)[0].GetUInt32()+1; + + delete result; + } +} + +uint32 ObjectMgr::GenerateArenaTeamId() +{ + ++m_arenaTeamId; + if(m_arenaTeamId>=0xFFFFFFFF) + { + sLog.outError("Arena team ids overflow!! Can't continue, shuting down server. "); + sWorld.m_stopEvent = true; + } + return m_arenaTeamId; +} + +uint32 ObjectMgr::GenerateGuildId() +{ + ++m_guildId; + if(m_guildId>=0xFFFFFFFF) + { + sLog.outError("Guild ids overflow!! Can't continue, shuting down server. "); + sWorld.m_stopEvent = true; + } + return m_guildId; } uint32 ObjectMgr::GenerateAuctionID() diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 7cbd62b47..59ff4e4cf 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -572,6 +572,8 @@ class ObjectMgr uint32 GenerateMailID(); uint32 GenerateItemTextID(); uint32 GeneratePetNumber(); + uint32 GenerateArenaTeamId(); + uint32 GenerateGuildId(); uint32 CreateItemText(std::string text); std::string GetItemText( uint32 id ) @@ -764,6 +766,8 @@ class ObjectMgr uint32 m_auctionid; uint32 m_mailid; uint32 m_ItemTextId; + uint32 m_arenaTeamId; + uint32 m_guildId; uint32 m_hiCharGuid; uint32 m_hiCreatureGuid; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 6c88b614b..fcbe055f2 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -449,7 +449,6 @@ void Pet::SavePetToDB(PetSaveMode mode) case PET_SAVE_AS_DELETED: { RemoveAllAuras(); - uint32 owner = GUID_LOPART(GetOwnerGUID()); DeleteFromDB(m_charmInfo->GetPetNumber()); break; } diff --git a/src/game/PetAI.h b/src/game/PetAI.h index f7fc9ac13..27b56c25f 100644 --- a/src/game/PetAI.h +++ b/src/game/PetAI.h @@ -37,7 +37,7 @@ class MANGOS_DLL_DECL PetAI : public CreatureAI void DamageTaken(Unit *done_by, uint32& /*damage*/) { AttackedBy(done_by); } void AttackedBy(Unit*); bool IsVisible(Unit *) const; - void JustDied(Unit* who) { _stopAttack(); } + void JustDied(Unit* /*who*/) { _stopAttack(); } void UpdateAI(const uint32); static int Permissible(const Creature *); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d3938c37e..a67909329 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -479,6 +479,8 @@ void Player::CleanupsBeforeDelete() bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ) { + //FIXME: outfitId not used in player creating + Object::_Create(guidlow, 0, HIGHGUID_PLAYER); m_name = name; @@ -1489,7 +1491,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // The player was ported to another map and looses the duel immediatly. // We have to perform this check before the teleport, otherwise the // ObjectAccessor won't find the flag. - if (duel && this->GetMapId()!=mapid) + if (duel && GetMapId()!=mapid) { GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); if (obj) @@ -1499,7 +1501,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // reset movement flags at teleport, because player will continue move with these flags after teleport SetUnitMovementFlags(0); - if ((this->GetMapId() == mapid) && (!m_transport)) + if ((GetMapId() == mapid) && (!m_transport)) { // prepare zone change detect uint32 old_zone = GetZoneId(); @@ -3526,7 +3528,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC uint32 pl_account = objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); - WorldSession::SendReturnToSender(MAIL_NORMAL, pl_account, guid, sender, subject, itemTextId, &mi, money, 0, mailTemplateId); + WorldSession::SendReturnToSender(MAIL_NORMAL, pl_account, guid, sender, subject, itemTextId, &mi, money, mailTemplateId); } while (resultMail->NextRow()); @@ -3655,13 +3657,14 @@ void Player::BuildPlayerRepop() void Player::SendDelayResponse(const uint32 ml_seconds) { + //FIXME: is this delay time arg really need? 50msec by default in code WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 ); data << (uint32)time(NULL); data << (uint32)0; GetSession()->SendPacket( &data ); } -void Player::ResurrectPlayer(float restore_percent, bool updateToWorld, bool applySickness) +void Player::ResurrectPlayer(float restore_percent, bool applySickness) { WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // remove spirit healer position data << uint32(-1); @@ -4192,7 +4195,7 @@ void Player::UpdateDefense() } } -void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply, bool affectStats) +void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) { if(modGroup >= BASEMOD_END || modType >= MOD_END) { @@ -5880,7 +5883,6 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor) uint64 victim_guid = 0; uint32 victim_rank = 0; - time_t now = time(NULL); // need call before fields update to have chance move yesterday data to appropriate fields before today data change. UpdateHonorFields(); @@ -6840,7 +6842,7 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy } if (roll_chance_f(chance)) - this->CastSpell(Target, spellInfo->Id, true, item); + CastSpell(Target, spellInfo->Id, true, item); } // item combat enchantments @@ -10510,8 +10512,6 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); - ItemPrototype const *pProto = pItem->GetProto(); - RemoveEnchantmentDurations(pItem); RemoveItemDurations(pItem); @@ -17725,7 +17725,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id ) if (pAbility->classmask && !(pAbility->classmask & classMask)) continue; - if (SpellEntry const* spellentry = sSpellStore.LookupEntry(pAbility->spellId)) + if (sSpellStore.LookupEntry(pAbility->spellId)) { // Ok need learn spell learnSpell(pAbility->spellId); @@ -18495,7 +18495,7 @@ void Player::SetCanBlock( bool value ) bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const { for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) - if(itr->pos == this->pos) + if(itr->pos == pos) return true; return false; diff --git a/src/game/Player.h b/src/game/Player.h index 9592a46be..8380339f8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1539,8 +1539,8 @@ class MANGOS_DLL_SPEC Player : public Unit void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } void SendUpdateToOutOfRangeGroupMembers(); - void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, this->GetGUID()); } - void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, this->GetGUID()); } + void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, GetGUID()); } + void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, GetGUID()); } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } static uint32 GetGuildIdFromDB(uint64 guid); @@ -1553,7 +1553,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) { SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId); - SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, this->GetGUID()); + SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, GetGUID()); } uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); } static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); @@ -1662,7 +1662,7 @@ class MANGOS_DLL_SPEC Player : public Unit void CreateCorpse(); void KillPlayer(); uint32 GetResurrectionSpellId(); - void ResurrectPlayer(float restore_percent, bool updateToWorld = true, bool applySickness = false); + void ResurrectPlayer(float restore_percent, bool applySickness = false); void BuildPlayerRepop(); void RepopAtGraveyard(); @@ -1786,7 +1786,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SetRegularAttackTime(); void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; } - void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply, bool affectStats = true); + void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply); float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const; float GetTotalBaseModValue(BaseModGroup modGroup) const; float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; } diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index d70d2e69c..2835ad2f2 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -59,7 +59,7 @@ bool PointMovementGenerator::Update(T &unit, const uint32 &diff) } template -void PointMovementGenerator::MovementInform(T &unit) +void PointMovementGenerator::MovementInform(T& /*unit*/) { } diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp index a46d3af2b..e09b8e8ee 100644 --- a/src/game/RandomMovementGenerator.cpp +++ b/src/game/RandomMovementGenerator.cpp @@ -38,8 +38,8 @@ RandomMovementGenerator::_setRandomLocation(Creature &creature) Map const* map = MapManager::Instance().GetBaseMap(mapid); // For 2D/3D system selection - bool is_land_ok = creature.canWalk(); - bool is_water_ok = creature.canSwim(); + //bool is_land_ok = creature.canWalk(); // not used? + //bool is_water_ok = creature.canSwim(); // not used? bool is_air_ok = creature.canFly(); const float angle = rand_norm()*(M_PI*2); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 888bf8757..d0dcd4f76 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -653,7 +653,7 @@ void Spell::FillTargetMap() for (std::list::iterator itr = tmpUnitMap.begin() ; itr != tmpUnitMap.end();) { - if(!CheckTarget(*itr, i, false )) + if (!CheckTarget (*itr, i)) { itr = tmpUnitMap.erase(itr); continue; @@ -3199,7 +3199,7 @@ void Spell::TriggerSpell() { for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) { - Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer); + Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); spell->prepare(&m_targets); // use original spell original targets } } @@ -3399,8 +3399,6 @@ uint8 Spell::CanCast(bool strict) m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ) { - bool okDoo = false; - SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id); if(lower==upper) @@ -4888,7 +4886,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() return(CURRENT_GENERIC_SPELL); } -bool Spell::CheckTarget( Unit* target, uint32 eff, bool hitPhase ) +bool Spell::CheckTarget( Unit* target, uint32 eff ) { // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF ) diff --git a/src/game/Spell.h b/src/game/Spell.h index f1b997712..b52f503ef 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -348,7 +348,7 @@ class Spell void SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap); Unit* SelectMagnetTarget(); - bool CheckTarget( Unit* target, uint32 eff, bool hitPhase ); + bool CheckTarget( Unit* target, uint32 eff ); void SendCastResult(uint8 result); void SendSpellStart(); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 56867fbe6..82ea197ab 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -165,10 +165,10 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS &Aura::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus - &Aura::HandleAuraHealing, //115 SPELL_AURA_MOD_HEALING + &Aura::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim &Aura::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT &Aura::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult - &Aura::HandleAuraHealingPct, //118 SPELL_AURA_MOD_HEALING_PCT + &Aura::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus &Aura::HandleUnused, //119 SPELL_AURA_SHARE_PET_TRACKING useless &Aura::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE &Aura::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY @@ -186,7 +186,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT &Aura::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT &Aura::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE - &Aura::HandleAuraHealingPct, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus + &Aura::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus &Aura::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE &Aura::HandleHaste, //138 SPELL_AURA_MOD_HASTE &Aura::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION @@ -215,7 +215,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA &Aura::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE &Aura::HandleUnused, //164 useless, only one test spell - &Aura::HandleAuraAttackPowerAttacker, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus + &Aura::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus &Aura::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT &Aura::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT &Aura::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus @@ -2257,6 +2257,10 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) void Aura::HandleAuraMounted(bool apply, bool Real) { + // only at real add/remove aura + if(!Real) + return; + if(apply) { CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); @@ -3579,7 +3583,7 @@ void Aura::HandleModTaunt(bool apply, bool Real) /*********************************************************/ /*** MODIFY SPEED ***/ /*********************************************************/ -void Aura::HandleAuraModIncreaseSpeed(bool apply, bool Real) +void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if(!Real) @@ -3588,7 +3592,7 @@ void Aura::HandleAuraModIncreaseSpeed(bool apply, bool Real) m_target->UpdateSpeed(MOVE_RUN, true); } -void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) +void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if(!Real) @@ -3627,7 +3631,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) m_target->UpdateSpeed(MOVE_FLY, true); } -void Aura::HandleAuraModIncreaseSwimSpeed(bool apply, bool Real) +void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if(!Real) @@ -3636,7 +3640,7 @@ void Aura::HandleAuraModIncreaseSwimSpeed(bool apply, bool Real) m_target->UpdateSpeed(MOVE_SWIM, true); } -void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) +void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if(!Real) @@ -3647,7 +3651,7 @@ void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) m_target->UpdateSpeed(MOVE_FLY, true); } -void Aura::HandleAuraModUseNormalSpeed(bool apply, bool Real) +void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove if(!Real) @@ -4327,7 +4331,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real) } } -void Aura::HandleModSpellDamagePercentFromStat(bool apply, bool Real) +void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4338,7 +4342,7 @@ void Aura::HandleModSpellDamagePercentFromStat(bool apply, bool Real) ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); } -void Aura::HandleModSpellHealingPercentFromStat(bool apply, bool Real) +void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4356,7 +4360,7 @@ void Aura::HandleAuraModDispelResist(bool apply, bool Real) m_target->CastSpell(m_target,44416,true,NULL,this,GetCasterGUID()); } -void Aura::HandleModSpellDamagePercentFromAttackPower(bool apply, bool Real) +void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4367,7 +4371,7 @@ void Aura::HandleModSpellDamagePercentFromAttackPower(bool apply, bool Real) ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); } -void Aura::HandleModSpellHealingPercentFromAttackPower(bool apply, bool Real) +void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4376,7 +4380,7 @@ void Aura::HandleModSpellHealingPercentFromAttackPower(bool apply, bool Real) ((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); } -void Aura::HandleModHealingDone(bool apply, bool Real) +void Aura::HandleModHealingDone(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4416,7 +4420,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real) } } -void Aura::HandleAuraModResistenceOfStatPercent(bool apply, bool Real) +void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -4551,7 +4555,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking ((Player*)m_target)->UpdateManaRegen(); } -void Aura::HandleModPowerRegenPCT(bool apply, bool Real) +void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if(!Real) @@ -4565,7 +4569,7 @@ void Aura::HandleModPowerRegenPCT(bool apply, bool Real) ((Player*)m_target)->UpdateManaRegen(); } -void Aura::HandleModManaRegen(bool apply, bool Real) +void Aura::HandleModManaRegen(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if(!Real) @@ -4666,7 +4670,7 @@ void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool Real) /*** FIGHT ***/ /********************************/ -void Aura::HandleAuraModParryPercent(bool apply, bool Real) +void Aura::HandleAuraModParryPercent(bool /*apply*/, bool Real) { if(m_target->GetTypeId()!=TYPEID_PLAYER) return; @@ -4674,7 +4678,7 @@ void Aura::HandleAuraModParryPercent(bool apply, bool Real) ((Player*)m_target)->UpdateParryPercentage(); } -void Aura::HandleAuraModDodgePercent(bool apply, bool Real) +void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool Real) { if(m_target->GetTypeId()!=TYPEID_PLAYER) return; @@ -4683,7 +4687,7 @@ void Aura::HandleAuraModDodgePercent(bool apply, bool Real) //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount)); } -void Aura::HandleAuraModBlockPercent(bool apply, bool Real) +void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool Real) { if(m_target->GetTypeId()!=TYPEID_PLAYER) return; @@ -4692,7 +4696,7 @@ void Aura::HandleAuraModBlockPercent(bool apply, bool Real) //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount)); } -void Aura::HandleAuraModRegenInterrupt(bool apply, bool Real) +void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if(!Real) @@ -4760,7 +4764,7 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real) } } -void Aura::HandleModSpellCritChanceShool(bool apply, bool Real) +void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) { // spells required only Real aura add/remove if(!Real) @@ -4842,39 +4846,6 @@ void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real) m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); } -void Aura::HandleAuraAttackPowerAttacker(bool apply, bool Real) -{ - // spells required only Real aura add/remove - if(!Real) - return; - Unit *caster = GetCaster(); - - if (!caster) - return; - - // Hunter's Mark - if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL) - { - // Check Improved Hunter's Mark bonus on caster - Unit::AuraList const& mOverrideClassScript = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i) - { - Modifier* mod = (*i)->GetModifier(); - // mproved Hunter's Mark script from 5236 to 5240 - if (mod->m_miscvalue >= 5236 && mod->m_miscvalue <= 5240) - { - // Get amount of ranged bonus for this spell.. - int32 ranged_bonus = caster->CalculateSpellDamage(m_spellProto, 1, m_spellProto->EffectBasePoints[1], m_target); - // Set melee attack power bonus % from ranged depends from Improved mask aura - m_modifier.m_amount = mod->m_amount * ranged_bonus / 100; - m_currentBasePoints = m_modifier.m_amount; - break; - } - } - return; - } -} - void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real) { //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1 @@ -5322,7 +5293,7 @@ void Aura::HandleForceMoveForward(bool apply, bool Real) m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); } -void Aura::HandleAuraModExpertise(bool apply, bool Real) +void Aura::HandleAuraModExpertise(bool /*apply*/, bool Real) { if(m_target->GetTypeId() != TYPEID_PLAYER) return; @@ -5347,17 +5318,6 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply); } -//HandleNoImmediateEffect auras implementation to support new stat system -void Aura::HandleAuraHealing(bool apply, bool Real) -{ - //m_target->HandleStatModifier(UNIT_MOD_HEALING, TOTAL_VALUE, float(m_modifier.m_amount), apply); -} - -void Aura::HandleAuraHealingPct(bool apply, bool Real) -{ - //m_target->HandleStatModifier(UNIT_MOD_HEALING, TOTAL_PCT, float(m_modifier.m_amount), apply); -} - void Aura::HandleShieldBlockValue(bool apply, bool Real) { BaseModType modType = FLAT_MOD; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index c8679f9f4..e6ebff7ec 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -183,15 +183,12 @@ class MANGOS_DLL_SPEC Aura void HandleAuraAllowFlight(bool Apply, bool Real); void HandleModRating(bool apply, bool Real); void HandleModTargetResistance(bool apply, bool Real); - void HandleAuraAttackPowerAttacker(bool apply, bool Real); void HandleAuraModAttackPowerPercent(bool apply, bool Real); void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real); void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real); void HandleSpiritOfRedemption(bool apply, bool Real); - void HandleAuraHealingPct(bool apply, bool Real); void HandleModManaRegen(bool apply, bool Real); void HandleComprehendLanguage(bool apply, bool Real); - void HandleAuraHealing(bool apply, bool Real); void HandleShieldBlockValue(bool apply, bool Real); void HandleModSpellCritChanceShool(bool apply, bool Real); void HandleAuraRetainComboPoints(bool apply, bool Real); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 35237613a..21a4a820e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2218,7 +2218,7 @@ void Spell::EffectPowerDrain(uint32 i) m_caster->ModifyPower(POWER_MANA,gain); //send log - m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA,false); + m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA); } } @@ -2234,7 +2234,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex) case 23333: // Pickup Horde Flag /*do not uncomment . if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Send Event Horde Flag Picked Up"); break; /* not used : @@ -2247,7 +2247,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex) case 23335: // Pickup Alliance Flag /*do not uncomment ... (it will cause crash, because of null targetobject!) anyway this is a bad way to call that event, because it would cause recursion if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Send Event Alliance Flag Picked Up"); break; /* not used : @@ -2258,18 +2258,18 @@ void Spell::EffectSendEvent(uint32 EffectIndex) break; case 23385: // Alliance Flag Returns if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Alliance Flag Returned"); break; case 23386: // Horde Flag Returns if(bg->GetTypeID()==BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); sLog.outDebug("Horde Flag Returned"); break;*/ case 34976: /* if(bg->GetTypeID()==BATTLEGROUND_EY) - bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); + bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget); */ break; default: @@ -3691,13 +3691,13 @@ void Spell::EffectAddHonor(uint32 /*i*/) if(unitTarget->GetTypeId() != TYPEID_PLAYER) return; - sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, this->damage, ((Player*)unitTarget)->GetGUIDLow()); + sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow()); // TODO: find formula for honor reward based on player's level! // now fixed only for level 70 players: if (((Player*)unitTarget)->getLevel() == 70) - ((Player*)unitTarget)->RewardHonor(NULL, 1, this->damage); + ((Player*)unitTarget)->RewardHonor(NULL, 1, damage); } void Spell::EffectTradeSkill(uint32 /*i*/) @@ -5383,7 +5383,7 @@ void Spell::EffectSummonObject(uint32 i) m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); } -void Spell::EffectResurrect(uint32 i) +void Spell::EffectResurrect(uint32 /*effIndex*/) { if(!unitTarget) return; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 02e2cdfa1..6f7feaa48 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1648,8 +1648,6 @@ void SpellMgr::LoadSpellLearnSkills() dbc_node.value = (entry->EffectBasePoints[i]+1)*75; dbc_node.maxvalue = (entry->EffectBasePoints[i]+1)*75; - SpellLearnSkillNode const* db_node = GetSpellLearnSkill(spell); - mSpellLearnSkills[spell] = dbc_node; ++dbc_count; break; diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 31226900d..5c708bf0c 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -35,7 +35,7 @@ Totem::Totem() : Creature() void Totem::Update( uint32 time ) { Unit *owner = GetOwner(); - if (!owner || !owner->isAlive() || !this->isAlive()) + if (!owner || !owner->isAlive() || !isAlive()) { UnSummon(); // remove self return; @@ -89,7 +89,7 @@ void Totem::UnSummon() CombatStop(); RemoveAurasDueToSpell(GetSpell()); - Unit *owner = this->GetOwner(); + Unit *owner = GetOwner(); if (owner) { // clear owenr's totem slot @@ -130,11 +130,11 @@ void Totem::SetOwner(uint64 guid) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); - Unit *owner = this->GetOwner(); + Unit *owner = GetOwner(); if (owner) { - this->setFaction(owner->getFaction()); - this->SetLevel(owner->getLevel()); + setFaction(owner->getFaction()); + SetLevel(owner->getLevel()); } } diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 26faa9350..5bcbb5f23 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -465,7 +465,7 @@ bool Transport::AddPassenger(Player* passenger) { if (m_passengers.find(passenger) == m_passengers.end()) { - sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), this->m_name.c_str()); + sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), m_name.c_str()); m_passengers.insert(passenger); } return true; @@ -475,7 +475,7 @@ bool Transport::RemovePassenger(Player* passenger) { if (m_passengers.find(passenger) != m_passengers.end()) { - sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), this->m_name.c_str()); + sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), m_name.c_str()); m_passengers.erase(passenger); } return true; @@ -499,7 +499,7 @@ void Transport::Update(uint32 /*p_time*/) } else { - //MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, this->m_orientation); + //MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_orientation); Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); } @@ -515,13 +515,13 @@ void Transport::Update(uint32 /*p_time*/) m_nextNodeTime = m_curr->first; if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) - sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str()); + sLog.outDetail(" ************ BEGIN ************** %s", m_name.c_str()); // MapManager::Instance().GetMap(m_curr->second.mapid)->Add(&this); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Remove((GameObject *)this, false); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Add((GameObject *)this); // -> // ->Add(t); if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) - sLog.outDetail("%s moved to %f %f %f %d", this->m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); + sLog.outDetail("%s moved to %f %f %f %d", m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); } } diff --git a/src/game/Traveller.h b/src/game/Traveller.h index a1479d93c..8a7a85d3d 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -37,7 +37,7 @@ struct MANGOS_DLL_DECL Traveller Traveller(const Traveller &obj) : i_traveller(obj) {} Traveller& operator=(const Traveller &obj) { - this->~Traveller(); + ~Traveller(); new (this) Traveller(obj); return *this; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 808a69f01..80fb5e76e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1102,8 +1102,6 @@ void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *da // Physical Damage if ( GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_NORMAL ) { - uint32 modDamage=*damage; - // apply spellmod to Done damage if(Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DAMAGE, *damage); @@ -1388,7 +1386,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage { if(!this || !pVictim) return 0; - if(!this->isAlive() || !pVictim->isAlive()) + if(!isAlive() || !pVictim->isAlive()) return 0; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID); @@ -4589,7 +4587,7 @@ void Unit::CastMeleeProcDamageAndSpell(Unit* pVictim, uint32 damage, SpellSchool ProcDamageAndSpell(pVictim, procAttacker, procVictim, damage, damageSchoolMask, spellCasted, isTriggeredSpell, attType); } -bool Unit::HandleHasteAuraProc(Unit *pVictim, SpellEntry const *hasteSpell, uint32 /*effIndex*/, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 cooldown) +bool Unit::HandleHasteAuraProc(Unit *pVictim, SpellEntry const *hasteSpell, uint32 /*effIndex*/, uint32 damage, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 cooldown) { Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; @@ -6237,7 +6235,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if(!pVictim || !pVictim->isAlive()) return false; - uint32 spell = 0; switch(triggeredByAura->GetSpellProto()->Id) { case 20186: @@ -6267,7 +6264,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return false; // overwrite non existing triggered spell call in spell.dbc - uint32 spell = 0; switch(triggeredByAura->GetSpellProto()->Id) { case 20185: @@ -6467,7 +6463,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB return true; } -bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown) +bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 /*damage*/, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown) { if(!pVictim || !pVictim->isAlive()) return false; @@ -7180,7 +7176,7 @@ void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool c SendMessageToSet(&data, true); } -void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype, bool critical) +void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype) { WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1)); data.append(pVictim->GetPackGUID()); @@ -8125,7 +8121,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT int32 TakenFlatBenefit = 0; // ..done (for creature type by mask) in taken - AuraList const& mDamageDoneCreature = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); + AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) DoneFlatBenefit += (*i)->GetModifier()->m_amount; @@ -8193,7 +8189,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT // SPELL_AURA_MOD_DAMAGE_PERCENT_DONE included in weapon damage // SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT included in weapon damage - AuraList const& mDamageDoneVersus = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); + AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; @@ -8733,7 +8729,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) //Visible distance is modified by //-Level Diff (every level diff = 1.0f in visible distance) - visibleDistance += int32(u->getLevelForTarget(this)) - int32(this->getLevelForTarget(u)); + visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u)); //This allows to check talent tree and will add addition stealth dependent on used points) int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL); @@ -10407,7 +10403,7 @@ void Unit::StopMoving() // send explicit stop packet // rely on vmaps here because for exemple stormwind is in air - float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); + //float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); //if (fabs(GetPositionZ() - z) < 2.0f) // Relocate(GetPositionX(), GetPositionY(), z); Relocate(GetPositionX(), GetPositionY(),GetPositionZ()); @@ -10889,9 +10885,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, this->GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, this->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,this->getFaction()); + pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()); + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel(); diff --git a/src/game/Unit.h b/src/game/Unit.h index de5d6f1b3..decd113a1 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -946,7 +946,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject bool isInAccessablePlaceFor(Creature const* c) const; void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false); - void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype, bool critical = false); + void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype); uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true); void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); diff --git a/src/game/World.cpp b/src/game/World.cpp index 83b222122..e2713596e 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -209,7 +209,6 @@ World::AddSession_ (WorldSession* s) uint32 Sessions = GetActiveAndQueuedSessionCount (); uint32 pLimit = GetPlayerAmountLimit (); uint32 QueueSize = GetQueueSize (); //number of players in the queue - bool inQueue = false; //so we don't count the user trying to //login as a session and queue the socket that we are using --Sessions; diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 949af8703..1b2269e2b 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -165,7 +165,7 @@ class MANGOS_DLL_SPEC WorldSession //mail //used with item_page table bool SendItemInfo( uint32 itemid, WorldPacket data ); - static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint32 COD, uint16 mailTemplateId = 0); + static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0); static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0); //auction diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index be9a05fe8..804ec735a 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -81,7 +81,7 @@ m_Seed (static_cast (rand32 ())), m_OverSpeedPings (0), m_LastPingTime (ACE_Time_Value::zero) { - this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } WorldSocket::~WorldSocket (void) @@ -92,9 +92,9 @@ WorldSocket::~WorldSocket (void) if (m_OutBuffer) m_OutBuffer->release (); - this->closing_ = true; + closing_ = true; - this->peer ().close (); + peer ().close (); WorldPacket* pct; while (m_PacketQueue.dequeue_head (pct) == 0) @@ -103,7 +103,7 @@ WorldSocket::~WorldSocket (void) bool WorldSocket::IsClosed (void) const { - return this->closing_; + return closing_; } void WorldSocket::CloseSocket (void) @@ -111,12 +111,12 @@ void WorldSocket::CloseSocket (void) { ACE_GUARD (LockType, Guard, m_OutBufferLock); - if (this->closing_) + if (closing_) return; - this->closing_ = true; + closing_ = true; - this->peer ().close_writer (); + peer ().close_writer (); } { @@ -135,7 +135,7 @@ int WorldSocket::SendPacket (const WorldPacket& pct) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - if (this->closing_) + if (closing_) return -1; // Dump outgoing packet. @@ -180,12 +180,12 @@ int WorldSocket::SendPacket (const WorldPacket& pct) long WorldSocket::AddReference (void) { - return static_cast (this->add_reference ()); + return static_cast (add_reference ()); } long WorldSocket::RemoveReference (void) { - return static_cast (this->remove_reference ()); + return static_cast (remove_reference ()); } int WorldSocket::open (void *a) @@ -210,7 +210,7 @@ int WorldSocket::open (void *a) // Store peer address. ACE_INET_Addr remote_addr; - if (this->peer ().get_remote_addr (remote_addr) == -1) + if (peer ().get_remote_addr (remote_addr) == -1) { sLog.outError ("WorldSocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; @@ -226,42 +226,42 @@ int WorldSocket::open (void *a) return -1; // Register with ACE Reactor - if (this->reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) + if (reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { sLog.outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } // reactor takes care of the socket from now on - this->remove_reference (); + remove_reference (); return 0; } int WorldSocket::close (int) { - this->shutdown (); + shutdown (); - this->closing_ = true; + closing_ = true; - this->remove_reference (); + remove_reference (); return 0; } int WorldSocket::handle_input (ACE_HANDLE) { - if (this->closing_) + if (closing_) return -1; - switch (this->handle_input_missing_data ()) + switch (handle_input_missing_data ()) { case -1 : { if ((errno == EWOULDBLOCK) || (errno == EAGAIN)) { - return this->Update (); // interesting line ,isnt it ? + return Update (); // interesting line ,isnt it ? } DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); @@ -279,7 +279,7 @@ int WorldSocket::handle_input (ACE_HANDLE) case 1: return 1; default: - return this->Update (); // another interesting line ;) + return Update (); // another interesting line ;) } ACE_NOTREACHED(return -1); @@ -289,18 +289,18 @@ int WorldSocket::handle_output (ACE_HANDLE) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - if (this->closing_) + if (closing_) return -1; const size_t send_len = m_OutBuffer->length (); if (send_len == 0) - return this->cancel_wakeup_output (Guard); + return cancel_wakeup_output (Guard); #ifdef MSG_NOSIGNAL - ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); + ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); #else - ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len); + ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len); #endif // MSG_NOSIGNAL if (n == 0) @@ -308,7 +308,7 @@ int WorldSocket::handle_output (ACE_HANDLE) else if (n == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); return -1; } @@ -319,16 +319,16 @@ int WorldSocket::handle_output (ACE_HANDLE) // move the data to the base of the buffer m_OutBuffer->crunch (); - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); } else //now n == send_len { m_OutBuffer->reset (); if (!iFlushPacketQueue ()) - return this->cancel_wakeup_output (Guard); + return cancel_wakeup_output (Guard); else - return this->schedule_wakeup_output (Guard); + return schedule_wakeup_output (Guard); } ACE_NOTREACHED (return 0); @@ -340,10 +340,10 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) { ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - this->closing_ = true; + closing_ = true; if (h == ACE_INVALID_HANDLE) - this->peer ().close_writer (); + peer ().close_writer (); } // Critical section @@ -358,13 +358,13 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) int WorldSocket::Update (void) { - if (this->closing_) + if (closing_) return -1; if (m_OutActive || m_OutBuffer->length () == 0) return 0; - return this->handle_output (this->get_handle ()); + return handle_output (get_handle ()); } int WorldSocket::handle_input_header (void) @@ -416,7 +416,7 @@ int WorldSocket::handle_input_payload (void) ACE_ASSERT (m_Header.space () == 0); ACE_ASSERT (m_RecvWPct != NULL); - const int ret = this->ProcessIncoming (m_RecvWPct); + const int ret = ProcessIncoming (m_RecvWPct); m_RecvPct.base (NULL, 0); m_RecvPct.reset (); @@ -448,7 +448,7 @@ int WorldSocket::handle_input_missing_data (void) const size_t recv_size = message_block.space (); - const ssize_t n = this->peer ().recv (message_block.wr_ptr (), + const ssize_t n = peer ().recv (message_block.wr_ptr (), recv_size); if (n <= 0) @@ -474,7 +474,7 @@ int WorldSocket::handle_input_missing_data (void) } //we just recieved nice new header - if (this->handle_input_header () == -1) + if (handle_input_header () == -1) { ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); return -1; @@ -509,7 +509,7 @@ int WorldSocket::handle_input_missing_data (void) } //just recieved fresh new payload - if (this->handle_input_payload () == -1) + if (handle_input_payload () == -1) { ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); return -1; @@ -528,7 +528,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) g.release (); - if (this->reactor ()->cancel_wakeup + if (reactor ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard @@ -548,7 +548,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) g.release (); - if (this->reactor ()->schedule_wakeup + if (reactor ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { sLog.outError ("WorldSocket::schedule_wakeup_output"); @@ -567,7 +567,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct) const ACE_UINT16 opcode = new_pct->GetOpcode (); - if (this->closing_) + if (closing_) return -1; // dump recieved packet @@ -854,7 +854,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) return -1; } - std::string address = this->GetRemoteAddress (); + std::string address = GetRemoteAddress (); DEBUG_LOG ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str (), @@ -881,7 +881,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) // In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec ACE_OS::sleep (ACE_Time_Value (0, 10000)); - sWorld.AddSession (this->m_Session); + sWorld.AddSession (m_Session); // Create and send the Addon packet if (sAddOnHandler.BuildAddonPacket (&recvPacket, &SendAddonPacked)) @@ -949,14 +949,14 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked," " address = %s", - this->GetRemoteAddress ().c_str ()); + GetRemoteAddress ().c_str ()); return -1; } } WorldPacket packet (SMSG_PONG, 4); packet << ping; - return this->SendPacket (packet); + return SendPacket (packet); } int WorldSocket::iSendPacket (const WorldPacket& pct) diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index a7558e354..9bb11f8fe 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -79,8 +79,8 @@ class ReactorRunnable : protected ACE_Task_Base virtual ~ReactorRunnable () { - this->Stop (); - this->Wait (); + Stop (); + Wait (); if (m_Reactor) delete m_Reactor; @@ -96,7 +96,7 @@ class ReactorRunnable : protected ACE_Task_Base if (m_ThreadId != -1) return -1; - return (m_ThreadId = this->activate ()); + return (m_ThreadId = activate ()); } void Wait () { ACE_Task_Base::wait (); } @@ -278,7 +278,7 @@ WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address) if (!sLog.IsOutDebug ()) ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); - if (this->StartReactiveIO (port, address) == -1) + if (StartReactiveIO (port, address) == -1) return -1; return 0; @@ -301,7 +301,7 @@ WorldSocketMgr::StopNetwork () m_NetThreads[i].Stop (); } - this->Wait (); + Wait (); } void diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 60c225376..b81ad0a63 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -126,7 +126,7 @@ bool ChatHandler::HandleBuyErrorCommand(const char* args) return true; } -bool ChatHandler::HandleSendOpcodeCommand(const char* args) +bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) { Unit *unit = getSelectedUnit(); if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) @@ -267,7 +267,7 @@ bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args) return true; } -bool ChatHandler::HandleGetLootRecipient(const char* args) +bool ChatHandler::HandleGetLootRecipient(const char* /*args*/) { Creature* target = getSelectedCreature(); if(!target) diff --git a/src/shared/vmap/AABSPTree.h b/src/shared/vmap/AABSPTree.h index 7a5488eb9..ad615e58c 100644 --- a/src/shared/vmap/AABSPTree.h +++ b/src/shared/vmap/AABSPTree.h @@ -1538,80 +1538,6 @@ public: members.append(temp[i].handle->value); } } - - - /** - C++ STL style iterator variable. See begin(). - Overloads the -> (dereference) operator, so this acts like a pointer - to the current member. - */ - class Iterator { - private: - friend class AABSPTree; - - Iterator(const typename Table::Iterator& it) : it(it) {} - - public: - - inline bool operator!=(const Iterator& other) const { - return !(*this == other); - } - - bool operator==(const Iterator& other) const { - return it == other.it; - } - - /** - Pre increment. - */ - Iterator& operator++() { - ++it; - return *this; - } - - private: - /** - Post increment (slower than preincrement). Intentionally unimplemented to prevent slow code. - */ - Iterator operator++(int);/* { - Iterator old = *this; - ++(*this); - return old; - }*/ - public: - - const T& operator*() const { - return it->key.handle->value; - } - - T* operator->() const { - return &(it->key.handle->value); - } - - operator T*() const { - return &(it->key.handle->value); - } - }; - - - /** - C++ STL style iterator method. Returns the first member. - Use preincrement (++entry) to get to the next element (iteration - order is arbitrary). - Do not modify the set while iterating. - */ - Iterator begin() const { - return Iterator(memberTable.begin()); - } - - - /** - C++ STL style iterator method. Returns one after the last iterator - element. - */ - Iterator end() const { - return Iterator(memberTable.end()); - } }; } diff --git a/win/VC71/game.vcproj b/win/VC71/game.vcproj index 72bc8597c..4edea3afb 100644 --- a/win/VC71/game.vcproj +++ b/win/VC71/game.vcproj @@ -587,9 +587,6 @@ - - diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index 5e9f02540..0cf8da463 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -954,10 +954,6 @@ RelativePath="..\..\src\game\Guild.h" > - - diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 476ce175b..97d4d01d5 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -956,10 +956,6 @@ RelativePath="..\..\src\game\Guild.h" > - -