Commit 312c981e authored by nanahira's avatar nanahira

catchup

parent b7700129
...@@ -66,17 +66,18 @@ void Game::MainTestLoop(int code) { ...@@ -66,17 +66,18 @@ void Game::MainTestLoop(int code) {
NetServer::InitTestCard(code); NetServer::InitTestCard(code);
} }
void Game::LoadBetaDB() { void Game::LoadBetaDB() {
LoadExpansionDBDirectry("./beta");
#ifdef _WIN32 #ifdef _WIN32
char fpath[1000]; char fpath[1000];
WIN32_FIND_DATAW fdataw; WIN32_FIND_DATAW fdataw;
HANDLE fh = FindFirstFileW(L"./beta/*.cdb", &fdataw); HANDLE fh = FindFirstFileW(L"./beta/*", &fdataw);
if(fh != INVALID_HANDLE_VALUE) { if(fh != INVALID_HANDLE_VALUE) {
do { 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]; char fname[780];
BufferIO::EncodeUTF8(fdataw.cFileName, fname); BufferIO::EncodeUTF8(fdataw.cFileName, fname);
sprintf(fpath, "./beta/%s", fname); sprintf(fpath, "./beta/%s", fname);
dataManager.LoadDB(fpath); LoadExpansionDBDirectry(fpath);
} }
} while(FindNextFileW(fh, &fdataw)); } while(FindNextFileW(fh, &fdataw));
FindClose(fh); FindClose(fh);
...@@ -86,12 +87,11 @@ void Game::LoadBetaDB() { ...@@ -86,12 +87,11 @@ void Game::LoadBetaDB() {
struct dirent * dirp; struct dirent * dirp;
if((dir = opendir("./beta/")) != NULL) { if((dir = opendir("./beta/")) != NULL) {
while((dirp = readdir(dir)) != NULL) { while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name); if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0)
continue; continue;
char filepath[1000]; char filepath[1000];
sprintf(filepath, "./beta/%s", dirp->d_name); sprintf(filepath, "./beta/%s/", dirp->d_name);
dataManager.LoadDB(filepath); LoadExpansionDBDirectry(filepath);
} }
closedir(dir); closedir(dir);
} }
......
...@@ -128,6 +128,7 @@ public: ...@@ -128,6 +128,7 @@ public:
void MainServerLoop(); void MainServerLoop();
void MainTestLoop(int code); void MainTestLoop(int code);
void LoadExpansionDB(); void LoadExpansionDB();
void LoadExpansionDBDirectry(const char* path);
void LoadBetaDB(); void LoadBetaDB();
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
bool MakeDirectory(const std::string folder); 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