Skip to content

Commit

Permalink
Support for DB2 extract
Browse files Browse the repository at this point in the history
Signed-off-by: Salja <salja2012@hotmail.de>
  • Loading branch information
Salja committed Aug 1, 2012
1 parent 35b96a6 commit c22e195
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion contrib/extractor/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ void AppendDBCFileListTo(HANDLE mpqHandle, std::set<std::string>& filelist)
SFileFindClose(searchHandle);
}

void AppendDB2FileListTo(HANDLE mpqHandle, std::set<std::string>& filelist)
{
SFILE_FIND_DATA findFileData;

HANDLE searchHandle = SFileFindFirstFile(mpqHandle, "*.db2", &findFileData, NULL);
if (!searchHandle)
return;

filelist.insert(findFileData.cFileName);

while (SFileFindNextFile(searchHandle, &findFileData))
filelist.insert(findFileData.cFileName);

SFileFindClose(searchHandle);
}

uint32 ReadBuild(int locale)
{
// include build info file also
Expand Down Expand Up @@ -965,7 +981,10 @@ void ExtractDBCFiles(int locale, bool basicLocale)
// get DBC file list
ArchiveSetBounds archives = GetArchivesBounds();
for(ArchiveSet::const_iterator i = archives.first; i != archives.second;++i)
{
AppendDBCFileListTo(*i, dbcfiles);
AppendDB2FileListTo(*i, dbcfiles);
}

std::string path = output_path;
path += "/dbc/";
Expand Down Expand Up @@ -995,7 +1014,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
printf("Extracted %u DBC/DB2 files\n\n", count);
}

typedef std::pair<std::string /*full_filename*/, char const* /*locale_prefix*/> UpdatesPair;
Expand Down
2 changes: 1 addition & 1 deletion src/game/DB2Stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void LoadDB2Stores(const std::string& dataPath)
// error checks
if (bad_db2_files.size() >= DB2FileCount)
{
sLog.outError("Incorrect DataDir value in worldserver.conf or ALL required *.db2 files (%d) not found by path: %sdb2", DB2FileCount, dataPath.c_str());
sLog.outError("Incorrect DataDir value in mangosd.conf or ALL required *.db2 files (%d) not found by path: %sdb2", DB2FileCount, dataPath.c_str());
exit(1);
}
else if (!bad_db2_files.empty())
Expand Down

0 comments on commit c22e195

Please sign in to comment.