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 70% rename from src/framework/Utilities/HashMap.h rename to src/framework/Utilities/UnorderedMap.h index 7ae3ee71f..a60319d5c 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 && _HAS_TR1 // VC9.0 SP1 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 && _HAS_TR1 +#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/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/Group.h b/src/game/Group.h index 3368cbf4f..6160fd0f2 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -140,7 +140,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 48b77141c..31da4438a 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -329,6 +329,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/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 fd8d3f117..751a1bd91 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) @@ -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)) { 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/Map.h b/src/game/Map.h index 6da1e56ae..e4f9f5839 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 2d77c730f..24a9bfbe2 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1261,6 +1261,8 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } + normalizePlayerName (charname); + Player *plr = objmgr.GetPlayer(charname.c_str()); if(!plr) diff --git a/src/game/Object.h b/src/game/Object.h index 62dfc9c58..066e54438 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.h b/src/game/ObjectMgr.h index a849df1f9..788934e42 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; enum SkillRangeType { @@ -271,23 +271,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); } @@ -775,10 +775,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 f7a372adf..c050b96b6 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -113,7 +113,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.h b/src/game/Player.h index a5222d308..3d19dc5ed 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -88,7 +88,7 @@ struct SpellModifier Spell const* lastAffected; }; -typedef HM_NAMESPACE::hash_map PlayerSpellMap; +typedef UNORDERED_MAP PlayerSpellMap; typedef std::list SpellModList; struct SpellCooldown @@ -1359,7 +1359,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 @@ -1986,7 +1986,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 d59b37b9b..b42c59eb9 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3221,7 +3221,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 diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index e67191b4d..a2a9c4834 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; @@ -488,7 +488,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 @@ -527,7 +527,7 @@ struct SpellTargetPosition float target_Orientation; }; -typedef HM_NAMESPACE::hash_map SpellTargetPositionMap; +typedef UNORDERED_MAP SpellTargetPositionMap; // Spell pet auras class PetAura @@ -590,7 +590,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 2fc48d66f..0f5ef86f9 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -384,10 +384,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 ); 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/Database.h b/src/shared/Database/Database.h index 2d4ee6181..a62675c70 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 1024 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/WheatyExceptionReport.cpp b/src/shared/WheatyExceptionReport.cpp index cf505f8d2..d37019e08 100644 --- a/src/shared/WheatyExceptionReport.cpp +++ b/src/shared/WheatyExceptionReport.cpp @@ -15,6 +15,7 @@ #include #include "WheatyExceptionReport.h" #include "revision.h" +#include "revision_nr.h" #define CrashFolder _T("Crashs") //#pragma comment(linker, "/defaultlib:dbghelp.lib") @@ -385,7 +386,7 @@ PEXCEPTION_POINTERS pExceptionInfo ) GetLocalTime(&systime); // Start out with a banner - _tprintf(_T("Revision: %s %s %s\r\n"), REVISION_DATE, REVISION_TIME, REVISION_ID); + _tprintf(_T("Revision: %s %s %s %s\r\n"), REVISION_DATE, REVISION_TIME, REVISION_NR, REVISION_ID); _tprintf(_T("Date %u:%u:%u. Time %u:%u \r\n"), systime.wDay, systime.wMonth, systime.wYear, systime.wHour, systime.wMinute); PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h new file mode 100644 index 000000000..9b275289f --- /dev/null +++ b/src/shared/revision_nr.h @@ -0,0 +1,4 @@ +#ifndef __REVISION_NR_H__ +#define __REVISION_NR_H__ + #define REVISION_NR "6808" +#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 @@ > + +