diff --git a/contrib/git_id/.gitignore b/contrib/git_id/.gitignore new file mode 100644 index 000000000..a7a9e65c6 --- /dev/null +++ b/contrib/git_id/.gitignore @@ -0,0 +1,19 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# +# Extractor generated files at Windows build +# + +*.bsc +*.ncb +*.pdb +*.suo +Debug +Release +*.user diff --git a/contrib/git_id/git_id.cpp b/contrib/git_id/git_id.cpp new file mode 100644 index 000000000..d6c98f2fe --- /dev/null +++ b/contrib/git_id/git_id.cpp @@ -0,0 +1,219 @@ +#include +#include +#include +#include +#include +#include +#include "../../src/framework/Platform/CompilerDefs.h" + +#if PLATFORM == PLATFORM_WINDOWS +#include +#define popen _popen +#define pclose _pclose +#define snprintf _snprintf +#pragma warning (disable:4996) +#else +#include +#endif + +#define NUM_REMOTES 2 + +char remotes[NUM_REMOTES][256] = { + "git@github.com:mangos/mangos.git", + "git://github.com/mangos/mangos.git" +}; + +char origins[NUM_REMOTES][256]; +int rev; +char head_message[16384]; +char write_file[2048]; + +char buffer[256]; +FILE *cmd_pipe; + +bool allow_replace = false; +bool local = false; + +bool find_path() +{ + char cur_path[2048], *ptr; + getcwd(cur_path, 2048); + int len = strnlen(cur_path, 2048); + + if(cur_path[len-1] == '/' || cur_path[len-1] == '\\') + { + // we're in root, don't bother + return false; + } + + // don't count the root + int count_fwd = 0, count_back = 0; + for(ptr = cur_path-1; ptr = strchr(ptr+1, '/'); count_fwd++); + for(ptr = cur_path-1; ptr = strchr(ptr+1, '\\'); count_back++); + int count = std::max(count_fwd, count_back); + + char prefix[2048] = "", path[2048]; + for(int i = 0; i < count; i++) + { + snprintf(path, 2048, "%s.git", prefix); + if(0 == chdir(path)) + { + chdir(cur_path); + snprintf(write_file, 2048, "%ssrc/shared/revision_nr.h", prefix); + return true; + } + strncat(prefix, "../", 2048); + } + + return false; +} + +bool find_origin() +{ + if( (cmd_pipe = popen( "git remote -v", "rt" )) == NULL ) + return false; + + bool ret = false; + while(fgets(buffer, 256, cmd_pipe)) + { + char name[256], remote[256]; + sscanf(buffer, "%s %s", name, remote); + for(int i = 0; i < NUM_REMOTES; i++) + { + if(strcmp(remote, remotes[i]) == 0) + { + strncpy(origins[i], name, 256); + ret = true; + } + } + } + pclose(cmd_pipe); + return ret; +} + +int get_rev(const char *from_msg) +{ + // accept only the rev number format, not the sql update format + char nr_str[256]; + if(sscanf(from_msg, "[%[0123456789]]", nr_str) != 1) return 0; + if(from_msg[strlen(nr_str)+1] != ']') return 0; + return atoi(nr_str); +} + +bool find_rev() +{ + // find the highest rev number on either of the remotes + for(int i = 0; i < NUM_REMOTES; i++) + { + if(!local && !origins[i][0]) continue; + + char cmd[512]; + if(local) sprintf(cmd, "git log HEAD --pretty=\"format:%%s\""); + else sprintf(cmd, "git log %s/master --pretty=\"format:%%s\"", origins[i]); + if( (cmd_pipe = popen( cmd, "rt" )) == NULL ) + continue; + + int nr; + while(fgets(buffer, 256, cmd_pipe)) + { + nr = get_rev(buffer); + if(nr >= rev) + rev = nr+1; + } + pclose(cmd_pipe); + } + + return rev > 0; +} + +std::string generateHeader(char const* rev_str) +{ + std::ostringstream newData; + newData << "#ifndef __REVISION_NR_H__" << std::endl; + newData << "#define __REVISION_NR_H__" << std::endl; + newData << " #define REVISION_NR \"" << rev_str << "\"" << std::endl; + newData << "#endif // __REVISION_NR_H__" << std::endl; + return newData.str(); +} + +bool write_rev() +{ + char rev_str[256]; + sprintf(rev_str, "%d", rev); + std::string header = generateHeader(rev_str); + + if(FILE* OutputFile = fopen(write_file,"wb")) + { + fprintf(OutputFile,"%s", header.c_str()); + fclose(OutputFile); + return true; + } + + return false; +} + +bool find_head_msg() +{ + if( (cmd_pipe = popen( "git log -n 1 --pretty=\"format:%s%n%n%b\"", "rt" )) == NULL ) + return false; + + int poz = 0; + while(poz < 16384-1 && EOF != (head_message[poz++] = fgetc(cmd_pipe))); + head_message[poz-1] = '\0'; + + pclose(cmd_pipe); + + if(get_rev(head_message)) + { + if(!allow_replace) return false; + // skip the rev number in the commit + char *p = strchr(head_message, ']'), *q = head_message; + assert(p && *(p+1)); + p+=2; + while(*p) *q = *p, p++, q++; + *q = 0; + return true; + } + + return true; +} + +bool amend_commit() +{ + char cmd[512]; + sprintf(cmd, "git commit --amend -F- %s", write_file); + if( (cmd_pipe = popen( cmd, "wt" )) == NULL ) + return false; + + fprintf(cmd_pipe, "[%d] %s", rev, head_message); + pclose(cmd_pipe); + + return true; +} + +int main(int argc, char *argv[]) +{ + for(int i = 1; i < argc; i++) + { + if(argv[i] == NULL) continue; + if(strncmp(argv[i], "-r", 2) == 0) + allow_replace = true; + if(strncmp(argv[i], "-l", 2) == 0) + local = true; + if(strncmp(argv[i], "-h", 2) == 0) + { + + } + } + + if(!find_path()) { printf("ERROR: can't find path\n"); return 1; } + if(!local && !find_origin()) { printf("ERROR: can't find origin\n"); return 1; } + if(!find_rev()) { printf("ERROR: can't find rev\n"); return 1; } + if(!find_head_msg()) { printf("ERROR: can't find head message\n"); return 1; } + if(!write_rev()) { printf("ERROR: can't write revision_nr.h\n"); return 1; } + if(!amend_commit()) { printf("ERROR: can't ammend commit\n"); return 1; } + + printf("Generated rev %d\n", rev); + + return 0; +} \ No newline at end of file diff --git a/contrib/git_id/git_id.sln b/contrib/git_id/git_id.sln new file mode 100644 index 000000000..2decdb34c --- /dev/null +++ b/contrib/git_id/git_id.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "git_id", "git_id.vcproj", "{AD81BF86-050B-4605-8AF2-03C01967D784}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AD81BF86-050B-4605-8AF2-03C01967D784}.Debug|Win32.ActiveCfg = Debug|Win32 + {AD81BF86-050B-4605-8AF2-03C01967D784}.Debug|Win32.Build.0 = Debug|Win32 + {AD81BF86-050B-4605-8AF2-03C01967D784}.Release|Win32.ActiveCfg = Release|Win32 + {AD81BF86-050B-4605-8AF2-03C01967D784}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/contrib/git_id/git_id.vcproj b/contrib/git_id/git_id.vcproj new file mode 100644 index 000000000..345c69f08 --- /dev/null +++ b/contrib/git_id/git_id.vcproj @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sql/characters.sql b/sql/characters.sql index 5683ee52b..4c6bfed49 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -15,6 +15,26 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Table structure for table `character_db_version` +-- + +DROP TABLE IF EXISTS `character_db_version`; +CREATE TABLE `character_db_version` ( + `required_2008_11_07_03_characters_guild_bank_tab` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `character_db_version` +-- + +LOCK TABLES `character_db_version` WRITE; +/*!40000 ALTER TABLE `character_db_version` DISABLE KEYS */; +INSERT INTO `character_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `character_db_version` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `arena_team` -- @@ -853,7 +873,7 @@ CREATE TABLE `guild_bank_tab` ( `TabId` tinyint(1) unsigned NOT NULL default '0', `TabName` varchar(100) NOT NULL default '', `TabIcon` varchar(100) NOT NULL default '', - `TabText` varchar(500) NOT NULL default '', + `TabText` text, PRIMARY KEY (`guildid`,`TabId`), KEY `guildid_key` (`guildid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql/mangos.sql b/sql/mangos.sql index 00d75513d..74ab26a2f 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -15,6 +15,27 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Table structure for table `db_version` +-- + +DROP TABLE IF EXISTS `db_version`; +CREATE TABLE `db_version` ( + `version` varchar(120) default NULL, + `required_2008_11_01_02_mangos_command` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; + +-- +-- Dumping data for table `db_version` +-- + +LOCK TABLES `db_version` WRITE; +/*!40000 ALTER TABLE `db_version` DISABLE KEYS */; +INSERT INTO `db_version` VALUES +('Mangos default database.',NULL); +/*!40000 ALTER TABLE `db_version` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `areatrigger_involvedrelation` -- @@ -790,27 +811,6 @@ LOCK TABLES `creature_template_addon` WRITE; /*!40000 ALTER TABLE `creature_template_addon` ENABLE KEYS */; UNLOCK TABLES; --- --- Table structure for table `db_version` --- - -DROP TABLE IF EXISTS `db_version`; -CREATE TABLE `db_version` ( - `version` varchar(120) default NULL, - `required_2008_10_29_03_mangos_db_version` bit(1) default NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; - --- --- Dumping data for table `db_version` --- - -LOCK TABLES `db_version` WRITE; -/*!40000 ALTER TABLE `db_version` DISABLE KEYS */; -INSERT INTO `db_version` VALUES -('Mangos default database.',NULL); -/*!40000 ALTER TABLE `db_version` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Table structure for table `disenchant_loot_template` -- diff --git a/sql/realmd.sql b/sql/realmd.sql index 40faf349c..b2b881499 100644 --- a/sql/realmd.sql +++ b/sql/realmd.sql @@ -15,6 +15,26 @@ /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Table structure for table `realmd_db_version` +-- + +DROP TABLE IF EXISTS `realmd_db_version`; +CREATE TABLE `realmd_db_version` ( + `required_2008_11_07_04_realmd_account` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `realmd_db_version` +-- + +LOCK TABLES `realmd_db_version` WRITE; +/*!40000 ALTER TABLE `realmd_db_version` DISABLE KEYS */; +INSERT INTO `realmd_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `realmd_db_version` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `account` -- @@ -28,7 +48,7 @@ CREATE TABLE `account` ( `sessionkey` longtext, `v` longtext, `s` longtext, - `email` varchar(320) NOT NULL default '', + `email` text, `joindate` timestamp NOT NULL default CURRENT_TIMESTAMP, `last_ip` varchar(30) NOT NULL default '127.0.0.1', `failed_logins` int(11) unsigned NOT NULL default '0', diff --git a/sql/updates/2008_11_07_01_characters_character_db_version.sql b/sql/updates/2008_11_07_01_characters_character_db_version.sql new file mode 100644 index 000000000..2248fbbb5 --- /dev/null +++ b/sql/updates/2008_11_07_01_characters_character_db_version.sql @@ -0,0 +1,19 @@ +-- +-- Table structure for table `character_db_version` +-- + +DROP TABLE IF EXISTS `character_db_version`; +CREATE TABLE `character_db_version` ( + `required_2008_11_07_01_characters_character_db_version` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `character_db_version` +-- + +LOCK TABLES `character_db_version` WRITE; +/*!40000 ALTER TABLE `character_db_version` DISABLE KEYS */; +INSERT INTO `character_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `character_db_version` ENABLE KEYS */; +UNLOCK TABLES; diff --git a/sql/updates/2008_11_07_02_realmd_realmd_db_version.sql b/sql/updates/2008_11_07_02_realmd_realmd_db_version.sql new file mode 100644 index 000000000..044209b0f --- /dev/null +++ b/sql/updates/2008_11_07_02_realmd_realmd_db_version.sql @@ -0,0 +1,20 @@ +-- +-- Table structure for table `realmd_db_version` +-- + +DROP TABLE IF EXISTS `realmd_db_version`; +CREATE TABLE `realmd_db_version` ( + `required_2008_11_07_02_realmd_realmd_db_version` bit(1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; + +-- +-- Dumping data for table `realmd_db_version` +-- + +LOCK TABLES `realmd_db_version` WRITE; +/*!40000 ALTER TABLE `realmd_db_version` DISABLE KEYS */; +INSERT INTO `realmd_db_version` VALUES +(NULL); +/*!40000 ALTER TABLE `realmd_db_version` ENABLE KEYS */; +UNLOCK TABLES; + diff --git a/sql/updates/2008_11_07_03_characters_guild_bank_tab.sql b/sql/updates/2008_11_07_03_characters_guild_bank_tab.sql new file mode 100644 index 000000000..0110b0ad0 --- /dev/null +++ b/sql/updates/2008_11_07_03_characters_guild_bank_tab.sql @@ -0,0 +1,4 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_2008_11_07_01_characters_character_db_version required_2008_11_07_03_characters_guild_bank_tab bit; + +ALTER TABLE `guild_bank_tab` + CHANGE COLUMN `TabText` `TabText` text; diff --git a/sql/updates/2008_11_07_04_realmd_account.sql b/sql/updates/2008_11_07_04_realmd_account.sql new file mode 100644 index 000000000..10208e386 --- /dev/null +++ b/sql/updates/2008_11_07_04_realmd_account.sql @@ -0,0 +1,5 @@ +ALTER TABLE realmd_db_version CHANGE COLUMN required_2008_11_07_02_realmd_realmd_db_version required_2008_11_07_04_realmd_account bit; + +ALTER TABLE `account` + CHANGE COLUMN `email` `email` text; + diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 00e34f9ae..6d6f6f9fe 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -123,6 +123,10 @@ pkgdata_DATA = \ 2008_10_31_03_mangos_command.sql \ 2008_11_01_01_mangos_mangos_string.sql \ 2008_11_01_02_mangos_command.sql \ + 2008_11_07_01_characters_character_db_version.sql \ + 2008_11_07_02_realmd_realmd_db_version.sql \ + 2008_11_07_03_characters_guild_bank_tab.sql \ + 2008_11_07_04_realmd_account.sql \ README ## Additional files to include when running 'make dist' @@ -227,4 +231,8 @@ EXTRA_DIST = \ 2008_10_31_03_mangos_command.sql \ 2008_11_01_01_mangos_mangos_string.sql \ 2008_11_01_02_mangos_command.sql \ + 2008_11_07_01_characters_character_db_version.sql \ + 2008_11_07_02_realmd_realmd_db_version.sql \ + 2008_11_07_03_characters_guild_bank_tab.sql \ + 2008_11_07_04_realmd_account.sql \ README diff --git a/src/framework/Dynamic/ObjectRegistry.h b/src/framework/Dynamic/ObjectRegistry.h index 3cec26bbf..e78874d4b 100644 --- a/src/framework/Dynamic/ObjectRegistry.h +++ b/src/framework/Dynamic/ObjectRegistry.h @@ -20,7 +20,7 @@ #define MANGOS_OBJECTREGISTRY_H #include "Platform/Define.h" -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include "Policies/Singleton.h" #include diff --git a/src/framework/Makefile.am b/src/framework/Makefile.am index 4d064cefc..2a62943ab 100644 --- a/src/framework/Makefile.am +++ b/src/framework/Makefile.am @@ -58,6 +58,6 @@ EXTRA_DIST = \ Utilities/ByteConverter.h \ Utilities/Callback.h \ Utilities/EventProcessor.h \ - Utilities/HashMap.h \ + Utilities/UnorderedMap.h \ Utilities/LinkedList.h \ Utilities/TypeList.h diff --git a/src/framework/Utilities/HashMap.h b/src/framework/Utilities/UnorderedMap.h similarity index 71% rename from src/framework/Utilities/HashMap.h rename to src/framework/Utilities/UnorderedMap.h index 7ae3ee71f..5972faefc 100644 --- a/src/framework/Utilities/HashMap.h +++ b/src/framework/Utilities/UnorderedMap.h @@ -16,32 +16,39 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef MANGOS_HASHMAP_H -#define MANGOS_HASHMAP_H +#ifndef MANGOS_UNORDERED_MAP_H +#define MANGOS_UNORDERED_MAP_H #include "Platform/CompilerDefs.h" #include "Platform/Define.h" #if COMPILER == COMPILER_INTEL #include +#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4 +#include #elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 #include +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 // VC9.0 and later +#include #else #include #endif #ifdef _STLPORT_VERSION -#define HM_NAMESPACE std +#define UNORDERED_MAP std::hash_map using std::hash_map; +#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 +#define UNORDERED_MAP std::tr1::unordered_map #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300 -#define HM_NAMESPACE stdext +#define UNORDERED_MAP stdext::hash_map using stdext::hash_map; #elif COMPILER == COMPILER_INTEL -#define HM_NAMESPACE std +#define UNORDERED_MAP std::hash_map using std::hash_map; +#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4 +#define UNORDERED_MAP std::tr1::unordered_map #elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 -#define HM_NAMESPACE __gnu_cxx -using __gnu_cxx::hash_map; +#define UNORDERED_MAP std::__gnu_cxx::hash_map namespace __gnu_cxx { @@ -57,7 +64,7 @@ namespace __gnu_cxx }; #else -#define HM_NAMESPACE std +#define UNORDERED_MAP std::hash_map using std::hash_map; #endif #endif diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index aa9a27154..27514d7cc 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -300,11 +300,11 @@ void Creature::Update(uint32 diff) switch( m_deathState ) { case JUST_ALIVED: - // Dont must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. + // Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); break; case JUST_DIED: - // Dont must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. + // Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. sLog.outError("Creature (GUIDLow: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); break; case DEAD: @@ -470,7 +470,7 @@ void Creature::RegenerateHealth() uint32 addvalue = 0; - // Not only pet, but any controelled creature + // Not only pet, but any controlled creature if(GetCharmerOrOwnerGUID()) { float HealthIncreaseRate = sWorld.getRate(RATE_HEALTH); @@ -797,7 +797,7 @@ void Creature::sendPreparedGossip(Player* player) } // in case non empty gossip menu (that not included quests list size) show it - // (quest entries from quest menu wiill be included in list) + // (quest entries from quest menu will be included in list) player->PlayerTalkClass->SendGossipMenu(GetNpcTextId(), GetGUID()); } @@ -1067,7 +1067,7 @@ void Creature::SetLootRecipient(Unit *unit) void Creature::SaveToDB() { // this should only be used when the creature has already been loaded - // perferably after adding to map, because mapid may not be valid otherwise + // preferably after adding to map, because mapid may not be valid otherwise CreatureData const *data = objmgr.GetCreatureData(m_DBTableGuid); if(!data) { @@ -1431,7 +1431,7 @@ float Creature::GetAttackDistance(Unit const* pl) const // "The aggro radius of a mob having the same level as the player is roughly 20 yards" float RetDistance = 20; - // "Aggro Radius varries with level difference at a rate of roughly 1 yard/level" + // "Aggro Radius varies with level difference at a rate of roughly 1 yard/level" // radius grow if playlevel < creaturelevel RetDistance -= (float)leveldif; @@ -1726,7 +1726,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const float AttackDist = GetAttackDistance(pVictim); uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS); - //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and ouf of combat every update tick. + //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. return ( length > (ThreatRadius > AttackDist ? ThreatRadius : AttackDist)); } @@ -1795,7 +1795,7 @@ bool Creature::LoadCreaturesAddon(bool reload) return true; } -/// Send a message to LocalDefense channel for players oposition team in the zone +/// Send a message to LocalDefense channel for players opposition team in the zone void Creature::SendZoneUnderAttackMessage(Player* attacker) { uint32 enemy_team = attacker->GetTeam(); diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 1fa41e780..e843e48c8 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -43,7 +43,7 @@ void GMTicketMgr::LoadGMTickets() bar.step(); sLog.outString(); - sLog.outErrorDb(">> Loaded `character_ticket`, table is empty!"); + sLog.outString(">> Loaded `character_ticket`, table is empty."); return; } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 53b56b5fa..fd16c7849 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -62,7 +62,7 @@ GameObject::~GameObject() { if(m_uint32Values) // field array can be not exist if GameOBject not loaded { - // crash possable at access to deleted GO in Unit::m_gameobj + // crash possible at access to deleted GO in Unit::m_gameobj uint64 owner_guid = GetOwnerGUID(); if(owner_guid) { @@ -70,7 +70,7 @@ GameObject::~GameObject() if(owner) owner->RemoveGameObject(this,false); else if(!IS_PLAYER_GUID(owner_guid)) - sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possable later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); + sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid)); } } } @@ -220,7 +220,7 @@ void GameObject::Update(uint32 /*p_time*/) ((Player*)caster)->SendMessageToSet(&data,true); } - m_lootState = GO_READY; // can be succesfully open with some chance + m_lootState = GO_READY; // can be successfully open with some chance } return; } @@ -297,7 +297,7 @@ void GameObject::Update(uint32 /*p_time*/) float radius = goInfo->trap.radius; if(!radius) { - if(goInfo->trap.cooldown != 3) // cast in other case (at some triggring/linked go/etc explicit call) + if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) return; else { @@ -496,7 +496,7 @@ void GameObject::getFishLoot(Loot *fishloot) void GameObject::SaveToDB() { // this should only be used when the gameobject has already been loaded - // perferably after adding to map, because mapid may not be valid otherwise + // preferably after adding to map, because mapid may not be valid otherwise GameObjectData const *data = objmgr.GetGOData(m_DBTableGuid); if(!data) { diff --git a/src/game/Group.h b/src/game/Group.h index 5e909dd49..f19e2bb9f 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -141,7 +141,7 @@ class MANGOS_DLL_SPEC Group typedef std::list MemberSlotList; typedef MemberSlotList::const_iterator member_citerator; - typedef HM_NAMESPACE::hash_map< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap; + typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap; protected: typedef MemberSlotList::iterator member_witerator; typedef std::set InvitesList; diff --git a/src/game/Guild.h b/src/game/Guild.h index 11af9a70e..d1270a060 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -332,6 +332,18 @@ class Guild { return (members.find(LowGuid) != members.end()); } + MemberSlot* GetMemberSlot(std::string const& name, uint64& guid) + { + for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + { + if(itr->second.name == name) + { + guid = itr->first; + return &itr->second; + } + } + return NULL; + } void Roster(WorldSession *session); void Query(WorldSession *session); diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 1ac528222..0cdf6c5c7 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -171,26 +171,20 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) 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(!guild->IsMember(GUID_LOPART(plGuid))) + uint64 plGuid; + MemberSlot* slot = guild->GetMemberSlot(plName, plGuid); + if(!slot) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } + if(slot->RankId == GR_GUILDMASTER) + { + SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE); + return; + } + guild->DelMember(plGuid); // Put record into guildlog guild->LogGuildEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), 0); @@ -299,29 +293,25 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) return; } - uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + uint64 plGuid; + MemberSlot* slot = guild->GetMemberSlot(plName, plGuid); - if(!plGuid) + if(!slot) { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); + SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } - else if(plGuid == GetPlayer()->GetGUID()) + + if(plGuid == GetPlayer()->GetGUID()) { SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID); return; } - int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); - if(plRankId == -1) - { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); - return; - } - if(plRankId < 2 || (plRankId-1) < GetPlayer()->GetRank()) + if(slot->RankId < 2 || (slot->RankId-1) < GetPlayer()->GetRank()) return; - uint32 newRankId = plRankId < guild->GetNrRanks() ? plRankId-1 : guild->GetNrRanks()-1; + uint32 newRankId = slot->RankId < guild->GetNrRanks() ? slot->RankId-1 : guild->GetNrRanks()-1; guild->ChangeRank(plGuid, newRankId); // Put record into guildlog @@ -363,11 +353,12 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) return; } - uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + uint64 plGuid; + MemberSlot* slot = guild->GetMemberSlot(plName, plGuid); - if( !plGuid ) + if (!slot) { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); + SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; } @@ -377,25 +368,19 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) return; } - int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); - if(plRankId == -1) - { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); - return; - } - if((plRankId+1) >= guild->GetNrRanks() || plRankId <= GetPlayer()->GetRank()) + if((slot->RankId+1) >= guild->GetNrRanks() || slot->RankId <= GetPlayer()->GetRank()) return; - guild->ChangeRank(plGuid, (plRankId+1)); + guild->ChangeRank(plGuid, (slot->RankId+1)); // Put record into guildlog - guild->LogGuildEvent(GUILD_EVENT_LOG_DEMOTE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), (plRankId+1)); + guild->LogGuildEvent(GUILD_EVENT_LOG_DEMOTE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), (slot->RankId+1)); WorldPacket data(SMSG_GUILD_EVENT, (2+30)); // guess size data << (uint8)GE_DEMOTION; data << (uint8)3; data << GetPlayer()->GetName(); data << plName; - data << guild->GetRankName(plRankId+1); + data << guild->GetRankName(slot->RankId+1); guild->BroadcastPacket(&data); } @@ -494,14 +479,10 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) return; } - uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name); + uint64 newLeaderGUID; + MemberSlot* slot = guild->GetMemberSlot(name, newLeaderGUID); - if (!newLeaderGUID) - { - SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); - return; - } - if (!guild->IsMember(GUID_LOPART(newLeaderGUID))) + if (!slot) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); return; @@ -582,15 +563,10 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) return; } - uint64 plGuid = objmgr.GetPlayerGUIDByName(name); + uint64 plGuid; + MemberSlot* slot = guild->GetMemberSlot(name, plGuid); - if (!plGuid) - { - SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); - return; - } - - if (!guild->IsMember(GUID_LOPART(plGuid))) + if (!slot) { SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); return; @@ -628,15 +604,10 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) return; } - uint64 plGuid = objmgr.GetPlayerGUIDByName(plName); + uint64 plGuid; + MemberSlot* slot = guild->GetMemberSlot(plName, plGuid); - if (!plGuid) - { - SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); - return; - } - - if (!guild->IsMember(GUID_LOPART(plGuid))) + if (!slot) { SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); return; diff --git a/src/game/InstanceSaveMgr.h b/src/game/InstanceSaveMgr.h index b9313ccbe..99749d9af 100644 --- a/src/game/InstanceSaveMgr.h +++ b/src/game/InstanceSaveMgr.h @@ -24,7 +24,7 @@ #include "zthread/Mutex.h" #include #include -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include "Database/DatabaseEnv.h" struct InstanceTemplate; @@ -118,7 +118,7 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton InstanceSaveMap; - typedef HM_NAMESPACE::hash_map InstanceSaveHashMap; + typedef UNORDERED_MAP InstanceSaveHashMap; typedef std::map InstanceSaveMapMap; /* resetTime is a global propery of each (raid/heroic) map diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index a912a7a07..1971200bc 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -40,7 +40,7 @@ struct EnchStoreItem }; typedef std::vector EnchStoreList; -typedef HM_NAMESPACE::hash_map EnchantmentStore; +typedef UNORDERED_MAP EnchantmentStore; static EnchantmentStore RandomItemEnch; diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index 09655eac8..8f261c7ff 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -110,7 +110,7 @@ static void AttemptAddMore(Player* _player) if(!group->Create(_player->GetGUID(), _player->GetName())) { delete group; - return; // cann't create group (??) + return; // can't create group (??) } objmgr.AddGroup(group); @@ -252,7 +252,7 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type) { uint32 number = 0; - // start preper packet; + // start prepare packet; WorldPacket data(MSG_LOOKING_FOR_GROUP); data << uint32(type); // type data << uint32(entry); // entry from LFGDungeons.dbc diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index 23d0ae052..b6012d47c 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -30,6 +30,7 @@ #include "AccountMgr.h" #include "SystemConfig.h" #include "revision.h" +#include "revision_nr.h" #include "Util.h" bool ChatHandler::HandleHelpCommand(const char* args) @@ -95,9 +96,9 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) char const* full; if(m_session) - full = _FULLVERSION(REVISION_DATE,REVISION_TIME,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r"); + full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r"); else - full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID); + full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID); SendSysMessage(full); PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion()); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 9f23f99e0..8732eaf4b 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -49,7 +49,6 @@ #include "ItemEnchantmentMgr.h" #include "InstanceSaveMgr.h" #include "InstanceData.h" -#include "AccountMgr.h" //reload commands bool ChatHandler::HandleReloadCommand(const char* arg) @@ -430,7 +429,7 @@ bool ChatHandler::HandleReloadSpellElixirCommand(const char*) { sLog.outString( "Re-Loading Spell Elixir types..." ); spellmgr.LoadSpellElixirs(); - SendGlobalSysMessage("DB table `spell_elixir` (spell exlixir types) reloaded."); + SendGlobalSysMessage("DB table `spell_elixir` (spell elixir types) reloaded."); return true; } @@ -682,6 +681,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) if( !arg1 ) return false; + /// must be NULL if targeted syntax and must be not nULL if not targeted char* arg2 = strtok(NULL, " "); std::string targetAccountName; @@ -696,6 +696,9 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) if(arg2) return false; + /// security level expected in arg2 after this if. + arg2 = arg1; + targetAccountId = targetPlayer->GetSession()->GetAccountId(); targetSecurity = targetPlayer->GetSession()->GetSecurity(); if(!accmgr.GetName(targetAccountId,targetAccountName)) @@ -707,6 +710,10 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args) } else { + /// wrong command syntax (second arg expected) + if(!arg2) + return false; + targetAccountName = arg1; if(!AccountMgr::normilizeString(targetAccountName)) { @@ -1395,7 +1402,7 @@ bool ChatHandler::HandleLearnAllCommand(const char* /*args*/) "2426", "5916", "6634", - //"6718", phasing stealth, annoing for learn all case. + //"6718", phasing stealth, annoying for learn all case. "6719", "8822", "9591", @@ -1755,7 +1762,7 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) } } - if(!spellid) // ??? none spells in telent + if(!spellid) // ??? none spells in talent continue; SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid); @@ -2694,15 +2701,15 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args) bool known = target && target->HasSpell(id); bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL); - uint32 telentCost = GetTalentSpellCost(id); + uint32 talentCost = GetTalentSpellCost(id); - bool talent = (telentCost > 0); + bool talent = (talentCost > 0); bool passive = IsPassiveSpell(id); bool active = target && (target->HasAura(id,0) || target->HasAura(id,1) || target->HasAura(id,2)); // unit32 used to prevent interpreting uint8 as char at output // find rank of learned spell for learning spell, or talent rank - uint32 rank = telentCost ? telentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); + uint32 rank = talentCost ? talentCost : spellmgr.GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id); // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format std::ostringstream ss; @@ -3062,7 +3069,7 @@ bool ChatHandler::HandleGuildInviteCommand(const char *args) if (!plGuid) false; - // players's guild membership checked in AddMember before add + // player's guild membership checked in AddMember before add if (!targetGuild->AddMember (plGuid,targetGuild->GetLowestRank ())) return false; @@ -3746,7 +3753,7 @@ bool ChatHandler::HandleLevelUpCommand(const char* args) else // .levelup level addlevel = atoi(px); } - // else .levelup - nothing do for prepering + // else .levelup - nothing do for preparing // player Player *chr = NULL; @@ -3816,7 +3823,7 @@ bool ChatHandler::HandleLevelUpCommand(const char* args) } else { - // update levle and XP at level, all other will be updated at loading + // update level and XP at level, all other will be updated at loading Tokens values; Player::LoadValuesArrayFromDB(values,chr_guid); Player::SetUInt32ValueInArray(values,UNIT_FIELD_LEVEL,newlevel); @@ -5201,7 +5208,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result) std::string account_name; - // "account" case, name can be get in same quary + // "account" case, name can be get in same query if(result->GetFieldCount() > 1) account_name = fields[1].GetCppString(); // "character" case, name need extract from another DB @@ -5322,7 +5329,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) { Player* pl = m_session->GetPlayer(); - // accept only explictly selected target (not implicitly self targeting case) + // accept only explicitly selected target (not implicitly self targeting case) Unit* target = getSelectedUnit(); if(pl->GetSelection() && target) { diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 56fd6da3f..3c5020f53 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -120,7 +120,7 @@ class LootTemplate; typedef std::vector QuestItemList; typedef std::map QuestItemMap; typedef std::vector LootStoreItemList; -typedef HM_NAMESPACE::hash_map LootTemplateMap; +typedef UNORDERED_MAP LootTemplateMap; typedef std::set LootIdSet; diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index ff1decf5a..1f9c722ef 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -372,7 +372,7 @@ void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint return; } - // preper mail and send in other case + // prepare mail and send in other case bool needItemDelay = false; if(mi && !mi->empty()) @@ -464,7 +464,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data ) else if(!receive) sender_accId = objmgr.GetPlayerAccountIdByGUID(sender_guid); - // check player existanse + // check player existence if(receive || sender_accId) { WorldSession::SendMailTo(receive, MAIL_NORMAL, MAIL_STATIONERY_NORMAL, m->receiver, m->sender, m->subject, 0, NULL, m->COD, 0, MAIL_CHECK_MASK_COD_PAYMENT); diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d21c81eb7..029c59719 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1355,7 +1355,7 @@ void Map::RemoveAllObjectsInRemoveList() Remove((GameObject*)obj,true); break; case TYPEID_UNIT: - // in case triggred sequence some spell can continue casting after prev CleanupsBeforeDelete call + // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call // make sure that like sources auras/etc removed before destructor start ((Creature*)obj)->CleanupsBeforeDelete (); Remove((Creature*)obj,true); diff --git a/src/game/Map.h b/src/game/Map.h index e904a2ba5..8ed6fa1f0 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -116,7 +116,7 @@ enum LevelRequirementVsMode #pragma pack(pop) #endif -typedef HM_NAMESPACE::hash_map CreatureMoveList; +typedef UNORDERED_MAP CreatureMoveList; #define MAX_HEIGHT 100000.0f // can be use for find ground height at surface #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE diff --git a/src/game/MapInstanced.h b/src/game/MapInstanced.h index 08482dbd5..030716853 100644 --- a/src/game/MapInstanced.h +++ b/src/game/MapInstanced.h @@ -26,7 +26,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map { friend class MapManager; public: - typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; + typedef UNORDERED_MAP< uint32, Map* > InstancedMaps; MapInstanced(uint32 id, time_t expiry); ~MapInstanced() {} diff --git a/src/game/MapManager.h b/src/game/MapManager.h index 71a627b43..43ba884a9 100644 --- a/src/game/MapManager.h +++ b/src/game/MapManager.h @@ -32,8 +32,8 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton; - typedef HM_NAMESPACE::hash_map MapMapType; - typedef std::pair::iterator, bool> MapMapPair; + typedef UNORDERED_MAP MapMapType; + typedef std::pair::iterator, bool> MapMapPair; public: diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 21e4712a8..b5d970bf4 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1344,6 +1344,8 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } + normalizePlayerName (charname); + Player *plr = objmgr.GetPlayer(charname.c_str()); if(!plr) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 469a4aa60..426c070ef 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -129,7 +129,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if(!mEntry->IsMountAllowed()) _player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); - // battleground state preper + // battleground state prepare if(_player->InBattleGround()) { BattleGround *bg = _player->GetBattleGround(); @@ -288,7 +288,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) movementInfo.t_time = 0; } - // fall damage generation (ignore in flight case that can be triggred also at lags in moment teleportation to another map). + // fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map). if (recv_data.GetOpcode() == MSG_MOVE_FALL_LAND && !GetPlayer()->isInFlight()) { Player *target = GetPlayer(); diff --git a/src/game/Object.h b/src/game/Object.h index 5fbe8a542..ab888b24e 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -89,7 +89,7 @@ class Map; class UpdateMask; class InstanceData; -typedef HM_NAMESPACE::hash_map UpdateDataMapType; +typedef UNORDERED_MAP UpdateDataMapType; struct WorldLocation { diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index f1cf1e57b..586f84a82 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -628,7 +628,7 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) /// Define the static member of HashMapHolder -template HM_NAMESPACE::hash_map< uint64, T* > HashMapHolder::m_objectMap; +template UNORDERED_MAP< uint64, T* > HashMapHolder::m_objectMap; template ZThread::FastMutex HashMapHolder::i_lock; /// Global defintions for the hashmap storage diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 92483adf0..ccb5b8af8 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -22,7 +22,7 @@ #include "Platform/Define.h" #include "Policies/Singleton.h" #include "zthread/FastMutex.h" -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include "Policies/ThreadingModel.h" #include "ByteBuffer.h" @@ -47,7 +47,7 @@ class HashMapHolder { public: - typedef HM_NAMESPACE::hash_map< uint64, T* > MapType; + typedef UNORDERED_MAP< uint64, T* > MapType; typedef ZThread::FastMutex LockType; typedef MaNGOS::GeneralLock Guard; @@ -89,8 +89,8 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton Player2CorpsesMapType; - typedef HM_NAMESPACE::hash_map::value_type UpdateDataValueType; + typedef UNORDERED_MAP Player2CorpsesMapType; + typedef UNORDERED_MAP::value_type UpdateDataValueType; template static T* GetObjectInWorld(uint64 guid, T* /*fake*/) { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index bbfb1df4d..6f18cfacc 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -831,7 +831,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* return; } - // replace by new strucutres array + // replace by new structures array const_cast(addon->auras) = new CreatureDataAddonAura[val.size()/2+1]; int i=0; @@ -972,7 +972,7 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 team, const CreatureInfo *cinfo, const else display_id = (cinfo->DisplayID_A2 != 0 && urand(0,1) == 0) ? cinfo->DisplayID_A2 : cinfo->DisplayID_A; } - else // overriden in creature data + else // overridden in creature data display_id = data->displayid; return display_id; @@ -3086,7 +3086,7 @@ void ObjectMgr::LoadQuests() { sLog.outErrorDb("Quest %u has `SrcItemId` = %u but `SrcItemCount` = 0, set to 1 but need fix in DB.", qinfo->GetQuestId(),qinfo->SrcItemId); - qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward comptibility with DB + qinfo->SrcItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } else if(qinfo->SrcItemCount>0) @@ -3489,7 +3489,7 @@ void ObjectMgr::LoadQuests() Quest const* quest = GetQuestTemplate(quest_id); - // some quest referenced in spells not exist (outdataed spells) + // some quest referenced in spells not exist (outdated spells) if(!quest) continue; @@ -3849,7 +3849,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename) // this will prevent quest completing without objective const_cast(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); - // continue; - quest objective requiremet set and command can be allowed + // continue; - quest objective requirement set and command can be allowed } if(float(tmp.datalong2) > DEFAULT_VISIBILITY_DISTANCE) @@ -4023,7 +4023,7 @@ void ObjectMgr::LoadEventScripts() { std::set::const_iterator itr2 = evt_scripts.find(itr->first); if (itr2 == evt_scripts.end()) - sLog.outErrorDb("Table `event_scripts` has script (Id: %u) not refering to any gameobject_template type 10 data2 field or type 3 data6 field or any spell effect %u", itr->first, SPELL_EFFECT_SEND_EVENT); + sLog.outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field or type 3 data6 field or any spell effect %u", itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -4190,7 +4190,7 @@ void ObjectMgr::LoadInstanceTemplate() } } - // the reset_delay must be atleast one day + // the reset_delay must be at least one day temp->reset_delay = std::max((uint32)1, (uint32)(temp->reset_delay * sWorld.getRate(RATE_INSTANCE_RESET_TIME))); } @@ -4491,7 +4491,7 @@ void ObjectMgr::LoadQuestAreaTriggers() // this will prevent quest completing without objective const_cast(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); - // continue; - quest modified to required obkective and trigger can be allowed. + // continue; - quest modified to required objective and trigger can be allowed. } mQuestAreaTriggerMap[trigger_ID] = quest_ID; @@ -4791,7 +4791,7 @@ void ObjectMgr::LoadGraveyardZones() } if(!AddGraveYardLink(safeLocId,zoneId,team,false)) - sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Garveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); + sLog.outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.",safeLocId,zoneId); } while( result->NextRow() ); delete result; @@ -5155,7 +5155,7 @@ uint32 ObjectMgr::GenerateArenaTeamId() ++m_arenaTeamId; if(m_arenaTeamId>=0xFFFFFFFF) { - sLog.outError("Arena team ids overflow!! Can't continue, shuting down server. "); + sLog.outError("Arena team ids overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_arenaTeamId; @@ -5166,7 +5166,7 @@ uint32 ObjectMgr::GenerateGuildId() ++m_guildId; if(m_guildId>=0xFFFFFFFF) { - sLog.outError("Guild ids overflow!! Can't continue, shuting down server. "); + sLog.outError("Guild ids overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_guildId; @@ -5177,7 +5177,7 @@ uint32 ObjectMgr::GenerateAuctionID() ++m_auctionid; if(m_auctionid>=0xFFFFFFFF) { - sLog.outError("Auctions ids overflow!! Can't continue, shuting down server. "); + sLog.outError("Auctions ids overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_auctionid; @@ -5188,7 +5188,7 @@ uint32 ObjectMgr::GenerateMailID() ++m_mailid; if(m_mailid>=0xFFFFFFFF) { - sLog.outError("Mail ids overflow!! Can't continue, shuting down server. "); + sLog.outError("Mail ids overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_mailid; @@ -5199,7 +5199,7 @@ uint32 ObjectMgr::GenerateItemTextID() ++m_ItemTextId; if(m_ItemTextId>=0xFFFFFFFF) { - sLog.outError("Item text ids overflow!! Can't continue, shuting down server. "); + sLog.outError("Item text ids overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_ItemTextId; @@ -5227,7 +5227,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiItemGuid; if(m_hiItemGuid>=0xFFFFFFFF) { - sLog.outError("Item guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Item guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiItemGuid; @@ -5235,7 +5235,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiCreatureGuid; if(m_hiCreatureGuid>=0x00FFFFFF) { - sLog.outError("Creature guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Creature guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiCreatureGuid; @@ -5243,7 +5243,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiPetGuid; if(m_hiPetGuid>=0x00FFFFFF) { - sLog.outError("Pet guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Pet guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiPetGuid; @@ -5251,7 +5251,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiCharGuid; if(m_hiCharGuid>=0xFFFFFFFF) { - sLog.outError("Players guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Players guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiCharGuid; @@ -5259,7 +5259,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiGoGuid; if(m_hiGoGuid>=0x00FFFFFF) { - sLog.outError("Gameobject guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Gameobject guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiGoGuid; @@ -5267,7 +5267,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiCorpseGuid; if(m_hiCorpseGuid>=0xFFFFFFFF) { - sLog.outError("Corpse guid overflow!! Can't continue, shuting down server. "); + sLog.outError("Corpse guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiCorpseGuid; @@ -5275,7 +5275,7 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) ++m_hiDoGuid; if(m_hiDoGuid>=0xFFFFFFFF) { - sLog.outError("DynamicObject guid overflow!! Can't continue, shuting down server. "); + sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. "); sWorld.m_stopEvent = true; } return m_hiDoGuid; @@ -6119,7 +6119,7 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo return true; } - if(strictMask & 0x1) // basic latin + if(strictMask & 0x1) // basic Latin { if(isBasicLatinString(wstr,numericOrSpace)) return true; @@ -6425,7 +6425,7 @@ const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const void ObjectMgr::LoadFishingBaseSkillLevel() { - mFishingBaseForArea.clear(); // for relaod case + mFishingBaseForArea.clear(); // for reload case uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level"); @@ -6741,7 +6741,7 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial) void ObjectMgr::LoadGameTele() { - m_GameTeleMap.clear(); // for relaod case + m_GameTeleMap.clear(); // for reload case uint32 count = 0; QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele"); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 59ff4e4cf..6f1fc3fc4 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -72,7 +72,7 @@ struct GameTele std::wstring wnameLow; }; -typedef HM_NAMESPACE::hash_map GameTeleMap; +typedef UNORDERED_MAP GameTeleMap; struct ScriptInfo { @@ -120,26 +120,26 @@ struct CellObjectGuids CellGuidSet gameobjects; CellCorpseSet corpses; }; -typedef HM_NAMESPACE::hash_map CellObjectGuidsMap; -typedef HM_NAMESPACE::hash_map MapObjectGuids; +typedef UNORDERED_MAP CellObjectGuidsMap; +typedef UNORDERED_MAP MapObjectGuids; -typedef HM_NAMESPACE::hash_map RespawnTimes; +typedef UNORDERED_MAP RespawnTimes; struct MangosStringLocale { std::vector Content; // 0 -> default, i -> i-1 locale index }; -typedef HM_NAMESPACE::hash_map CreatureDataMap; -typedef HM_NAMESPACE::hash_map GameObjectDataMap; -typedef HM_NAMESPACE::hash_map CreatureLocaleMap; -typedef HM_NAMESPACE::hash_map GameObjectLocaleMap; -typedef HM_NAMESPACE::hash_map ItemLocaleMap; -typedef HM_NAMESPACE::hash_map QuestLocaleMap; -typedef HM_NAMESPACE::hash_map NpcTextLocaleMap; -typedef HM_NAMESPACE::hash_map PageTextLocaleMap; -typedef HM_NAMESPACE::hash_map MangosStringLocaleMap; -typedef HM_NAMESPACE::hash_map NpcOptionLocaleMap; +typedef UNORDERED_MAP CreatureDataMap; +typedef UNORDERED_MAP GameObjectDataMap; +typedef UNORDERED_MAP CreatureLocaleMap; +typedef UNORDERED_MAP GameObjectLocaleMap; +typedef UNORDERED_MAP ItemLocaleMap; +typedef UNORDERED_MAP QuestLocaleMap; +typedef UNORDERED_MAP NpcTextLocaleMap; +typedef UNORDERED_MAP PageTextLocaleMap; +typedef UNORDERED_MAP MangosStringLocaleMap; +typedef UNORDERED_MAP NpcOptionLocaleMap; typedef std::multimap QuestRelations; @@ -229,11 +229,11 @@ struct PlayerCondition }; // NPC gossip text id -typedef HM_NAMESPACE::hash_map CacheNpcTextIdMap; +typedef UNORDERED_MAP CacheNpcTextIdMap; typedef std::list CacheNpcOptionList; -typedef HM_NAMESPACE::hash_map CacheVendorItemMap; -typedef HM_NAMESPACE::hash_map CacheTrainerSpellMap; +typedef UNORDERED_MAP CacheVendorItemMap; +typedef UNORDERED_MAP CacheTrainerSpellMap; typedef std::list AchievementCriteriaEntryList; @@ -273,23 +273,23 @@ class ObjectMgr ObjectMgr(); ~ObjectMgr(); - typedef HM_NAMESPACE::hash_map ItemMap; + typedef UNORDERED_MAP ItemMap; typedef std::set< Group * > GroupSet; typedef std::set< Guild * > GuildSet; typedef std::set< ArenaTeam * > ArenaTeamSet; - typedef HM_NAMESPACE::hash_map QuestMap; + typedef UNORDERED_MAP QuestMap; - typedef HM_NAMESPACE::hash_map AreaTriggerMap; + typedef UNORDERED_MAP AreaTriggerMap; - typedef HM_NAMESPACE::hash_map AreaTriggerScriptMap; + typedef UNORDERED_MAP AreaTriggerScriptMap; - typedef HM_NAMESPACE::hash_map RepOnKillMap; + typedef UNORDERED_MAP RepOnKillMap; - typedef HM_NAMESPACE::hash_map WeatherZoneMap; + typedef UNORDERED_MAP WeatherZoneMap; - typedef HM_NAMESPACE::hash_map PetCreateSpellMap; + typedef UNORDERED_MAP PetCreateSpellMap; Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } @@ -781,10 +781,10 @@ class ObjectMgr QuestMap mQuestTemplates; - typedef HM_NAMESPACE::hash_map GossipTextMap; - typedef HM_NAMESPACE::hash_map QuestAreaTriggerMap; - typedef HM_NAMESPACE::hash_map BattleMastersMap; - typedef HM_NAMESPACE::hash_map ItemTextMap; + typedef UNORDERED_MAP GossipTextMap; + typedef UNORDERED_MAP QuestAreaTriggerMap; + typedef UNORDERED_MAP BattleMastersMap; + typedef UNORDERED_MAP ItemTextMap; typedef std::set TavernAreaTriggerSet; typedef std::set GameObjectForQuestSet; diff --git a/src/game/Pet.h b/src/game/Pet.h index 992396e7b..4a0ff2d04 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -104,7 +104,7 @@ enum PetNameInvalidReason PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16 }; -typedef HM_NAMESPACE::hash_map PetSpellMap; +typedef UNORDERED_MAP PetSpellMap; typedef std::map TeachSpellMap; typedef std::vector AutoSpellList; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e65597604..444785e11 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -363,7 +363,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this) m_temporaryUnsummonedPetNumber = 0; //cache for UNIT_CREATED_BY_SPELL to allow - //returning reagests for temporarily removed pets + //returning reagents for temporarily removed pets //when dying/logging out m_oldpetspell = 0; @@ -611,7 +611,7 @@ bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, SetHealth(GetMaxHealth()); if (getPowerType()==POWER_MANA) { - UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intelect) + UpdateMaxPower(POWER_MANA); // Update max Mana (for add bonus from intellect) SetPower(POWER_MANA,GetMaxPower(POWER_MANA)); } @@ -776,7 +776,7 @@ void Player::HandleDrowning() return; } - uint32 UnderWaterTime = 1*MINUTE*1000; // default leangthL 1 min + uint32 UnderWaterTime = 1*MINUTE*1000; // default length 1 min AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING); for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i) @@ -1460,7 +1460,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // client without expansion support if(GetSession()->Expansion() < mEntry->Expansion()) { - sLog.outDebug("Player %s using client without required expansion tried teleport to non accessable map %u", GetName(), mapid); + sLog.outDebug("Player %s using client without required expansion tried teleport to non accessible map %u", GetName(), mapid); if(GetTransport()) RepopAtGraveyard(); // teleport to near graveyard if on transport, looks blizz like :) @@ -1488,7 +1488,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati SetSemaphoreTeleport(true); - // The player was ported to another map and looses the duel immediatly. + // The player was ported to another map and looses the duel immediately. // We have to perform this check before the teleport, otherwise the // ObjectAccessor won't find the flag. if (duel && GetMapId()!=mapid) @@ -4164,7 +4164,7 @@ void Player::UpdateLocalChannels(uint32 newZone ) // leave old channel (*i)->Leave(GetGUID(),false); // not send leave channel, it already replaced at client - std::string name = (*i)->GetName(); // stroe name, (*i)erase in LeftChannel + std::string name = (*i)->GetName(); // store name, (*i)erase in LeftChannel LeftChannel(*i); // remove from player's channel list cMgr->LeftChannel(name); // delete if empty } @@ -4199,7 +4199,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if(modGroup >= BASEMOD_END || modType >= MOD_END) { - sLog.outError("ERROR in HandleBaseModValue(): nonexisted BaseModGroup of wrong BaseModType!"); + sLog.outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -4236,7 +4236,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if(modGroup >= BASEMOD_END || modType > MOD_END) { - sLog.outError("ERROR: trial to access nonexisted BaseModGroup or wrong BaseModType!"); + sLog.outError("ERROR: trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -4913,7 +4913,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) { if (_spell_idx->second->skillId == id) { - // this may remove more than one spell (dependants) + // this may remove more than one spell (dependents) removeSpell(itr->first); next = m_spells.begin(); break; @@ -6205,7 +6205,7 @@ void Player::UpdateZone(uint32 newZone) RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); - // Set player to FFA PVP when not in rested enviroment. + // Set player to FFA PVP when not in rested environment. if(sWorld.IsFFAPvPRealm()) SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP); } @@ -7631,7 +7631,7 @@ void Player::SendInitWorldStates() data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control - data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontroled (1 - yes, 0 - no) + data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) @@ -9685,7 +9685,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo if(eslot != EQUIPMENT_SLOT_MAINHAND) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; - // offhand item must can be stored in inventitory for offhand item and it also must be unequipped + // offhand item must can be stored in inventory for offhand item and it also must be unequipped Item *offItem = GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND ); ItemPosCountVec off_dest; if( offItem && (!not_loading || @@ -9796,7 +9796,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p return EQUIP_ERR_OK; } - // not specific slot or have spece for partly store only in specific slot + // not specific slot or have space for partly store only in specific slot // in specific bag if( bag != NULL_BAG ) @@ -9858,7 +9858,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p } } - // not specific bag or have spece for partly store only in specific bag + // not specific bag or have space for partly store only in specific bag // search stack for merge to if( pProto->Stackable > 1 ) @@ -10490,7 +10490,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool pLastItem->SetOwnerGUID(GetGUID()); // if this original item then it need create record in inventory - // in case trade we laready have item in other player inventory + // in case trade we already have item in other player inventory pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this); } } @@ -11279,7 +11279,7 @@ void Player::TradeCancel(bool sendback) { if(pTrader) { - // send yellow "Trade cancelled" message to both traders + // send yellow "Trade canceled" message to both traders WorldSession* ws; ws = GetSession(); if(sendback) @@ -11494,7 +11494,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a if(apply) { int32 basepoints = int32(enchant_amount); - // Random Property Exist - try found basepoints for spell (basepoints depencs from item suffix factor) + // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) if (item->GetItemRandomPropertyId() !=0 && !enchant_amount) { ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); @@ -12572,7 +12572,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) return true; // each-from-all exclusive group ( < 0) - // can be start if only all quests in prev quest exclusive group complited and rewarded + // can be start if only all quests in prev quest exclusive group completed and rewarded ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); @@ -14230,7 +14230,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff) std::map bagMap; // fast guid lookup for bags //NOTE: the "order by `bag`" is important because it makes sure //the bagMap is filled before items in the bags are loaded - //NOTE2: the "order by `slot`" is needed becaue mainhand weapons are (wrongly?) + //NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?) //expected to be equipped before offhand items (TODO: fixme) uint32 zone = GetZoneId(); @@ -14357,7 +14357,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff) while(!problematicItems.empty()) { // fill mail - MailItemsInfo mi; // item list prepering + MailItemsInfo mi; // item list preparing for(int i = 0; !problematicItems.empty() && i < MAX_MAIL_ITEMS; ++i) { @@ -14905,7 +14905,7 @@ void Player::SendSavedInstances() } } - //Send opcode 811. true or flase means, whether you have current raid/heroic instances + //Send opcode 811. true or false means, whether you have current raid/heroic instances data.Initialize(SMSG_UPDATE_INSTANCE_OWNERSHIP); data << uint32(hasBeenSaved); GetSession()->SendPacket(&data); @@ -16969,7 +16969,7 @@ void Player::SendCooldownEvent(SpellEntry const *spellInfo) if ( !(spellInfo->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE) ) return; - // Get spell cooldwn + // Get spell cooldown int32 cooldown = GetSpellRecoveryTime(spellInfo); // Apply spellmods ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, cooldown); @@ -17432,7 +17432,7 @@ void Player::SetGroup(Group *group, int8 subgroup) void Player::SendInitialPacketsBeforeAddToMap() { WorldPacket data(SMSG_SET_REST_START_OBSOLETE, 4); - data << uint32(0); // unknown, may be rest state time or expirience + data << uint32(0); // unknown, may be rest state time or experience GetSession()->SendPacket(&data); // Homebind @@ -18059,7 +18059,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons break; } default: - sLog.outError("HasItemFitToSpellReqirements: Not handeled spell reqirement for item class %u",spellInfo->EquippedItemClass); + sLog.outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass); break; } @@ -18104,7 +18104,7 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) uint32 Player::GetResurrectionSpellId() { - // search priceless resurrection possabilities + // search priceless resurrection possibilities uint32 prio = 0; uint32 spell_id = 0; AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY); @@ -18258,7 +18258,7 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const { Item* item = GetWeaponForAttack(attType,true); - // unarmmed only with base attack + // unarmed only with base attack if(attType != BASE_ATTACK && !item) return 0; diff --git a/src/game/Player.h b/src/game/Player.h index 8380339f8..54f0d15ed 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -90,7 +90,7 @@ struct SpellModifier Spell const* lastAffected; }; -typedef HM_NAMESPACE::hash_map PlayerSpellMap; +typedef UNORDERED_MAP PlayerSpellMap; typedef std::list SpellModList; struct SpellCooldown @@ -1385,7 +1385,7 @@ class MANGOS_DLL_SPEC Player : public Unit uint8 unReadMails; time_t m_nextMailDelivereTime; - typedef HM_NAMESPACE::hash_map ItemMap; + typedef UNORDERED_MAP ItemMap; ItemMap mMitems; //template defined in objectmgr.cpp @@ -2019,7 +2019,7 @@ class MANGOS_DLL_SPEC Player : public Unit /*** INSTANCE SYSTEM ***/ /*********************************************************/ - typedef HM_NAMESPACE::hash_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; + typedef UNORDERED_MAP< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; void UpdateHomebindTime(uint32 time); diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index ccb35ef74..fa4bd977a 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -40,7 +40,7 @@ struct SkillDiscoveryEntry }; typedef std::list SkillDiscoveryList; -typedef HM_NAMESPACE::hash_map SkillDiscoveryMap; +typedef UNORDERED_MAP SkillDiscoveryMap; static SkillDiscoveryMap SkillDiscoveryStore; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index d0dcd4f76..0f3ca5801 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -346,7 +346,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_powerCost = 0; // setup to correct value in Spell::prepare, don't must be used before. m_casttime = 0; // setup to correct value in Spell::prepare, don't must be used before. - m_timer = 0; // will set to castime in preper + m_timer = 0; // will set to castime in prepare m_needAliveTargetMask = 0; @@ -1484,7 +1484,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); }break; - // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some sceals, fire shield from imp, etc..) + // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) case TARGET_SINGLE_PARTY: { Unit *target = m_targets.getUnitTarget(); @@ -3267,7 +3267,7 @@ uint8 Spell::CanCast(bool strict) if (target->isInFlight()) return SPELL_FAILED_BAD_TARGETS; - if(VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) + if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) return SPELL_FAILED_LINE_OF_SIGHT; // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode @@ -4056,7 +4056,7 @@ int16 Spell::PetCanCast(Unit* target) if(!m_caster->isAlive()) return SPELL_FAILED_CASTER_DEAD; - if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interuption by another spellcast + if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interruption by another spellcast return SPELL_FAILED_SPELL_IN_PROGRESS; if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) return SPELL_FAILED_AFFECTING_COMBAT; @@ -4147,7 +4147,7 @@ uint8 Spell::CheckCasterAuras() const else if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY) dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); } - //immune movement impairement and loss of control + //immune movement impairment and loss of control if(m_spellInfo->Id==(uint32)42292) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } @@ -4633,7 +4633,7 @@ uint8 Spell::CheckItems() return SPELL_FAILED_CANT_BE_DISENCHANTED; uint32 item_quality = itemProto->Quality; - // 2.0.x addon: Check player enchanting level against the item desenchanting requirements + // 2.0.x addon: Check player enchanting level against the item disenchanting requirements uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill; if (item_disenchantskilllevel == uint32(-1)) return SPELL_FAILED_CANT_BE_DISENCHANTED; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a7e2ff69f..e8a52639d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -210,7 +210,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI &Aura::HandleShieldBlockValue, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE &Aura::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell - &Aura::HandleNoImmediateEffect, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemended in Unit::MagicSpellHitResult + &Aura::HandleNoImmediateEffect, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult &Aura::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT &Aura::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA &Aura::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE @@ -224,7 +224,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK &Aura::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK &Aura::HandleUnused, //173 SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell - &Aura::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus (by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT) + &Aura::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus (by default intellect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT) &Aura::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus &Aura::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end &Aura::HandleNULL, //177 SPELL_AURA_AOE_CHARM @@ -237,7 +237,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst &Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult - &Aura::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemended in Unit::GetUnitCriticalChance + &Aura::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance &Aura::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance &Aura::HandleModRating, //189 SPELL_AURA_MOD_RATING &Aura::HandleNULL, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN @@ -519,10 +519,9 @@ Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoi uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff]; - SpellEntry const* triggredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId); - if (triggredSpellInfo) + if(SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) for (int i = 0; i < 3; ++i) - if (triggredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY) + if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY) return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, target, caster, castItem); return new Aura(spellproto, eff, currentBasePoints, target, caster, castItem); @@ -1259,12 +1258,12 @@ void Aura::TriggerSpell() uint64 originalCasterGUID = GetCasterGUID(); - SpellEntry const *triggredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); + SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); SpellEntry const *auraSpellInfo = GetSpellProto(); uint32 auraId = auraSpellInfo->Id; // specific code for cases with no trigger spell provided in field - if (triggredSpellInfo == NULL) + if (triggeredSpellInfo == NULL) { switch(auraSpellInfo->SpellFamilyName) { @@ -1272,7 +1271,7 @@ void Aura::TriggerSpell() { switch(auraId) { - // Firestone Passive (1-5 rangs) + // Firestone Passive (1-5 ranks) case 758: case 17945: case 17947: @@ -1306,7 +1305,7 @@ void Aura::TriggerSpell() // case 812: break; // // Polymorphic Ray // case 6965: break; -// // Fire Nova (1-7 Rangs) +// // Fire Nova (1-7 ranks) // case 8350: // case 8508: // case 8509: @@ -1865,8 +1864,8 @@ void Aura::TriggerSpell() break; } // Reget trigger spell proto - triggredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); - if(triggredSpellInfo == NULL) + triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id); + if(triggeredSpellInfo == NULL) { sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex()); return; @@ -1874,7 +1873,7 @@ void Aura::TriggerSpell() } else { - // Spell exist but require costum code + // Spell exist but require custom code switch(auraId) { // Curse of Idiocy @@ -1884,7 +1883,7 @@ void Aura::TriggerSpell() // BUT: // 1) target show casting at each triggered cast: target don't must show casting animation for any triggered spell // but must show affect apply like item casting - // 2) maybe aura must be replace by new with accumulative stat mods insteed stacking + // 2) maybe aura must be replace by new with accumulative stat mods instead stacking // prevent cast by triggered auras if(m_caster_guid == m_target->GetGUID()) @@ -1924,7 +1923,7 @@ void Aura::TriggerSpell() } } // All ok cast by default case - Spell *spell = new Spell(caster, triggredSpellInfo, true, originalCasterGUID ); + Spell *spell = new Spell(caster, triggeredSpellInfo, true, originalCasterGUID ); SpellCastTargets targets; targets.setUnitTarget( target ); @@ -2048,7 +2047,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // Dark Fiend if(GetId()==45934) { - // Kill target if dispeled + // Kill target if dispelled if (m_removeMode==AURA_REMOVE_BY_DISPEL) m_target->DealDamage(m_target, m_target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return; @@ -2754,7 +2753,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) Aura* handledAura = *otherTransforms.begin(); for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i) { - // negative auras are prefered + // negative auras are preferred if(!IsPositiveSpell((*i)->GetSpellProto()->Id)) { handledAura = *i; @@ -3202,7 +3201,7 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real) if (m_target->GetTypeId() != TYPEID_PLAYER) return; - // main-hand attack speed already set to special value for feral form already and don't must chnage and reset at remove. + // main-hand attack speed already set to special value for feral form already and don't must change and reset at remove. if (((Player *)m_target)->IsInFeralForm()) return; @@ -3506,7 +3505,7 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) if (currentSpell && currentSpell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) { uint32 state = currentSpell->getState(); - // Stop spells on prepere or casting state + // Stop spells on prepare or casting state if ( state == SPELL_STATE_PREPARING || state == SPELL_STATE_CASTING ) { currentSpell->cancel(); @@ -4074,7 +4073,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) int32 mws = caster->GetAttackTime(BASE_ATTACK); float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE); float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE); - // WARNING! in 3.0 multipler 0.00743f change to 0.6 + // WARNING! in 3.0 multiplier 0.00743f change to 0.6 m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.00743f); } return; @@ -4102,7 +4101,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Rip if (m_spellProto->SpellFamilyFlags & 0x000000000000800000LL) { - // $AP * min(0.06*$cp, 0.24)/6 [Yes, there is no difference, wheather 4 or 5 CPs are being used] + // $AP * min(0.06*$cp, 0.24)/6 [Yes, there is no difference, whether 4 or 5 CPs are being used] if (apply && !loading && caster && caster->GetTypeId() == TYPEID_PLAYER) { uint8 cp = ((Player*)caster)->GetComboPoints(); @@ -4155,7 +4154,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Rupture if (m_spellProto->SpellFamilyFlags & 0x000000000000100000LL) { - // Dmg/tick = $AP*min(0.01*$cp, 0.03) [Like Rip: only the first three CP inrease the contribution from AP] + // Dmg/tick = $AP*min(0.01*$cp, 0.03) [Like Rip: only the first three CP increase the contribution from AP] if (apply && !loading && caster && caster->GetTypeId() == TYPEID_PLAYER) { uint8 cp = ((Player*)caster)->GetComboPoints(); @@ -4485,9 +4484,9 @@ void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real) if(m_modifier.m_miscvalue != SPELL_SCHOOL_MASK_NORMAL) { - // support required adding replace UpdateArmor by loop by UpdateResistence at intelect update + // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. - sLog.outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) need adding support for non-armor resistences!"); + sLog.outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) need adding support for non-armor resistances!"); return; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1ccece6e4..56f242303 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -714,7 +714,7 @@ void Spell::EffectDummy(uint32 i) } case 13567: // Dummy Trigger { - // can be used for different aura triggreing, so select by aura + // can be used for different aura triggering, so select by aura if(!m_triggeredByAuraSpell || !unitTarget) return; @@ -2646,31 +2646,31 @@ void Spell::EffectEnergize(uint32 i) return; // Some level depends spells - int multipler = 0; + int multiplier = 0; int level_diff = 0; switch (m_spellInfo->Id) { // Restore Energy case 9512: level_diff = m_caster->getLevel() - 40; - multipler = 2; + multiplier = 2; break; // Blood Fury case 24571: level_diff = m_caster->getLevel() - 60; - multipler = 10; + multiplier = 10; break; // Burst of Energy case 24532: level_diff = m_caster->getLevel() - 60; - multipler = 4; + multiplier = 4; break; default: break; } if (level_diff > 0) - damage -= multipler * level_diff; + damage -= multiplier * level_diff; if(damage < 0) return; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index df34a35a4..e1913e1fe 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -26,7 +26,7 @@ #include "Database/DBCStructure.h" #include "Database/SQLStorage.h" -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include class Player; @@ -502,7 +502,7 @@ struct SpellProcEventEntry uint32 cooldown; // hidden cooldown used for some spell proc events, applied to _triggered_spell_ }; -typedef HM_NAMESPACE::hash_map SpellProcEventMap; +typedef UNORDERED_MAP SpellProcEventMap; #define ELIXIR_BATTLE_MASK 0x1 #define ELIXIR_GUARDIAN_MASK 0x2 @@ -541,7 +541,7 @@ struct SpellTargetPosition float target_Orientation; }; -typedef HM_NAMESPACE::hash_map SpellTargetPositionMap; +typedef UNORDERED_MAP SpellTargetPositionMap; // Spell pet auras class PetAura @@ -604,7 +604,7 @@ struct SpellChainNode uint8 rank; }; -typedef HM_NAMESPACE::hash_map SpellChainMap; +typedef UNORDERED_MAP SpellChainMap; typedef std::multimap SpellChainMapNext; // Spell learning properties (accessed using SpellMgr functions) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 80fb5e76e..5c3eadc8d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -387,10 +387,15 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+4+4+4+4+1+4+4+4+pathSize*4*3) ); data.append(GetPackGUID()); - data << GetPositionX( ) - << GetPositionY( ) - << GetPositionZ( ); - data << GetOrientation( ); + data << GetPositionX(); + data << GetPositionY(); + data << GetPositionZ(); + + // unknown field - unrelated to orientation + // seems to increment about 1000 for every 1.7 seconds + // for now, we'll just use mstime + data << getMSTime(); + data << uint8( 0 ); data << uint32( MovementFlags ); data << uint32( traveltime ); @@ -446,7 +451,7 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage) if(!HasAuraType(auraType)) return; - // The chance to dispell an aura depends on the damage taken with respect to the casters level. + // The chance to dispel an aura depends on the damage taken with respect to the casters level. uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50; float chance = float(damage) / max_dmg * 100.0f; if (roll_chance_f(chance)) @@ -501,7 +506,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa } pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_FEAR, damage); - // root type spells do not dispell the root effect + // root type spells do not dispel the root effect if(!spellProto || spellProto->Mechanic != MECHANIC_ROOT) pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage); @@ -792,7 +797,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { if(getVictim()) { - // if have target and damage pVictim just call AI recation + // if have target and damage pVictim just call AI reaction if(pVictim != getVictim() && pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI()) ((Creature*)pVictim)->AI()->AttackedBy(this); } @@ -939,7 +944,7 @@ void Unit::CastStop(uint32 except_spellid) InterruptSpell(i,false); } -void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); @@ -949,10 +954,10 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte return; } - CastSpell(Victim,spellInfo,triggered,castItem,triggredByAura, originalCaster); + CastSpell(Victim,spellInfo,triggered,castItem,triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { if(!spellInfo) { @@ -963,18 +968,18 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I if (castItem) DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); - if(!originalCaster && triggredByAura) - originalCaster = triggredByAura->GetCasterGUID(); + if(!originalCaster && triggeredByAura) + originalCaster = triggeredByAura->GetCasterGUID(); Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); SpellCastTargets targets; targets.setUnitTarget( Victim ); spell->m_CastItem = castItem; - spell->prepare(&targets, triggredByAura); + spell->prepare(&targets, triggeredByAura); } -void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); @@ -984,10 +989,10 @@ void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 return; } - CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggredByAura, originalCaster); + CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggeredByAura, originalCaster); } -void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { if(!spellInfo) { @@ -998,8 +1003,8 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const if (castItem) DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); - if(!originalCaster && triggredByAura) - originalCaster = triggredByAura->GetCasterGUID(); + if(!originalCaster && triggeredByAura) + originalCaster = triggeredByAura->GetCasterGUID(); Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); @@ -1015,11 +1020,11 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const SpellCastTargets targets; targets.setUnitTarget( Victim ); spell->m_CastItem = castItem; - spell->prepare(&targets, triggredByAura); + spell->prepare(&targets, triggeredByAura); } // used for scripting -void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); @@ -1029,11 +1034,11 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, return; } - CastSpell(x, y, z,spellInfo,triggered,castItem,triggredByAura, originalCaster); + CastSpell(x, y, z,spellInfo,triggered,castItem,triggeredByAura, originalCaster); } // used for scripting -void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster) +void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster) { if(!spellInfo) { @@ -1044,15 +1049,15 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo if (castItem) DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id); - if(!originalCaster && triggredByAura) - originalCaster = triggredByAura->GetCasterGUID(); + if(!originalCaster && triggeredByAura) + originalCaster = triggeredByAura->GetCasterGUID(); Spell *spell = new Spell(this, spellInfo, triggered, originalCaster ); SpellCastTargets targets; targets.setDestination(x, y, z); spell->m_CastItem = castItem; - spell->prepare(&targets, triggredByAura); + spell->prepare(&targets, triggeredByAura); } void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit, bool isTriggeredSpell) @@ -1060,7 +1065,7 @@ void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *da // TODO this in only generic way, check for exceptions DEBUG_LOG("DealFlatDamage (BEFORE) >> DMG:%u", *damage); - // Per-damage calss calculation + // Per-damage class calculation switch (spellInfo->DmgClass) { // Melee and Ranged Spells @@ -2182,7 +2187,7 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex else if (attType == OFF_ATTACK) hitInfo = HITINFO_LEFTSWING; else - return; // ignore ranaged case + return; // ignore ranged case uint32 extraAttacks = m_extraAttacks; @@ -2296,7 +2301,7 @@ MeleeHitOutcome Unit::RollPhysicalOutcomeAgainst (Unit const *pVictim, WeaponAtt } else { - // parry can be avoided only by some abilites + // parry can be avoided only by some abilities parry_chance = pVictim->GetUnitParryChance(); // block might be bypassed by it as well block_chance = pVictim->GetUnitBlockChance(); @@ -2310,7 +2315,7 @@ MeleeHitOutcome Unit::RollPhysicalOutcomeAgainst (Unit const *pVictim, WeaponAtt // Increase from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL aura crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, spellInfo->SchoolMask); - if( dodge_chance != 0.0f ) // if dodge chance is already 0, ignore talents fpr speed + if( dodge_chance != 0.0f ) // if dodge chance is already 0, ignore talents for speed { AuraList const& mCanNotBeDodge = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT); for(AuraList::const_iterator i = mCanNotBeDodge.begin(); i != mCanNotBeDodge.end(); ++i) @@ -2871,7 +2876,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool } // TODO need use this code for spell hit result calculation - // now code commented for compotability + // now code commented for computability switch (spell->DmgClass) { case SPELL_DAMAGE_CLASS_RANGED: @@ -3042,7 +3047,7 @@ float Unit::GetUnitBlockChance() const if(tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); } - // is player but has no block ability or no not broken shield equiped + // is player but has no block ability or no not broken shield equipped return 0.0f; } else @@ -3123,7 +3128,7 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target) if(((Player*)this)->IsInFeralForm()) return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact - // weaon skill or (unarmed for base attack) + // weapon skill or (unarmed for base attack) uint32 skill = item ? item->GetSkill() : SKILL_UNARMED; // in PvP use full skill instead current skill value @@ -3468,13 +3473,13 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const float Unit::GetTotalAuraMultiplier(AuraType auratype) const { - float multipler = 1.0f; + float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) - multipler *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; + multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f; - return multipler; + return multiplier; } int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const @@ -3517,16 +3522,16 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const { - float multipler = 1.0f; + float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue & misc_mask) - multipler *= (100.0f + mod->m_amount)/100.0f; + multiplier *= (100.0f + mod->m_amount)/100.0f; } - return multipler; + return multiplier; } int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const @@ -3575,16 +3580,16 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const { - float multipler = 1.0f; + float multiplier = 1.0f; AuraList const& mTotalAuraList = GetAurasByType(auratype); for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) { Modifier* mod = (*i)->GetModifier(); if (mod->m_miscvalue == misc_value) - multipler *= (100.0f + mod->m_amount)/100.0f; + multiplier *= (100.0f + mod->m_amount)/100.0f; } - return multipler; + return multiplier; } int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const @@ -3700,7 +3705,7 @@ bool Unit::AddAura(Aura *Aur) if (!RemoveNoStackAurasDueToAura(Aur)) { delete Aur; - return false; // couldnt remove conflicting aura with higher rank + return false; // couldn't remove conflicting aura with higher rank } } @@ -3832,7 +3837,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) for(int j = 0; j < 3; ++j) { // prevent remove dummy triggered spells at next effect aura add - switch(spellProto->Effect[j]) // main spell auras added added after triggred spell + switch(spellProto->Effect[j]) // main spell auras added added after triggered spell { case SPELL_EFFECT_DUMMY: switch(spellId) @@ -4014,7 +4019,7 @@ void Unit::RemoveAurasWithDispelType( DispelType type ) { // Create dispel mask by dispel type uint32 dispelMask = GetDispellMask(type); - // Dispel all existing auras vs current dispell type + // Dispel all existing auras vs current dispel type AuraMap& auras = GetAuras(); for(AuraMap::iterator itr = auras.begin(); itr != auras.end(); ) { @@ -4459,7 +4464,7 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic sLog.outDebug("ProcDamageAndSpell: invoked due to spell id %u %s", procSpell->Id, (isTriggeredSpell?"(triggered)":"")); // Assign melee/ranged proc flags for magic attacks, that are actually melee/ranged abilities - // not assign for spell proc triggered spell to prevent infinity (or unexpacted 2-3 times) melee damage spell proc call with melee damage effect + // not assign for spell proc triggered spell to prevent infinity (or unexpected 2-3 times) melee damage spell proc call with melee damage effect // That is the question though if it's fully correct if(procSpell && !isTriggeredSpell) { @@ -4486,7 +4491,7 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic // Not much to do if no flags are set. if (procAttacker) { - // procces auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set + // processing auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set ProcDamageAndSpellFor(false,pVictim,procAttacker,attackerProcEffectAuraTypes,attType, procSpell, damage, damageSchoolMask); ProcDamageAndSpellFor(false,pVictim,procAttacker,attackerProcCastAuraTypes,attType, procSpell, damage, damageSchoolMask); } @@ -4495,7 +4500,7 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic // Not much to do if no flags are set or there is no victim if(pVictim && pVictim->isAlive() && procVictim) { - // procces auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set + // processing auras that not generate casts at proc event before auras that generate casts to prevent proc aura added at prev. proc aura execute in set pVictim->ProcDamageAndSpellFor(true,this,procVictim,victimProcEffectAuraTypes,attType,procSpell, damage, damageSchoolMask); pVictim->ProcDamageAndSpellFor(true,this,procVictim,victimProcCastAuraTypes,attType,procSpell, damage, damageSchoolMask); } @@ -4684,7 +4689,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, SpellEntry const *dummySpell, uint case 18765: case 35429: { - // prevent chain of triggred spell from same triggred spell + // prevent chain of triggered spell from same triggered spell if(procSpell && procSpell->Id==26654) return false; @@ -5704,7 +5709,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, SpellEntry const *dummySpell, uint return false; uint32 spellId = 0; - // Every Lightning Bolt and Chain Lightning spell have dublicate vs half damage and zero cost + // Every Lightning Bolt and Chain Lightning spell have duplicate vs half damage and zero cost switch (procSpell->Id) { // Lightning Bolt @@ -5747,7 +5752,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, SpellEntry const *dummySpell, uint if (procSpell->SpellFamilyFlags & 0x0000000000000002LL) ((Player*)this)->RemoveSpellCooldown(spellId); - // Hmmm.. in most case spells alredy set half basepoints but... + // Hmmm.. in most case spells already set half basepoints but... // Lightning Bolt (2-10 rank) have full basepoint and half bonus from level // As on wiki: // BUG: Rank 2 to 10 (and maybe 11) of Lightning Bolt will proc another Bolt with FULL damage (not halved). This bug is known and will probably be fixed soon. @@ -5965,7 +5970,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if( pVictim == this ) return false; - // custom chnace + // custom chance float chance = 0; switch (triggeredByAura->GetId()) { @@ -7027,7 +7032,7 @@ void Unit::RemoveAllAttackers() AttackerSet::iterator iter = m_attackers.begin(); if(!(*iter)->AttackStop()) { - sLog.outError("WORLD: Unit has an attacker that isnt attacking it!"); + sLog.outError("WORLD: Unit has an attacker that isn't attacking it!"); m_attackers.erase(iter); } } @@ -8552,7 +8557,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) if(!IsVisibleInGridForPlayer((Player *)u)) return false; - // if player is dead then he can't detect anyone in anycases + // if player is dead then he can't detect anyone in any cases if(!u->isAlive()) detect = false; } @@ -9160,7 +9165,7 @@ bool Unit::SelectHostilTarget() assert(GetTypeId()== TYPEID_UNIT); Unit* target = NULL; - //This function only useful once AI has been initilazied + //This function only useful once AI has been initialized if (!((Creature*)this)->AI()) return false; @@ -9434,7 +9439,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f { if(unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog.outError("ERROR in HandleStatModifier(): nonexisted UnitMods or wrong UnitModifierType!"); + sLog.outError("ERROR in HandleStatModifier(): non existed UnitMods or wrong UnitModifierType!"); return false; } @@ -9504,7 +9509,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co { if( unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog.outError("ERROR: trial to access nonexisted modifier value from UnitMods!"); + sLog.outError("ERROR: trial to access non existed modifier value from UnitMods!"); return 0.0f; } @@ -9534,7 +9539,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const { if(unitMod >= UNIT_MOD_END) { - sLog.outError("ERROR: trial to access nonexisted UnitMods in GetTotalAuraModValue()!"); + sLog.outError("ERROR: trial to access non existed UnitMods in GetTotalAuraModValue()!"); return 0.0f; } @@ -9841,7 +9846,7 @@ void Unit::CleanupsBeforeDelete() if(m_uint32Values) // only for fully created object { InterruptNonMeleeSpells(true); - m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted ans will deleated at call in Map::RemoveAllObjectsInRemoveList + m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList CombatStop(); ClearComboPointHolders(); DeleteThreatList(); @@ -10149,7 +10154,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag if(!found) { sLog.outError("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler",*aur,i->triggeredByAura_SpellPair.first,i->triggeredByAura_SpellPair.second); - sLog.outError("It can be deleted one from early proccesed auras:"); + sLog.outError("It can be deleted one from early processed auras:"); for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2) sLog.outError(" Spell aura %u (id:%u effect:%u)",*aur,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second); sLog.outError(" "); @@ -10402,7 +10407,7 @@ void Unit::StopMoving() clearUnitState(UNIT_STAT_MOVING); // send explicit stop packet - // rely on vmaps here because for exemple stormwind is in air + // rely on vmaps here because for example stormwind is in air //float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); //if (fabs(GetPositionZ() - z) < 2.0f) // Relocate(GetPositionX(), GetPositionY(), z); diff --git a/src/game/Unit.h b/src/game/Unit.h index decd113a1..3dfcfdcb8 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -948,12 +948,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, 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); - void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0); bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const; @@ -1348,10 +1348,10 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*) void ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, AuraTypeSet const& procAuraTypes, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage, SpellSchoolMask damageSchoolMask ); - bool HandleDummyAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown); - bool HandleProcTriggerSpell(Unit *pVictim,uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlags,WeaponAttackType attType,uint32 cooldown); - bool HandleHasteAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown); - bool HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell,uint32 cooldown); + bool HandleDummyAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown); + bool HandleProcTriggerSpell(Unit *pVictim,uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags,WeaponAttackType attType,uint32 cooldown); + bool HandleHasteAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown); + bool HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell,uint32 cooldown); uint32 m_state; // Even derived shouldn't modify uint32 m_CombatTimer; diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index 9a6940cc7..4094c851b 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -21,7 +21,7 @@ #include #include -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" struct WaypointBehavior { @@ -80,7 +80,7 @@ class WaypointManager void _addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid); void _clearPath(WaypointPath &path); - typedef HM_NAMESPACE::hash_map WaypointPathMap; + typedef UNORDERED_MAP WaypointPathMap; WaypointPathMap m_pathMap; }; diff --git a/src/game/World.h b/src/game/World.h index 108b1bb86..baa36fdb5 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -473,9 +473,9 @@ class World uint32 mail_timer; uint32 mail_timer_expires; - typedef HM_NAMESPACE::hash_map WeatherMap; + typedef UNORDERED_MAP WeatherMap; WeatherMap m_weathers; - typedef HM_NAMESPACE::hash_map SessionMap; + typedef UNORDERED_MAP SessionMap; SessionMap m_sessions; std::set m_kicked_sessions; uint32 m_maxActiveSessionCount; diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 6435d8dfc..cc8ab7381 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -33,6 +33,7 @@ #include "Policies/SingletonImp.h" #include "SystemConfig.h" #include "revision.h" +#include "revision_nr.h" #include "Config/ConfigEnv.h" #include "Database/DatabaseEnv.h" #include "CliRunnable.h" @@ -196,7 +197,7 @@ Master::~Master() /// Main function int Master::Run() { - sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID) ); + sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); sLog.outString( " to stop.\n\n" ); sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM"); diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 52624d55c..0d691cd8c 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -30,6 +30,7 @@ #include "AuthSocket.h" #include "SystemConfig.h" #include "revision.h" +#include "revision_nr.h" #include "Util.h" #ifdef WIN32 @@ -150,7 +151,7 @@ extern int main(int argc, char **argv) while (pause > clock()) {} } - sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID) ); + sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); sLog.outString( " to stop.\n" ); /// realmd PID file creation diff --git a/src/shared/Common.h b/src/shared/Common.h index 41faa2098..5c938ea67 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -79,7 +79,7 @@ // must be the first thing to include for it to work #include "MemoryLeaks.h" -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include #include #include diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index 2e50fa75e..60f9e21c4 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -332,7 +332,7 @@ void LoadDBCStores(std::string dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentTabStore, dbcPath,"TalentTab.dbc"); - // preper fast data access to bit pos of talent ranks for use at inspecting + // prepare fast data access to bit pos of talent ranks for use at inspecting { // fill table by amount of talent ranks and fill sTalentTabBitSizeInInspect // store in with (row,col,talent)->size key for correct sorting by (row,col) diff --git a/src/shared/Database/Database.h b/src/shared/Database/Database.h index 7410b07d3..ddcfe94d0 100644 --- a/src/shared/Database/Database.h +++ b/src/shared/Database/Database.h @@ -21,15 +21,15 @@ #include "zthread/Thread.h" #include "../src/zthread/ThreadImpl.h" -#include "Utilities/HashMap.h" +#include "Utilities/UnorderedMap.h" #include "Database/SqlDelayThread.h" class SqlTransaction; class SqlResultQueue; class SqlQueryHolder; -typedef HM_NAMESPACE::hash_map TransactionQueues; -typedef HM_NAMESPACE::hash_map QueryQueues; +typedef UNORDERED_MAP TransactionQueues; +typedef UNORDERED_MAP QueryQueues; #define MAX_QUERY_LEN 32*1024 diff --git a/src/shared/Database/QueryResult.h b/src/shared/Database/QueryResult.h index 4b76b3072..ca6d11923 100644 --- a/src/shared/Database/QueryResult.h +++ b/src/shared/Database/QueryResult.h @@ -33,7 +33,7 @@ class MANGOS_DLL_SPEC QueryResult uint32 GetField_idx(const std::string &name) const { - for(FieldNames::const_iterator iter = GetFiedNames().begin(); iter != GetFiedNames().end(); ++iter) + for(FieldNames::const_iterator iter = GetFieldNames().begin(); iter != GetFieldNames().end(); ++iter) { if(iter->second == name) return iter->first; @@ -53,7 +53,7 @@ class MANGOS_DLL_SPEC QueryResult uint32 GetFieldCount() const { return mFieldCount; } uint64 GetRowCount() const { return mRowCount; } - FieldNames const& GetFiedNames() const {return mFieldNames; } + FieldNames const& GetFieldNames() const {return mFieldNames; } protected: Field *mCurrentRow; diff --git a/src/shared/Makefile.am b/src/shared/Makefile.am index 915076a15..c393e6826 100644 --- a/src/shared/Makefile.am +++ b/src/shared/Makefile.am @@ -46,6 +46,7 @@ libmangosshared_a_SOURCES = \ Util.cpp \ Util.h \ WorldPacket.h \ + revision_nr.h \ revision.h # Get revision (git or svn) diff --git a/src/shared/SystemConfig.h.in b/src/shared/SystemConfig.h.in index 863fab1e5..f2bf66d06 100644 --- a/src/shared/SystemConfig.h.in +++ b/src/shared/SystemConfig.h.in @@ -27,9 +27,9 @@ #ifndef _VERSION #if PLATFORM == PLATFORM_WINDOWS -# define _VERSION(REVD,REVT,REV) "0.12.0-DEV" " (" REVD " " REVT " Revision " REV ")" +# define _VERSION(REVD,REVT,REVN,REVH) "0.12.0-DEV" " (" REVD " " REVT " Revision " REVN " - " REVH ")" #else -# define _VERSION(REVD,REVT,REV) "@VERSION@" " (" REVD " " REVT " Revision " REV ")" +# define _VERSION(REVD,REVT,REVN,REVH) "@VERSION@" " (" REVD " " REVT " Revision " REVN " - " REVH ")" #endif #endif @@ -67,7 +67,7 @@ # define _REALMD_CONFIG SYSCONFDIR"realmd.conf" #endif -#define _FULLVERSION(REVD,REVT,REV) _PACKAGENAME "/" _VERSION(REVD,REVT,REV) " for " _ENDIAN_PLATFORM +#define _FULLVERSION(REVD,REVT,REVN,REVH) _PACKAGENAME "/" _VERSION(REVD,REVT,REVN,REVH) " for " _ENDIAN_PLATFORM #define DEFAULT_PLAYER_LIMIT 100 #define DEFAULT_WORLDSERVER_PORT 8085 //8129 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h new file mode 100644 index 000000000..cd285a77d --- /dev/null +++ b/src/shared/revision_nr.h @@ -0,0 +1,4 @@ +#ifndef __REVISION_NR_H__ +#define __REVISION_NR_H__ + #define REVISION_NR "6807" +#endif // __REVISION_NR_H__ diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index 9367addc1..a9e39d93c 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -75,9 +75,9 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& if(!found) { - strcpy(data.rev_str,"Unknown"); - strcpy(data.date_str,"Unknown"); - strcpy(data.time_str,"Unknown"); + strcpy(data.rev_str,"*"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); return; } @@ -154,14 +154,14 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& } else { - strcpy(data.date_str,"Unknown"); - strcpy(data.time_str,"Unknown"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); } } else { - strcpy(data.date_str,"Unknown"); - strcpy(data.time_str,"Unknown"); + strcpy(data.date_str,"*"); + strcpy(data.time_str,"*"); } } @@ -275,7 +275,7 @@ int main(int argc, char **argv) if(res) newData = generateHeader(data.rev_str,data.date_str,data.time_str); else - newData = generateHeader("Unknown", "Unknown", "Unknown"); + newData = generateHeader("*", "*", "*"); } /// get existed header data for compare diff --git a/win/VC71/framework.vcproj b/win/VC71/framework.vcproj index a1aa5a290..519c8f481 100644 --- a/win/VC71/framework.vcproj +++ b/win/VC71/framework.vcproj @@ -190,7 +190,7 @@ RelativePath="..\..\src\framework\Utilities\EventProcessor.h"> + RelativePath="..\..\src\framework\Utilities\UnorderedMap.h"> diff --git a/win/VC71/shared.vcproj b/win/VC71/shared.vcproj index 924ccdb91..5321788cb 100644 --- a/win/VC71/shared.vcproj +++ b/win/VC71/shared.vcproj @@ -447,6 +447,9 @@ Outputs="revision.h"/> + + diff --git a/win/VC80/framework.vcproj b/win/VC80/framework.vcproj index 581235c54..9b41a6692 100644 --- a/win/VC80/framework.vcproj +++ b/win/VC80/framework.vcproj @@ -418,7 +418,7 @@ > + + diff --git a/win/VC90/framework.vcproj b/win/VC90/framework.vcproj index 4e5838779..22f889572 100644 --- a/win/VC90/framework.vcproj +++ b/win/VC90/framework.vcproj @@ -420,7 +420,7 @@ > + +