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;
|
time_t m_muteTime;
|
||||||
|
|
||||||
// Locales
|
// Locales
|
||||||
LocaleConstant GetSessionDbcLocale() const { return m_sessionDbcLocale; }
|
LocaleConstant GetSessionDbcLocale() const { return _isBot? LOCALE_enUS : m_sessionDbcLocale; }
|
||||||
LocaleConstant GetSessionDbLocaleIndex() const { return m_sessionDbLocaleIndex; }
|
LocaleConstant GetSessionDbLocaleIndex() const { return _isBot? LOCALE_enUS : m_sessionDbLocaleIndex; }
|
||||||
char const* GetAcoreString(uint32 entry) const;
|
char const* GetAcoreString(uint32 entry) const;
|
||||||
|
|
||||||
uint32 GetLatency() const { return m_latency; }
|
uint32 GetLatency() const { return m_latency; }
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ DBCDatabaseLoader::DBCDatabaseLoader(char const* tableName, char const* dbcForma
|
|||||||
_stringPool(stringPool)
|
_stringPool(stringPool)
|
||||||
{
|
{
|
||||||
// Get sql index position
|
// Get sql index position
|
||||||
int32 indexPos = -1;
|
_recordSize = DBCFileLoader::GetFormatRecordSize(_dbcFormat, &_sqlIndexPos);
|
||||||
_recordSize = DBCFileLoader::GetFormatRecordSize(_dbcFormat, &indexPos);
|
|
||||||
|
|
||||||
ASSERT(_recordSize);
|
ASSERT(_recordSize);
|
||||||
}
|
}
|
||||||
@@ -71,11 +70,11 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
|||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 indexValue = fields[_sqlIndexPos].Get<uint32>();
|
uint32 indexValue = fields[_sqlIndexPos].Get<uint32>();
|
||||||
char* dataValue = indexTable[indexValue];
|
char* oldDataValue = indexTable[indexValue];
|
||||||
|
|
||||||
// If exist in DBC file override from DB
|
// If exist in DBC file override from DB
|
||||||
newIndexes[newRecords] = indexValue;
|
newIndexes[newRecords] = indexValue;
|
||||||
dataValue = &dataTable[newRecords++ * _recordSize];
|
char* dataValue = &dataTable[newRecords++ * _recordSize];
|
||||||
|
|
||||||
uint32 dataOffset = 0;
|
uint32 dataOffset = 0;
|
||||||
uint32 sqlColumnNumber = 0;
|
uint32 sqlColumnNumber = 0;
|
||||||
@@ -99,7 +98,15 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
|||||||
dataOffset += sizeof(uint8);
|
dataOffset += sizeof(uint8);
|
||||||
break;
|
break;
|
||||||
case FT_STRING:
|
case FT_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>());
|
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].Get<std::string>());
|
||||||
|
}
|
||||||
dataOffset += sizeof(char*);
|
dataOffset += sizeof(char*);
|
||||||
break;
|
break;
|
||||||
case FT_SORT:
|
case FT_SORT:
|
||||||
|
|||||||
Reference in New Issue
Block a user