mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
Merge pull request #1 from AlvinZhu/Playerbot
Force playerbots locale enUS and Fix multi-language DBC loading
This commit is contained in:
@@ -516,8 +516,8 @@ public:
|
||||
time_t m_muteTime;
|
||||
|
||||
// Locales
|
||||
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
|
||||
LocaleConstant GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
|
||||
LocaleConstant GetSessionDbcLocale() const { return _isBot? LOCALE_enUS : m_sessionDbcLocale; }
|
||||
LocaleConstant GetSessionDbLocaleIndex() const { return _isBot? LOCALE_enUS : m_sessionDbLocaleIndex; }
|
||||
char const* GetAcoreString(uint32 entry) const;
|
||||
|
||||
uint32 GetLatency() const { return m_latency; }
|
||||
|
||||
@@ -28,8 +28,7 @@ DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcForma
|
||||
_stringPool(stringPool)
|
||||
{
|
||||
// Get sql index position
|
||||
int32 indexPos = -1;
|
||||
_recordSize = DBCFileLoader::GetFormatRecordSize(_dbcFormat, &indexPos);
|
||||
_recordSize = DBCFileLoader::GetFormatRecordSize(_dbcFormat, &_sqlIndexPos);
|
||||
|
||||
ASSERT(_recordSize);
|
||||
}
|
||||
@@ -71,11 +70,11 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 indexValue = fields[_sqlIndexPos].Get<uint32>();
|
||||
char* dataValue = indexTable[indexValue];
|
||||
char* oldDataValue = indexTable[indexValue];
|
||||
|
||||
// If exist in DBC file override from DB
|
||||
newIndexes[newRecords] = indexValue;
|
||||
dataValue = &dataTable[newRecords++ * _recordSize];
|
||||
char* dataValue = &dataTable[newRecords++ * _recordSize];
|
||||
|
||||
uint32 dataOffset = 0;
|
||||
uint32 sqlColumnNumber = 0;
|
||||
@@ -99,7 +98,15 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
||||
dataOffset += sizeof(uint8);
|
||||
break;
|
||||
case FT_STRING:
|
||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].Get<std::string>());
|
||||
// not override string if new string is empty
|
||||
if (fields[sqlColumnNumber].Get<std::string>().empty() && oldDataValue)
|
||||
{
|
||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = *reinterpret_cast<char**>(&oldDataValue[dataOffset]);
|
||||
}
|
||||
else
|
||||
{
|
||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].Get<std::string>());
|
||||
}
|
||||
dataOffset += sizeof(char*);
|
||||
break;
|
||||
case FT_SORT:
|
||||
|
||||
Reference in New Issue
Block a user