Commit 312c981e authored by nanahira's avatar nanahira

catchup

parent b7700129
......@@ -66,17 +66,18 @@ void Game::MainTestLoop(int code) {
NetServer::InitTestCard(code);
}
void Game::LoadBetaDB() {
LoadExpansionDBDirectry("./beta");
#ifdef _WIN32
char fpath[1000];
WIN32_FIND_DATAW fdataw;
HANDLE fh = FindFirstFileW(L"./beta/*.cdb", &fdataw);
HANDLE fh = FindFirstFileW(L"./beta/*", &fdataw);
if(fh != INVALID_HANDLE_VALUE) {
do {
if(!(fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
if(wcscmp(L".",fdataw.cFileName) != 0 && wcscmp(L"..",fdataw.cFileName) != 0 && fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./beta/%s", fname);
dataManager.LoadDB(fpath);
LoadExpansionDBDirectry(fpath);
}
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
......@@ -86,12 +87,11 @@ void Game::LoadBetaDB() {
struct dirent * dirp;
if((dir = opendir("./beta/")) != NULL) {
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0)
if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
continue;
char filepath[1000];
sprintf(filepath, "./beta/%s", dirp->d_name);
dataManager.LoadDB(filepath);
sprintf(filepath, "./beta/%s/", dirp->d_name);
LoadExpansionDBDirectry(filepath);
}
closedir(dir);
}
......
......@@ -128,6 +128,7 @@ public:
void MainServerLoop();
void MainTestLoop(int code);
void LoadExpansionDB();
void LoadExpansionDBDirectry(const char* path);
void LoadBetaDB();
void AddDebugMsg(char* msgbuf);
bool MakeDirectory(const std::string folder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment