Commit bff9592d authored by nanahira's avatar nanahira

Merge branch 'master' into macevent

parents ec7f8136 c7e1ea37
......@@ -85,3 +85,4 @@ core*
/*.bat
/*.sh
/*.sql
No preview for this file type
......@@ -367,12 +367,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
unsigned short count = BufferIO::ReadUInt16(pdata);
char temp1[64];
char temp2[128];
wchar_t roomname[32];
wchar_t player1[64];
wchar_t player2[64];
wchar_t hoststr[1024];
for(unsigned short i = 0; i < count; ++i) {
wchar_t roomname[32];
wchar_t player1[64];
wchar_t player2[64];
wchar_t hoststr[1024];
memcpy(temp1, pdata, 64);
pdata += 64;
BufferIO::DecodeUTF8(temp1, roomname);
......
......@@ -8,6 +8,8 @@
#ifndef _WIN32
#include <dirent.h>
#include <sys/stat.h>
#include <vector>
#include <algorithm>
#endif
#ifdef _WIN32
......@@ -109,21 +111,42 @@ public:
return MakeDir(dir);
}
struct file_unit {
std::string filename;
bool is_dir;
};
static void TraversalDir(const char* path, const std::function<void(const char*, bool)>& cb) {
DIR* dir = nullptr;
struct dirent* dirp = nullptr;
if((dir = opendir(path)) == nullptr)
return;
struct stat fileStat;
while((dirp = readdir(dir)) != nullptr) {
std::vector<file_unit> file_list;
while ((dirp = readdir(dir)) != nullptr)
{
file_unit funit;
char fname[1024];
strcpy(fname, path);
strcat(fname, "/");
strcat(fname, dirp->d_name);
stat(fname, &fileStat);
cb(dirp->d_name, S_ISDIR(fileStat.st_mode));
funit.filename = std::string(dirp->d_name);
funit.is_dir = S_ISDIR(fileStat.st_mode);
file_list.push_back(funit);
}
closedir(dir);
std::sort(file_list.begin(), file_list.end(), TraversalDirSort);
for (file_unit funit : file_list)
cb(funit.filename.c_str(), funit.is_dir);
}
static bool TraversalDirSort(file_unit file1, file_unit file2) {
if(file1.is_dir != file2.is_dir) {
return file1.is_dir;
} else {
return file1.filename < file2.filename;
}
}
static void TraversalDir(const wchar_t* wpath, const std::function<void(const wchar_t*, bool)>& cb) {
......
Subproject commit 1869873106359b64e06a263b31e2e2ad529e9933
Subproject commit cf3a323bec3209c1a004808563b397a753a16c70
Subproject commit a57b3522f6acb3d1e37a484654ef7cecf2b7f774
Subproject commit 42931d988b99711aa1ae0b86385789db4acd76c5
......@@ -858,7 +858,7 @@
!setname 0xd4 伯吉斯异兽 バージェストマ
!setname 0xd5 但丁 ダンテ
!setname 0xd6 破坏剑 破壊剣
!setname 0xd7 巴斯达·布雷达 バスター・ブレイダー
!setname 0xd7 破坏之剑士 バスター・ブレイダー
!setname 0xd8 雾动机龙 ダイナミスト
!setname 0xd9 不知火
!setname 0x10d9 妖刀-不知火 妖刀-不知火
......
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