mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
fix(Shared/DBC): keep DBC string when DB override column is empty (#27581)
Co-authored-by: Alvin Zhu <[email protected]> Co-authored-by: sudlud <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Alvin Zhu
sudlud
Claude Opus 5
parent
c1893c0e51
commit
90bccf4fa6
@@ -74,11 +74,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;
|
||||||
@@ -102,7 +102,12 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
|
|||||||
dataOffset += sizeof(uint8);
|
dataOffset += sizeof(uint8);
|
||||||
break;
|
break;
|
||||||
case FT_STRING:
|
case FT_STRING:
|
||||||
*reinterpret_cast<char**>(&dataValue[dataOffset]) = CloneStringToPool(fields[sqlColumnNumber].Get<std::string>());
|
// an empty column means "not overridden", not "blank it"
|
||||||
|
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*);
|
dataOffset += sizeof(char*);
|
||||||
break;
|
break;
|
||||||
case FT_SORT:
|
case FT_SORT:
|
||||||
|
|||||||
Reference in New Issue
Block a user