Merge branch 'master' of git@github.com:mangos/mangos

This commit is contained in:
DiSlord 2008-11-09 01:53:44 +03:00
commit eb05f7d5eb
55 changed files with 757 additions and 182 deletions

19
contrib/git_id/.gitignore vendored Normal file
View file

@ -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

219
contrib/git_id/git_id.cpp Normal file
View file

@ -0,0 +1,219 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <assert.h>
#include "../../src/framework/Platform/CompilerDefs.h"
#if PLATFORM == PLATFORM_WINDOWS
#include <direct.h>
#define popen _popen
#define pclose _pclose
#define snprintf _snprintf
#pragma warning (disable:4996)
#else
#include <unistd.h>
#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;
}

20
contrib/git_id/git_id.sln Normal file
View file

@ -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

View file

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="git_id"
ProjectGUID="{AD81BF86-050B-4605-8AF2-03C01967D784}"
RootNamespace="git_id"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\git_id.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -15,6 +15,26 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!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` -- Table structure for table `arena_team`
-- --
@ -853,7 +873,7 @@ CREATE TABLE `guild_bank_tab` (
`TabId` tinyint(1) unsigned NOT NULL default '0', `TabId` tinyint(1) unsigned NOT NULL default '0',
`TabName` varchar(100) NOT NULL default '', `TabName` varchar(100) NOT NULL default '',
`TabIcon` varchar(100) NOT NULL default '', `TabIcon` varchar(100) NOT NULL default '',
`TabText` varchar(500) NOT NULL default '', `TabText` text,
PRIMARY KEY (`guildid`,`TabId`), PRIMARY KEY (`guildid`,`TabId`),
KEY `guildid_key` (`guildid`) KEY `guildid_key` (`guildid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View file

@ -15,6 +15,27 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!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` -- Table structure for table `areatrigger_involvedrelation`
-- --
@ -790,27 +811,6 @@ LOCK TABLES `creature_template_addon` WRITE;
/*!40000 ALTER TABLE `creature_template_addon` ENABLE KEYS */; /*!40000 ALTER TABLE `creature_template_addon` ENABLE KEYS */;
UNLOCK TABLES; 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` -- Table structure for table `disenchant_loot_template`
-- --

View file

@ -15,6 +15,26 @@
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; /*!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` -- Table structure for table `account`
-- --
@ -28,7 +48,7 @@ CREATE TABLE `account` (
`sessionkey` longtext, `sessionkey` longtext,
`v` longtext, `v` longtext,
`s` longtext, `s` longtext,
`email` varchar(320) NOT NULL default '', `email` text,
`joindate` timestamp NOT NULL default CURRENT_TIMESTAMP, `joindate` timestamp NOT NULL default CURRENT_TIMESTAMP,
`last_ip` varchar(30) NOT NULL default '127.0.0.1', `last_ip` varchar(30) NOT NULL default '127.0.0.1',
`failed_logins` int(11) unsigned NOT NULL default '0', `failed_logins` int(11) unsigned NOT NULL default '0',

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -123,6 +123,10 @@ pkgdata_DATA = \
2008_10_31_03_mangos_command.sql \ 2008_10_31_03_mangos_command.sql \
2008_11_01_01_mangos_mangos_string.sql \ 2008_11_01_01_mangos_mangos_string.sql \
2008_11_01_02_mangos_command.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 README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -227,4 +231,8 @@ EXTRA_DIST = \
2008_10_31_03_mangos_command.sql \ 2008_10_31_03_mangos_command.sql \
2008_11_01_01_mangos_mangos_string.sql \ 2008_11_01_01_mangos_mangos_string.sql \
2008_11_01_02_mangos_command.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 README

View file

@ -20,7 +20,7 @@
#define MANGOS_OBJECTREGISTRY_H #define MANGOS_OBJECTREGISTRY_H
#include "Platform/Define.h" #include "Platform/Define.h"
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include "Policies/Singleton.h" #include "Policies/Singleton.h"
#include <string> #include <string>

View file

@ -58,6 +58,6 @@ EXTRA_DIST = \
Utilities/ByteConverter.h \ Utilities/ByteConverter.h \
Utilities/Callback.h \ Utilities/Callback.h \
Utilities/EventProcessor.h \ Utilities/EventProcessor.h \
Utilities/HashMap.h \ Utilities/UnorderedMap.h \
Utilities/LinkedList.h \ Utilities/LinkedList.h \
Utilities/TypeList.h Utilities/TypeList.h

View file

@ -16,32 +16,39 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef MANGOS_HASHMAP_H #ifndef MANGOS_UNORDERED_MAP_H
#define MANGOS_HASHMAP_H #define MANGOS_UNORDERED_MAP_H
#include "Platform/CompilerDefs.h" #include "Platform/CompilerDefs.h"
#include "Platform/Define.h" #include "Platform/Define.h"
#if COMPILER == COMPILER_INTEL #if COMPILER == COMPILER_INTEL
#include <ext/hash_map> #include <ext/hash_map>
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 4
#include <tr1/unordered_map>
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 #elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
#include <ext/hash_map> #include <ext/hash_map>
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 // VC9.0 SP1 and later
#include <unordered_map>
#else #else
#include <hash_map> #include <hash_map>
#endif #endif
#ifdef _STLPORT_VERSION #ifdef _STLPORT_VERSION
#define HM_NAMESPACE std #define UNORDERED_MAP std::hash_map
using 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 #elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
#define HM_NAMESPACE stdext #define UNORDERED_MAP stdext::hash_map
using stdext::hash_map; using stdext::hash_map;
#elif COMPILER == COMPILER_INTEL #elif COMPILER == COMPILER_INTEL
#define HM_NAMESPACE std #define UNORDERED_MAP std::hash_map
using 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 #elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
#define HM_NAMESPACE __gnu_cxx #define UNORDERED_MAP std::__gnu_cxx::hash_map
using __gnu_cxx::hash_map;
namespace __gnu_cxx namespace __gnu_cxx
{ {
@ -57,7 +64,7 @@ namespace __gnu_cxx
}; };
#else #else
#define HM_NAMESPACE std #define UNORDERED_MAP std::hash_map
using std::hash_map; using std::hash_map;
#endif #endif
#endif #endif

View file

@ -43,7 +43,7 @@ void GMTicketMgr::LoadGMTickets()
bar.step(); bar.step();
sLog.outString(); sLog.outString();
sLog.outErrorDb(">> Loaded `character_ticket`, table is empty!"); sLog.outString(">> Loaded `character_ticket`, table is empty.");
return; return;
} }

View file

@ -140,7 +140,7 @@ class MANGOS_DLL_SPEC Group
typedef std::list<MemberSlot> MemberSlotList; typedef std::list<MemberSlot> MemberSlotList;
typedef MemberSlotList::const_iterator member_citerator; typedef MemberSlotList::const_iterator member_citerator;
typedef HM_NAMESPACE::hash_map< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap; typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap;
protected: protected:
typedef MemberSlotList::iterator member_witerator; typedef MemberSlotList::iterator member_witerator;
typedef std::set<uint64> InvitesList; typedef std::set<uint64> InvitesList;

View file

@ -329,6 +329,18 @@ class Guild
{ {
return (members.find(LowGuid) != members.end()); 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 Roster(WorldSession *session);
void Query(WorldSession *session); void Query(WorldSession *session);

View file

@ -171,26 +171,20 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
return; 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);
return;
}
if(plGuid == guild->GetLeader())
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
if(!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
if(slot->RankId == GR_GUILDMASTER)
{
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return;
}
guild->DelMember(plGuid); guild->DelMember(plGuid);
// Put record into guildlog // Put record into guildlog
guild->LogGuildEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), 0); guild->LogGuildEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, GetPlayer()->GetGUIDLow(), GUID_LOPART(plGuid), 0);
@ -299,29 +293,25 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
return; 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; return;
} }
else if(plGuid == GetPlayer()->GetGUID())
if(plGuid == GetPlayer()->GetGUID())
{ {
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID); SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return; return;
} }
int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); if(slot->RankId < 2 || (slot->RankId-1) < GetPlayer()->GetRank())
if(plRankId == -1)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if(plRankId < 2 || (plRankId-1) < GetPlayer()->GetRank())
return; 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); guild->ChangeRank(plGuid, newRankId);
// Put record into guildlog // Put record into guildlog
@ -363,11 +353,12 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return; 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; return;
} }
@ -377,25 +368,19 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return; return;
} }
int32 plRankId = guild->GetRank(GUID_LOPART(plGuid)); if((slot->RankId+1) >= guild->GetNrRanks() || slot->RankId <= GetPlayer()->GetRank())
if(plRankId == -1)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return;
}
if((plRankId+1) >= guild->GetNrRanks() || plRankId <= GetPlayer()->GetRank())
return; return;
guild->ChangeRank(plGuid, (plRankId+1)); guild->ChangeRank(plGuid, (slot->RankId+1));
// Put record into guildlog // 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 WorldPacket data(SMSG_GUILD_EVENT, (2+30)); // guess size
data << (uint8)GE_DEMOTION; data << (uint8)GE_DEMOTION;
data << (uint8)3; data << (uint8)3;
data << GetPlayer()->GetName(); data << GetPlayer()->GetName();
data << plName; data << plName;
data << guild->GetRankName(plRankId+1); data << guild->GetRankName(slot->RankId+1);
guild->BroadcastPacket(&data); guild->BroadcastPacket(&data);
} }
@ -494,14 +479,10 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
return; return;
} }
uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name); uint64 newLeaderGUID;
MemberSlot* slot = guild->GetMemberSlot(name, newLeaderGUID);
if (!newLeaderGUID) if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return;
}
if (!guild->IsMember(GUID_LOPART(newLeaderGUID)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
@ -582,15 +563,10 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
return; return;
} }
uint64 plGuid = objmgr.GetPlayerGUIDByName(name); uint64 plGuid;
MemberSlot* slot = guild->GetMemberSlot(name, plGuid);
if (!plGuid) if (!slot)
{
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return;
}
if (!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
@ -628,15 +604,10 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
return; 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);
return;
}
if (!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;

View file

@ -24,7 +24,7 @@
#include "zthread/Mutex.h" #include "zthread/Mutex.h"
#include <list> #include <list>
#include <map> #include <map>
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include "Database/DatabaseEnv.h" #include "Database/DatabaseEnv.h"
struct InstanceTemplate; struct InstanceTemplate;
@ -118,7 +118,7 @@ class MANGOS_DLL_DECL InstanceSaveManager : public MaNGOS::Singleton<InstanceSav
~InstanceSaveManager(); ~InstanceSaveManager();
typedef std::map<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveMap; typedef std::map<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveMap;
typedef HM_NAMESPACE::hash_map<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveHashMap; typedef UNORDERED_MAP<uint32 /*InstanceId*/, InstanceSave*> InstanceSaveHashMap;
typedef std::map<uint32 /*mapId*/, InstanceSaveMap> InstanceSaveMapMap; typedef std::map<uint32 /*mapId*/, InstanceSaveMap> InstanceSaveMapMap;
/* resetTime is a global propery of each (raid/heroic) map /* resetTime is a global propery of each (raid/heroic) map

View file

@ -40,7 +40,7 @@ struct EnchStoreItem
}; };
typedef std::vector<EnchStoreItem> EnchStoreList; typedef std::vector<EnchStoreItem> EnchStoreList;
typedef HM_NAMESPACE::hash_map<uint32, EnchStoreList> EnchantmentStore; typedef UNORDERED_MAP<uint32, EnchStoreList> EnchantmentStore;
static EnchantmentStore RandomItemEnch; static EnchantmentStore RandomItemEnch;

View file

@ -30,6 +30,7 @@
#include "AccountMgr.h" #include "AccountMgr.h"
#include "SystemConfig.h" #include "SystemConfig.h"
#include "revision.h" #include "revision.h"
#include "revision_nr.h"
#include "Util.h" #include "Util.h"
bool ChatHandler::HandleHelpCommand(const char* args) bool ChatHandler::HandleHelpCommand(const char* args)
@ -95,9 +96,9 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
char const* full; char const* full;
if(m_session) 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 else
full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID); full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID);
SendSysMessage(full); SendSysMessage(full);
PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion()); PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());

View file

@ -49,7 +49,6 @@
#include "ItemEnchantmentMgr.h" #include "ItemEnchantmentMgr.h"
#include "InstanceSaveMgr.h" #include "InstanceSaveMgr.h"
#include "InstanceData.h" #include "InstanceData.h"
#include "AccountMgr.h"
//reload commands //reload commands
bool ChatHandler::HandleReloadCommand(const char* arg) bool ChatHandler::HandleReloadCommand(const char* arg)
@ -682,6 +681,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
if( !arg1 ) if( !arg1 )
return false; return false;
/// must be NULL if targeted syntax and must be not nULL if not targeted
char* arg2 = strtok(NULL, " "); char* arg2 = strtok(NULL, " ");
std::string targetAccountName; std::string targetAccountName;
@ -696,6 +696,9 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
if(arg2) if(arg2)
return false; return false;
/// security level expected in arg2 after this if.
arg2 = arg1;
targetAccountId = targetPlayer->GetSession()->GetAccountId(); targetAccountId = targetPlayer->GetSession()->GetAccountId();
targetSecurity = targetPlayer->GetSession()->GetSecurity(); targetSecurity = targetPlayer->GetSession()->GetSecurity();
if(!accmgr.GetName(targetAccountId,targetAccountName)) if(!accmgr.GetName(targetAccountId,targetAccountName))
@ -707,6 +710,10 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
} }
else else
{ {
/// wrong command syntax (second arg expected)
if(!arg2)
return false;
targetAccountName = arg1; targetAccountName = arg1;
if(!AccountMgr::normilizeString(targetAccountName)) if(!AccountMgr::normilizeString(targetAccountName))
{ {

View file

@ -120,7 +120,7 @@ class LootTemplate;
typedef std::vector<QuestItem> QuestItemList; typedef std::vector<QuestItem> QuestItemList;
typedef std::map<uint32, QuestItemList *> QuestItemMap; typedef std::map<uint32, QuestItemList *> QuestItemMap;
typedef std::vector<LootStoreItem> LootStoreItemList; typedef std::vector<LootStoreItem> LootStoreItemList;
typedef HM_NAMESPACE::hash_map<uint32, LootTemplate*> LootTemplateMap; typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap;
typedef std::set<uint32> LootIdSet; typedef std::set<uint32> LootIdSet;

View file

@ -116,7 +116,7 @@ enum LevelRequirementVsMode
#pragma pack(pop) #pragma pack(pop)
#endif #endif
typedef HM_NAMESPACE::hash_map<Creature*, CreatureMover> CreatureMoveList; typedef UNORDERED_MAP<Creature*, CreatureMover> CreatureMoveList;
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface #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 #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE

View file

@ -26,7 +26,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map
{ {
friend class MapManager; friend class MapManager;
public: public:
typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; typedef UNORDERED_MAP< uint32, Map* > InstancedMaps;
MapInstanced(uint32 id, time_t expiry); MapInstanced(uint32 id, time_t expiry);
~MapInstanced() {} ~MapInstanced() {}

View file

@ -32,8 +32,8 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
{ {
friend class MaNGOS::OperatorNew<MapManager>; friend class MaNGOS::OperatorNew<MapManager>;
typedef HM_NAMESPACE::hash_map<uint32, Map*> MapMapType; typedef UNORDERED_MAP<uint32, Map*> MapMapType;
typedef std::pair<HM_NAMESPACE::hash_map<uint32, Map*>::iterator, bool> MapMapPair; typedef std::pair<UNORDERED_MAP<uint32, Map*>::iterator, bool> MapMapPair;
public: public:

View file

@ -1261,6 +1261,8 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return; return;
} }
normalizePlayerName (charname);
Player *plr = objmgr.GetPlayer(charname.c_str()); Player *plr = objmgr.GetPlayer(charname.c_str());
if(!plr) if(!plr)

View file

@ -89,7 +89,7 @@ class Map;
class UpdateMask; class UpdateMask;
class InstanceData; class InstanceData;
typedef HM_NAMESPACE::hash_map<Player*, UpdateData> UpdateDataMapType; typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
struct WorldLocation struct WorldLocation
{ {

View file

@ -628,7 +628,7 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
/// Define the static member of HashMapHolder /// Define the static member of HashMapHolder
template <class T> HM_NAMESPACE::hash_map< uint64, T* > HashMapHolder<T>::m_objectMap; template <class T> UNORDERED_MAP< uint64, T* > HashMapHolder<T>::m_objectMap;
template <class T> ZThread::FastMutex HashMapHolder<T>::i_lock; template <class T> ZThread::FastMutex HashMapHolder<T>::i_lock;
/// Global defintions for the hashmap storage /// Global defintions for the hashmap storage

View file

@ -22,7 +22,7 @@
#include "Platform/Define.h" #include "Platform/Define.h"
#include "Policies/Singleton.h" #include "Policies/Singleton.h"
#include "zthread/FastMutex.h" #include "zthread/FastMutex.h"
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include "Policies/ThreadingModel.h" #include "Policies/ThreadingModel.h"
#include "ByteBuffer.h" #include "ByteBuffer.h"
@ -47,7 +47,7 @@ class HashMapHolder
{ {
public: public:
typedef HM_NAMESPACE::hash_map< uint64, T* > MapType; typedef UNORDERED_MAP< uint64, T* > MapType;
typedef ZThread::FastMutex LockType; typedef ZThread::FastMutex LockType;
typedef MaNGOS::GeneralLock<LockType > Guard; typedef MaNGOS::GeneralLock<LockType > Guard;
@ -89,8 +89,8 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
ObjectAccessor& operator=(const ObjectAccessor &); ObjectAccessor& operator=(const ObjectAccessor &);
public: public:
typedef HM_NAMESPACE::hash_map<uint64, Corpse* > Player2CorpsesMapType; typedef UNORDERED_MAP<uint64, Corpse* > Player2CorpsesMapType;
typedef HM_NAMESPACE::hash_map<Player*, UpdateData>::value_type UpdateDataValueType; typedef UNORDERED_MAP<Player*, UpdateData>::value_type UpdateDataValueType;
template<class T> static T* GetObjectInWorld(uint64 guid, T* /*fake*/) template<class T> static T* GetObjectInWorld(uint64 guid, T* /*fake*/)
{ {

View file

@ -72,7 +72,7 @@ struct GameTele
std::wstring wnameLow; std::wstring wnameLow;
}; };
typedef HM_NAMESPACE::hash_map<uint32, GameTele > GameTeleMap; typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
struct ScriptInfo struct ScriptInfo
{ {
@ -120,26 +120,26 @@ struct CellObjectGuids
CellGuidSet gameobjects; CellGuidSet gameobjects;
CellCorpseSet corpses; CellCorpseSet corpses;
}; };
typedef HM_NAMESPACE::hash_map<uint32/*cell_id*/,CellObjectGuids> CellObjectGuidsMap; typedef UNORDERED_MAP<uint32/*cell_id*/,CellObjectGuids> CellObjectGuidsMap;
typedef HM_NAMESPACE::hash_map<uint32/*(mapid,spawnMode) pair*/,CellObjectGuidsMap> MapObjectGuids; typedef UNORDERED_MAP<uint32/*(mapid,spawnMode) pair*/,CellObjectGuidsMap> MapObjectGuids;
typedef HM_NAMESPACE::hash_map<uint64/*(instance,guid) pair*/,time_t> RespawnTimes; typedef UNORDERED_MAP<uint64/*(instance,guid) pair*/,time_t> RespawnTimes;
struct MangosStringLocale struct MangosStringLocale
{ {
std::vector<std::string> Content; // 0 -> default, i -> i-1 locale index std::vector<std::string> Content; // 0 -> default, i -> i-1 locale index
}; };
typedef HM_NAMESPACE::hash_map<uint32,CreatureData> CreatureDataMap; typedef UNORDERED_MAP<uint32,CreatureData> CreatureDataMap;
typedef HM_NAMESPACE::hash_map<uint32,GameObjectData> GameObjectDataMap; typedef UNORDERED_MAP<uint32,GameObjectData> GameObjectDataMap;
typedef HM_NAMESPACE::hash_map<uint32,CreatureLocale> CreatureLocaleMap; typedef UNORDERED_MAP<uint32,CreatureLocale> CreatureLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,GameObjectLocale> GameObjectLocaleMap; typedef UNORDERED_MAP<uint32,GameObjectLocale> GameObjectLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,ItemLocale> ItemLocaleMap; typedef UNORDERED_MAP<uint32,ItemLocale> ItemLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,QuestLocale> QuestLocaleMap; typedef UNORDERED_MAP<uint32,QuestLocale> QuestLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,NpcTextLocale> NpcTextLocaleMap; typedef UNORDERED_MAP<uint32,NpcTextLocale> NpcTextLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,PageTextLocale> PageTextLocaleMap; typedef UNORDERED_MAP<uint32,PageTextLocale> PageTextLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,MangosStringLocale> MangosStringLocaleMap; typedef UNORDERED_MAP<uint32,MangosStringLocale> MangosStringLocaleMap;
typedef HM_NAMESPACE::hash_map<uint32,NpcOptionLocale> NpcOptionLocaleMap; typedef UNORDERED_MAP<uint32,NpcOptionLocale> NpcOptionLocaleMap;
typedef std::multimap<uint32,uint32> QuestRelations; typedef std::multimap<uint32,uint32> QuestRelations;
@ -229,11 +229,11 @@ struct PlayerCondition
}; };
// NPC gossip text id // NPC gossip text id
typedef HM_NAMESPACE::hash_map<uint32, uint32> CacheNpcTextIdMap; typedef UNORDERED_MAP<uint32, uint32> CacheNpcTextIdMap;
typedef std::list<GossipOption> CacheNpcOptionList; typedef std::list<GossipOption> CacheNpcOptionList;
typedef HM_NAMESPACE::hash_map<uint32, VendorItemData> CacheVendorItemMap; typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap;
typedef HM_NAMESPACE::hash_map<uint32, TrainerSpellData> CacheTrainerSpellMap; typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellMap;
enum SkillRangeType enum SkillRangeType
{ {
@ -271,23 +271,23 @@ class ObjectMgr
ObjectMgr(); ObjectMgr();
~ObjectMgr(); ~ObjectMgr();
typedef HM_NAMESPACE::hash_map<uint32, Item*> ItemMap; typedef UNORDERED_MAP<uint32, Item*> ItemMap;
typedef std::set< Group * > GroupSet; typedef std::set< Group * > GroupSet;
typedef std::set< Guild * > GuildSet; typedef std::set< Guild * > GuildSet;
typedef std::set< ArenaTeam * > ArenaTeamSet; typedef std::set< ArenaTeam * > ArenaTeamSet;
typedef HM_NAMESPACE::hash_map<uint32, Quest*> QuestMap; typedef UNORDERED_MAP<uint32, Quest*> QuestMap;
typedef HM_NAMESPACE::hash_map<uint32, AreaTrigger> AreaTriggerMap; typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap;
typedef HM_NAMESPACE::hash_map<uint32, std::string> AreaTriggerScriptMap; typedef UNORDERED_MAP<uint32, std::string> AreaTriggerScriptMap;
typedef HM_NAMESPACE::hash_map<uint32, ReputationOnKillEntry> RepOnKillMap; typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
typedef HM_NAMESPACE::hash_map<uint32, WeatherZoneChances> WeatherZoneMap; typedef UNORDERED_MAP<uint32, WeatherZoneChances> WeatherZoneMap;
typedef HM_NAMESPACE::hash_map<uint32, PetCreateSpellEntry> PetCreateSpellMap; typedef UNORDERED_MAP<uint32, PetCreateSpellEntry> PetCreateSpellMap;
Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);} Player* GetPlayer(const char* name) const { return ObjectAccessor::Instance().FindPlayerByName(name);}
Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); } Player* GetPlayer(uint64 guid) const { return ObjectAccessor::FindPlayer(guid); }
@ -775,10 +775,10 @@ class ObjectMgr
QuestMap mQuestTemplates; QuestMap mQuestTemplates;
typedef HM_NAMESPACE::hash_map<uint32, GossipText*> GossipTextMap; typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap;
typedef HM_NAMESPACE::hash_map<uint32, uint32> QuestAreaTriggerMap; typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap;
typedef HM_NAMESPACE::hash_map<uint32, uint32> BattleMastersMap; typedef UNORDERED_MAP<uint32, uint32> BattleMastersMap;
typedef HM_NAMESPACE::hash_map<uint32, std::string> ItemTextMap; typedef UNORDERED_MAP<uint32, std::string> ItemTextMap;
typedef std::set<uint32> TavernAreaTriggerSet; typedef std::set<uint32> TavernAreaTriggerSet;
typedef std::set<uint32> GameObjectForQuestSet; typedef std::set<uint32> GameObjectForQuestSet;

View file

@ -113,7 +113,7 @@ enum PetNameInvalidReason
PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16 PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16
}; };
typedef HM_NAMESPACE::hash_map<uint16, PetSpell*> PetSpellMap; typedef UNORDERED_MAP<uint16, PetSpell*> PetSpellMap;
typedef std::map<uint32,uint32> TeachSpellMap; typedef std::map<uint32,uint32> TeachSpellMap;
typedef std::vector<uint32> AutoSpellList; typedef std::vector<uint32> AutoSpellList;

View file

@ -88,7 +88,7 @@ struct SpellModifier
Spell const* lastAffected; Spell const* lastAffected;
}; };
typedef HM_NAMESPACE::hash_map<uint16, PlayerSpell*> PlayerSpellMap; typedef UNORDERED_MAP<uint16, PlayerSpell*> PlayerSpellMap;
typedef std::list<SpellModifier*> SpellModList; typedef std::list<SpellModifier*> SpellModList;
struct SpellCooldown struct SpellCooldown
@ -1359,7 +1359,7 @@ class MANGOS_DLL_SPEC Player : public Unit
uint8 unReadMails; uint8 unReadMails;
time_t m_nextMailDelivereTime; time_t m_nextMailDelivereTime;
typedef HM_NAMESPACE::hash_map<uint32, Item*> ItemMap; typedef UNORDERED_MAP<uint32, Item*> ItemMap;
ItemMap mMitems; //template defined in objectmgr.cpp ItemMap mMitems; //template defined in objectmgr.cpp
@ -1986,7 +1986,7 @@ class MANGOS_DLL_SPEC Player : public Unit
/*** INSTANCE SYSTEM ***/ /*** INSTANCE SYSTEM ***/
/*********************************************************/ /*********************************************************/
typedef HM_NAMESPACE::hash_map< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap; typedef UNORDERED_MAP< uint32 /*mapId*/, InstancePlayerBind > BoundInstancesMap;
void UpdateHomebindTime(uint32 time); void UpdateHomebindTime(uint32 time);

View file

@ -40,7 +40,7 @@ struct SkillDiscoveryEntry
}; };
typedef std::list<SkillDiscoveryEntry> SkillDiscoveryList; typedef std::list<SkillDiscoveryEntry> SkillDiscoveryList;
typedef HM_NAMESPACE::hash_map<int32, SkillDiscoveryList> SkillDiscoveryMap; typedef UNORDERED_MAP<int32, SkillDiscoveryList> SkillDiscoveryMap;
static SkillDiscoveryMap SkillDiscoveryStore; static SkillDiscoveryMap SkillDiscoveryStore;

View file

@ -3221,7 +3221,7 @@ uint8 Spell::CanCast(bool strict)
if (target->isInFlight()) if (target->isInFlight())
return SPELL_FAILED_BAD_TARGETS; 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; return SPELL_FAILED_LINE_OF_SIGHT;
// auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode

View file

@ -26,7 +26,7 @@
#include "Database/DBCStructure.h" #include "Database/DBCStructure.h"
#include "Database/SQLStorage.h" #include "Database/SQLStorage.h"
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include <map> #include <map>
class Player; class Player;
@ -488,7 +488,7 @@ struct SpellProcEventEntry
uint32 cooldown; // hidden cooldown used for some spell proc events, applied to _triggered_spell_ uint32 cooldown; // hidden cooldown used for some spell proc events, applied to _triggered_spell_
}; };
typedef HM_NAMESPACE::hash_map<uint32, SpellProcEventEntry> SpellProcEventMap; typedef UNORDERED_MAP<uint32, SpellProcEventEntry> SpellProcEventMap;
#define ELIXIR_BATTLE_MASK 0x1 #define ELIXIR_BATTLE_MASK 0x1
#define ELIXIR_GUARDIAN_MASK 0x2 #define ELIXIR_GUARDIAN_MASK 0x2
@ -527,7 +527,7 @@ struct SpellTargetPosition
float target_Orientation; float target_Orientation;
}; };
typedef HM_NAMESPACE::hash_map<uint32, SpellTargetPosition> SpellTargetPositionMap; typedef UNORDERED_MAP<uint32, SpellTargetPosition> SpellTargetPositionMap;
// Spell pet auras // Spell pet auras
class PetAura class PetAura
@ -590,7 +590,7 @@ struct SpellChainNode
uint8 rank; uint8 rank;
}; };
typedef HM_NAMESPACE::hash_map<uint32, SpellChainNode> SpellChainMap; typedef UNORDERED_MAP<uint32, SpellChainNode> SpellChainMap;
typedef std::multimap<uint32, uint32> SpellChainMapNext; typedef std::multimap<uint32, uint32> SpellChainMapNext;
// Spell learning properties (accessed using SpellMgr functions) // Spell learning properties (accessed using SpellMgr functions)

View file

@ -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) ); WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+4+4+4+4+1+4+4+4+pathSize*4*3) );
data.append(GetPackGUID()); data.append(GetPackGUID());
data << GetPositionX( ) data << GetPositionX();
<< GetPositionY( ) data << GetPositionY();
<< GetPositionZ( ); data << GetPositionZ();
data << GetOrientation( );
// 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 << uint8( 0 );
data << uint32( MovementFlags ); data << uint32( MovementFlags );
data << uint32( traveltime ); data << uint32( traveltime );

View file

@ -21,7 +21,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
struct WaypointBehavior 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 _addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid);
void _clearPath(WaypointPath &path); void _clearPath(WaypointPath &path);
typedef HM_NAMESPACE::hash_map<uint32, WaypointPath> WaypointPathMap; typedef UNORDERED_MAP<uint32, WaypointPath> WaypointPathMap;
WaypointPathMap m_pathMap; WaypointPathMap m_pathMap;
}; };

View file

@ -473,9 +473,9 @@ class World
uint32 mail_timer; uint32 mail_timer;
uint32 mail_timer_expires; uint32 mail_timer_expires;
typedef HM_NAMESPACE::hash_map<uint32, Weather*> WeatherMap; typedef UNORDERED_MAP<uint32, Weather*> WeatherMap;
WeatherMap m_weathers; WeatherMap m_weathers;
typedef HM_NAMESPACE::hash_map<uint32, WorldSession*> SessionMap; typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap;
SessionMap m_sessions; SessionMap m_sessions;
std::set<WorldSession*> m_kicked_sessions; std::set<WorldSession*> m_kicked_sessions;
uint32 m_maxActiveSessionCount; uint32 m_maxActiveSessionCount;

View file

@ -33,6 +33,7 @@
#include "Policies/SingletonImp.h" #include "Policies/SingletonImp.h"
#include "SystemConfig.h" #include "SystemConfig.h"
#include "revision.h" #include "revision.h"
#include "revision_nr.h"
#include "Config/ConfigEnv.h" #include "Config/ConfigEnv.h"
#include "Database/DatabaseEnv.h" #include "Database/DatabaseEnv.h"
#include "CliRunnable.h" #include "CliRunnable.h"
@ -196,7 +197,7 @@ Master::~Master()
/// Main function /// Main function
int Master::Run() 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( "<Ctrl-C> to stop.\n\n" ); sLog.outString( "<Ctrl-C> to stop.\n\n" );
sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM"); sLog.outTitle( "MM MM MM MM MMMMM MMMM MMMMM");

View file

@ -30,6 +30,7 @@
#include "AuthSocket.h" #include "AuthSocket.h"
#include "SystemConfig.h" #include "SystemConfig.h"
#include "revision.h" #include "revision.h"
#include "revision_nr.h"
#include "Util.h" #include "Util.h"
#ifdef WIN32 #ifdef WIN32
@ -150,7 +151,7 @@ extern int main(int argc, char **argv)
while (pause > clock()) {} 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( "<Ctrl-C> to stop.\n" ); sLog.outString( "<Ctrl-C> to stop.\n" );
/// realmd PID file creation /// realmd PID file creation

View file

@ -79,7 +79,7 @@
// must be the first thing to include for it to work // must be the first thing to include for it to work
#include "MemoryLeaks.h" #include "MemoryLeaks.h"
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -21,15 +21,15 @@
#include "zthread/Thread.h" #include "zthread/Thread.h"
#include "../src/zthread/ThreadImpl.h" #include "../src/zthread/ThreadImpl.h"
#include "Utilities/HashMap.h" #include "Utilities/UnorderedMap.h"
#include "Database/SqlDelayThread.h" #include "Database/SqlDelayThread.h"
class SqlTransaction; class SqlTransaction;
class SqlResultQueue; class SqlResultQueue;
class SqlQueryHolder; class SqlQueryHolder;
typedef HM_NAMESPACE::hash_map<ZThread::ThreadImpl*, SqlTransaction*> TransactionQueues; typedef UNORDERED_MAP<ZThread::ThreadImpl*, SqlTransaction*> TransactionQueues;
typedef HM_NAMESPACE::hash_map<ZThread::ThreadImpl*, SqlResultQueue*> QueryQueues; typedef UNORDERED_MAP<ZThread::ThreadImpl*, SqlResultQueue*> QueryQueues;
#define MAX_QUERY_LEN 1024 #define MAX_QUERY_LEN 1024

View file

@ -46,6 +46,7 @@ libmangosshared_a_SOURCES = \
Util.cpp \ Util.cpp \
Util.h \ Util.h \
WorldPacket.h \ WorldPacket.h \
revision_nr.h \
revision.h revision.h
# Get revision (git or svn) # Get revision (git or svn)

View file

@ -27,9 +27,9 @@
#ifndef _VERSION #ifndef _VERSION
#if PLATFORM == PLATFORM_WINDOWS #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 #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
#endif #endif
@ -67,7 +67,7 @@
# define _REALMD_CONFIG SYSCONFDIR"realmd.conf" # define _REALMD_CONFIG SYSCONFDIR"realmd.conf"
#endif #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_PLAYER_LIMIT 100
#define DEFAULT_WORLDSERVER_PORT 8085 //8129 #define DEFAULT_WORLDSERVER_PORT 8085 //8129

View file

@ -15,6 +15,7 @@
#include <dbghelp.h> #include <dbghelp.h>
#include "WheatyExceptionReport.h" #include "WheatyExceptionReport.h"
#include "revision.h" #include "revision.h"
#include "revision_nr.h"
#define CrashFolder _T("Crashs") #define CrashFolder _T("Crashs")
//#pragma comment(linker, "/defaultlib:dbghelp.lib") //#pragma comment(linker, "/defaultlib:dbghelp.lib")
@ -385,7 +386,7 @@ PEXCEPTION_POINTERS pExceptionInfo )
GetLocalTime(&systime); GetLocalTime(&systime);
// Start out with a banner // 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); _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; PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord;

4
src/shared/revision_nr.h Normal file
View file

@ -0,0 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6808"
#endif // __REVISION_NR_H__

View file

@ -75,9 +75,9 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
if(!found) if(!found)
{ {
strcpy(data.rev_str,"Unknown"); strcpy(data.rev_str,"*");
strcpy(data.date_str,"Unknown"); strcpy(data.date_str,"*");
strcpy(data.time_str,"Unknown"); strcpy(data.time_str,"*");
return; return;
} }
@ -154,14 +154,14 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData&
} }
else else
{ {
strcpy(data.date_str,"Unknown"); strcpy(data.date_str,"*");
strcpy(data.time_str,"Unknown"); strcpy(data.time_str,"*");
} }
} }
else else
{ {
strcpy(data.date_str,"Unknown"); strcpy(data.date_str,"*");
strcpy(data.time_str,"Unknown"); strcpy(data.time_str,"*");
} }
} }
@ -275,7 +275,7 @@ int main(int argc, char **argv)
if(res) if(res)
newData = generateHeader(data.rev_str,data.date_str,data.time_str); newData = generateHeader(data.rev_str,data.date_str,data.time_str);
else else
newData = generateHeader("Unknown", "Unknown", "Unknown"); newData = generateHeader("*", "*", "*");
} }
/// get existed header data for compare /// get existed header data for compare

View file

@ -190,7 +190,7 @@
RelativePath="..\..\src\framework\Utilities\EventProcessor.h"> RelativePath="..\..\src\framework\Utilities\EventProcessor.h">
</File> </File>
<File <File
RelativePath="..\..\src\framework\Utilities\HashMap.h"> RelativePath="..\..\src\framework\Utilities\UnorderedMap.h">
</File> </File>
<File <File
RelativePath="..\..\src\framework\Utilities\LinkedList.h"> RelativePath="..\..\src\framework\Utilities\LinkedList.h">

View file

@ -447,6 +447,9 @@
Outputs="revision.h"/> Outputs="revision.h"/>
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\src\shared\revision_nr.h">
</File>
<File <File
RelativePath="..\..\src\shared\ServiceWin32.cpp"> RelativePath="..\..\src\shared\ServiceWin32.cpp">
</File> </File>

View file

@ -418,7 +418,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\framework\Utilities\HashMap.h" RelativePath="..\..\src\framework\Utilities\UnorderedMap.h"
> >
</File> </File>
<File <File

View file

@ -809,6 +809,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\src\shared\revision_nr.h"
>
</File>
<File <File
RelativePath="..\..\src\shared\SystemConfig.h.in" RelativePath="..\..\src\shared\SystemConfig.h.in"
> >

View file

@ -420,7 +420,7 @@
> >
</File> </File>
<File <File
RelativePath="..\..\src\framework\Utilities\HashMap.h" RelativePath="..\..\src\framework\Utilities\UnorderedMap.h"
> >
</File> </File>
<File <File

View file

@ -805,6 +805,10 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\..\src\shared\revision_nr.h"
>
</File>
<File <File
RelativePath="..\..\src\shared\ServiceWin32.cpp" RelativePath="..\..\src\shared\ServiceWin32.cpp"
> >