From 6b703d600bd08fa642a2e121fb53d5749d677076 Mon Sep 17 00:00:00 2001 From: QAston Date: Thu, 27 Aug 2009 17:44:30 +0200 Subject: *Add `spell_dbc` table to store dbc entries not present in client *Remove workaround from Demonic Circle code and use the sql table instead. --HG-- branch : trunk --- src/shared/Database/DBCFileLoader.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/shared/Database/DBCFileLoader.cpp') diff --git a/src/shared/Database/DBCFileLoader.cpp b/src/shared/Database/DBCFileLoader.cpp index 23f602f5c93..e7ebeedecfb 100644 --- a/src/shared/Database/DBCFileLoader.cpp +++ b/src/shared/Database/DBCFileLoader.cpp @@ -137,7 +137,7 @@ uint32 DBCFileLoader::GetFormatRecordSize(const char * format,int32* index_pos) return recordsize; } -char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**& indexTable) +char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char**& indexTable, uint32 sqlRecordCount, uint32 sqlHighestIndex, char *& sqlDataTable) { /* format STRING, NA, FLOAT,NA,INT <=> @@ -168,6 +168,10 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** if(ind>maxi)maxi=ind; } + // If higher index avalible from sql - use it instead of dbcs + if (sqlHighestIndex > maxi) + maxi = sqlHighestIndex; + ++maxi; records=maxi; indexTable=new ptr[maxi]; @@ -175,15 +179,15 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** } else { - records = recordCount; - indexTable = new ptr[recordCount]; + records = recordCount + sqlRecordCount; + indexTable = new ptr[recordCount+ sqlRecordCount]; } - char* dataTable= new char[recordCount*recordsize]; + char* dataTable= new char[(recordCount + sqlRecordCount)*recordsize]; uint32 offset=0; - for(uint32 y =0;y=0) { @@ -216,6 +220,7 @@ char* DBCFileLoader::AutoProduceData(const char* format, uint32& records, char** } } } + sqlDataTable = dataTable + offset; return dataTable; } -- cgit v1.2.3