Commit 1baa901b authored by fallenstardust's avatar fallenstardust

deckmanager

parent ce14c953
This diff is collapsed.
...@@ -66,10 +66,12 @@ public: ...@@ -66,10 +66,12 @@ public:
size_t pre_extrac; size_t pre_extrac;
size_t pre_sidec; size_t pre_sidec;
code_pointer draging_pointer; code_pointer draging_pointer;
int prev_category;
int prev_deck; int prev_deck;
s32 prev_operation; s32 prev_operation;
int prev_sel; int prev_sel;
bool is_modified; bool is_modified;
bool readonly;
std::unordered_map<int, int>* filterList; std::unordered_map<int, int>* filterList;
std::vector<code_pointer> results; std::vector<code_pointer> results;
......
...@@ -8,7 +8,7 @@ namespace ygo { ...@@ -8,7 +8,7 @@ namespace ygo {
DeckManager deckManager; DeckManager deckManager;
void DeckManager::LoadLFList(const char* path, bool load_none) { void DeckManager::LoadLFListSingle(const char* path) {
LFList* cur = NULL; LFList* cur = NULL;
FILE* fp = fopen(path, "r"); FILE* fp = fopen(path, "r");
char linebuf[256]; char linebuf[256];
...@@ -24,7 +24,7 @@ void DeckManager::LoadLFList(const char* path, bool load_none) { ...@@ -24,7 +24,7 @@ void DeckManager::LoadLFList(const char* path, bool load_none) {
LFList newlist; LFList newlist;
_lfList.push_back(newlist); _lfList.push_back(newlist);
cur = &_lfList[_lfList.size() - 1]; cur = &_lfList[_lfList.size() - 1];
memcpy(cur->listName, (const void*)strBuffer, 40); memcpy(cur->listName, (const void*)strBuffer, 20 * sizeof(wchar_t));
cur->listName[sa] = 0; cur->listName[sa] = 0;
cur->content = new std::unordered_map<int, int>; cur->content = new std::unordered_map<int, int>;
cur->hash = 0x7dfcee6a; cur->hash = 0x7dfcee6a;
...@@ -48,31 +48,16 @@ void DeckManager::LoadLFList(const char* path, bool load_none) { ...@@ -48,31 +48,16 @@ void DeckManager::LoadLFList(const char* path, bool load_none) {
} }
fclose(fp); fclose(fp);
} }
if(!load_none) }
return; void DeckManager::LoadLFList() {
LoadLFListSingle("expansions/lflist.conf");
LoadLFListSingle("lflist.conf");
LFList nolimit; LFList nolimit;
myswprintf(nolimit.listName, L"N/A"); myswprintf(nolimit.listName, L"N/A");
nolimit.hash = 0; nolimit.hash = 0;
nolimit.content = new std::unordered_map<int, int>; nolimit.content = new std::unordered_map<int, int>;
_lfList.push_back(nolimit); _lfList.push_back(nolimit);
} }
bool DeckManager::RenameDeck(const wchar_t* oldname, const wchar_t* newname) {
wchar_t oldfname[256];
wchar_t newfname[256];
myswprintf(oldfname, L"./deck/%ls.ydk", oldname);
myswprintf(newfname, L"./deck/%ls.ydk", newname);
#ifdef WIN32
BOOL result = MoveFileW(oldfname, newfname);
return !!result;
#else
char oldfilefn[256];
char newfilefn[256];
BufferIO::EncodeUTF8(oldfname, oldfilefn);
BufferIO::EncodeUTF8(newfname, newfilefn);
int result = rename(oldfilefn, newfilefn);
return result == 0;
#endif
}
wchar_t* DeckManager::GetLFListName(int lfhash) { wchar_t* DeckManager::GetLFListName(int lfhash) {
for(size_t i = 0; i < _lfList.size(); ++i) { for(size_t i = 0; i < _lfList.size(); ++i) {
if(_lfList[i].hash == (unsigned int)lfhash) { if(_lfList[i].hash == (unsigned int)lfhash) {
...@@ -206,6 +191,37 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) { ...@@ -206,6 +191,37 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) {
deck = ndeck; deck = ndeck;
return true; return true;
} }
void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text) {
wchar_t catepath[256];
switch(index) {
case 0:
myswprintf(catepath, L"./pack");
break;
case 1:
myswprintf(catepath, mainGame->gameConf.bot_deck_path);
break;
case -1:
case 2:
case 3:
myswprintf(catepath, L"./deck");
break;
default:
myswprintf(catepath, L"./deck/%ls", text);
}
BufferIO::CopyWStr(catepath, ret, 256);
}
void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck) {
wchar_t filepath[256];
wchar_t catepath[256];
GetCategoryPath(catepath, cbCategory->getSelected(), cbCategory->getText());
myswprintf(filepath, L"%ls/%ls.ydk", catepath, cbDeck->getItem(cbDeck->getSelected()));
BufferIO::CopyWStr(filepath, ret, 256);
}
bool DeckManager::LoadDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck) {
wchar_t filepath[256];
GetDeckFile(filepath, cbCategory, cbDeck);
return LoadDeck(filepath);
}
FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) { FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
#ifdef WIN32 #ifdef WIN32
FILE* fp = _wfopen(file, (wchar_t*)mode); FILE* fp = _wfopen(file, (wchar_t*)mode);
...@@ -218,11 +234,11 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) { ...@@ -218,11 +234,11 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
} }
bool DeckManager::LoadDeck(const wchar_t* file) { bool DeckManager::LoadDeck(const wchar_t* file) {
int sp = 0, ct = 0, mainc = 0, sidec = 0, code; int sp = 0, ct = 0, mainc = 0, sidec = 0, code;
wchar_t localfile[64]; FILE* fp = OpenDeckFile(file, "r");
myswprintf(localfile, L"./deck/%ls.ydk", file);
FILE* fp = OpenDeckFile(localfile, "r");
if(!fp) { if(!fp) {
fp = OpenDeckFile(file, "r"); wchar_t localfile[64];
myswprintf(localfile, L"./deck/%ls.ydk", file);
fp = OpenDeckFile(localfile, "r");
} }
if(!fp) if(!fp)
return false; return false;
...@@ -248,9 +264,9 @@ bool DeckManager::LoadDeck(const wchar_t* file) { ...@@ -248,9 +264,9 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
LoadDeck(current_deck, cardlist, mainc, sidec); LoadDeck(current_deck, cardlist, mainc, sidec);
return true; return true;
} }
bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) { bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
wchar_t file[64]; if(!FileSystem::IsDirExists(L"./deck") && !FileSystem::MakeDir(L"./deck"))
myswprintf(file, L"./deck/%ls.ydk", name); return false;
FILE* fp = OpenDeckFile(file, "w"); FILE* fp = OpenDeckFile(file, "w");
if(!fp) if(!fp)
return false; return false;
...@@ -266,9 +282,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) { ...@@ -266,9 +282,7 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) {
fclose(fp); fclose(fp);
return true; return true;
} }
bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) { bool DeckManager::DeleteDeck(const wchar_t* file) {
wchar_t file[64];
myswprintf(file, L"./deck/%ls.ydk", name);
#ifdef WIN32 #ifdef WIN32
BOOL result = DeleteFileW(file); BOOL result = DeleteFileW(file);
return !!result; return !!result;
...@@ -279,13 +293,31 @@ bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) { ...@@ -279,13 +293,31 @@ bool DeckManager::DeleteDeck(Deck& deck, const wchar_t* name) {
return result == 0; return result == 0;
#endif #endif
} }
int DeckManager::TypeCount(std::vector<code_pointer> list, unsigned int ctype) { bool DeckManager::CreateCategory(const wchar_t* name) {
int res = 0; if(!FileSystem::IsDirExists(L"./deck") && !FileSystem::MakeDir(L"./deck"))
for(size_t i = 0; i < list.size(); ++i) { return false;
code_pointer cur = list[i]; if(name[0] == 0)
if(cur->second.type & ctype) return false;
res++; wchar_t localname[256];
} myswprintf(localname, L"./deck/%ls", name);
return res; return FileSystem::MakeDir(localname);
}
bool DeckManager::RenameCategory(const wchar_t* oldname, const wchar_t* newname) {
if(!FileSystem::IsDirExists(L"./deck") && !FileSystem::MakeDir(L"./deck"))
return false;
if(newname[0] == 0)
return false;
wchar_t oldlocalname[256];
wchar_t newlocalname[256];
myswprintf(oldlocalname, L"./deck/%ls", oldname);
myswprintf(newlocalname, L"./deck/%ls", newname);
return FileSystem::Rename(oldlocalname, newlocalname);
}
bool DeckManager::DeleteCategory(const wchar_t* name) {
wchar_t localname[256];
myswprintf(localname, L"./deck/%ls", name);
if(!FileSystem::IsDirExists(localname))
return false;
return FileSystem::DeleteDir(localname);
} }
} }
...@@ -35,17 +35,22 @@ public: ...@@ -35,17 +35,22 @@ public:
Deck current_deck; Deck current_deck;
std::vector<LFList> _lfList; std::vector<LFList> _lfList;
void LoadLFList(const char* path, bool load_none); void LoadLFListSingle(const char* path);
void LoadLFList();
wchar_t* GetLFListName(int lfhash); wchar_t* GetLFListName(int lfhash);
int CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg); int CheckDeck(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg);
int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec); int LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec);
bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec); bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec);
void GetCategoryPath(wchar_t* ret, int index, const wchar_t* text);
void GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
bool LoadDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
FILE* OpenDeckFile(const wchar_t * file, const char * mode); FILE* OpenDeckFile(const wchar_t * file, const char * mode);
bool LoadDeck(const wchar_t* file); bool LoadDeck(const wchar_t* file);
bool SaveDeck(Deck& deck, const wchar_t* name); bool SaveDeck(Deck& deck, const wchar_t* file);
bool DeleteDeck(Deck& deck, const wchar_t* name); bool DeleteDeck(const wchar_t* file);
static bool RenameDeck(const wchar_t* oldname, const wchar_t* newname); bool CreateCategory(const wchar_t* name);
int TypeCount(std::vector<code_pointer> list, unsigned int ctype); bool RenameCategory(const wchar_t* oldname, const wchar_t* newname);
bool DeleteCategory(const wchar_t* name);
}; };
extern DeckManager deckManager; extern DeckManager deckManager;
......
...@@ -304,6 +304,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -304,6 +304,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
} }
mainGame->env->addMessageBox(L"", msgbuf); mainGame->env->addMessageBox(L"", msgbuf);
mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
break; break;
...@@ -467,7 +468,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -467,7 +468,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->stHostPrepDuelist[3]->setText(L""); mainGame->stHostPrepDuelist[3]->setText(L"");
mainGame->stHostPrepOB->setText(L""); mainGame->stHostPrepOB->setText(L"");
mainGame->SetStaticText(mainGame->stHostPrepRule, 180 * mainGame->xScale, mainGame->guiFont, str.c_str()); mainGame->SetStaticText(mainGame->stHostPrepRule, 180 * mainGame->xScale, mainGame->guiFont, str.c_str());
mainGame->RefreshDeck(mainGame->cbDeckSelect); mainGame->RefreshCategoryDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect);
mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
if(mainGame->wCreateHost->isVisible()) if(mainGame->wCreateHost->isVisible())
mainGame->HideElement(mainGame->wCreateHost); mainGame->HideElement(mainGame->wCreateHost);
......
This diff is collapsed.
...@@ -23,10 +23,12 @@ struct Config { ...@@ -23,10 +23,12 @@ struct Config {
wchar_t lastport[10]; wchar_t lastport[10];
wchar_t nickname[20]; wchar_t nickname[20];
wchar_t gamename[20]; wchar_t gamename[20];
wchar_t lastcategory[64];
wchar_t lastdeck[64]; wchar_t lastdeck[64];
wchar_t textfont[256]; wchar_t textfont[256];
wchar_t numfont[256]; wchar_t numfont[256];
wchar_t roompass[20]; wchar_t roompass[20];
wchar_t bot_deck_path[64];
//settings //settings
int chkMAutoPos; int chkMAutoPos;
int chkSTAutoPos; int chkSTAutoPos;
...@@ -119,7 +121,9 @@ public: ...@@ -119,7 +121,9 @@ public:
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text); void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0); void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
void LoadExpansions(); void LoadExpansions();
void RefreshDeck(irr::gui::IGUIComboBox* cbDeck); void RefreshCategoryDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck, bool selectlastused = true);
void RefreshDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGUIComboBox* cbDeck);
void RefreshDeck(const wchar_t* deckpath, irr::gui::IGUIComboBox* cbDeck);
void RefreshReplay(); void RefreshReplay();
void RefreshSingleplay(); void RefreshSingleplay();
void RefreshBot(); void RefreshBot();
...@@ -251,12 +255,12 @@ public: ...@@ -251,12 +255,12 @@ public:
irr::gui::IGUICheckBox* chkRandomPos; irr::gui::IGUICheckBox* chkRandomPos;
irr::gui::IGUICheckBox* chkAutoChain; irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkAutoSaveReplay;
irr::gui::IGUIWindow* tabSystem; irr::gui::IGUIWindow* tabSystem;
irr::gui::IGUIElement* elmTabSystemLast; irr::gui::IGUIElement* elmTabSystemLast;
irr::gui::IGUIScrollBar* scrTabSystem; irr::gui::IGUIScrollBar* scrTabSystem;
irr::gui::IGUICheckBox* chkDrawFieldSpell; irr::gui::IGUICheckBox* chkDrawFieldSpell;
irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkAutoSaveReplay;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges; irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
irr::gui::IGUICheckBox* chkAutoSearch; irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkMultiKeywords; irr::gui::IGUICheckBox* chkMultiKeywords;
...@@ -303,6 +307,7 @@ public: ...@@ -303,6 +307,7 @@ public:
irr::gui::IGUIStaticText* stHostPrepDuelist[4]; irr::gui::IGUIStaticText* stHostPrepDuelist[4];
irr::gui::IGUICheckBox* chkHostPrepReady[4]; irr::gui::IGUICheckBox* chkHostPrepReady[4];
irr::gui::IGUIButton* btnHostPrepKick[4]; irr::gui::IGUIButton* btnHostPrepKick[4];
irr::gui::IGUIComboBox* cbCategorySelect;
irr::gui::IGUIComboBox* cbDeckSelect; irr::gui::IGUIComboBox* cbDeckSelect;
irr::gui::IGUIStaticText* stHostPrepRule; irr::gui::IGUIStaticText* stHostPrepRule;
irr::gui::IGUIStaticText* stHostPrepOB; irr::gui::IGUIStaticText* stHostPrepOB;
...@@ -422,8 +427,9 @@ public: ...@@ -422,8 +427,9 @@ public:
irr::gui::IGUIButton* btnEP; irr::gui::IGUIButton* btnEP;
//deck edit //deck edit
irr::gui::IGUIStaticText* wDeckEdit; irr::gui::IGUIStaticText* wDeckEdit;
irr::gui::IGUIComboBox* cbDBLFList; irr::gui::IGUIComboBox* cbDBCategory;
irr::gui::IGUIComboBox* cbDBDecks; irr::gui::IGUIComboBox* cbDBDecks;
irr::gui::IGUIButton* btnManageDeck;
irr::gui::IGUIButton* btnClearDeck; irr::gui::IGUIButton* btnClearDeck;
irr::gui::IGUIButton* btnSortDeck; irr::gui::IGUIButton* btnSortDeck;
irr::gui::IGUIButton* btnShuffleDeck; irr::gui::IGUIButton* btnShuffleDeck;
...@@ -435,12 +441,37 @@ public: ...@@ -435,12 +441,37 @@ public:
irr::gui::IGUIButton* btnSideSort; irr::gui::IGUIButton* btnSideSort;
irr::gui::IGUIButton* btnSideReload; irr::gui::IGUIButton* btnSideReload;
irr::gui::IGUIEditBox* ebDeckname; irr::gui::IGUIEditBox* ebDeckname;
irr::gui::IGUIStaticText* stDBCategory;
irr::gui::IGUIStaticText* stDeck;
irr::gui::IGUIStaticText* stCategory;
irr::gui::IGUIStaticText* stLimit;
irr::gui::IGUIStaticText* stAttribute;
irr::gui::IGUIStaticText* stRace;
irr::gui::IGUIStaticText* stAttack;
irr::gui::IGUIStaticText* stDefense;
irr::gui::IGUIStaticText* stStar;
irr::gui::IGUIStaticText* stSearch;
irr::gui::IGUIStaticText* stScale;
//deck manage
irr::gui::IGUIWindow* wDeckManage;
irr::gui::IGUIListBox* lstCategories;
irr::gui::IGUIListBox* lstDecks;
irr::gui::IGUIButton* btnNewCategory;
irr::gui::IGUIButton* btnRenameCategory;
irr::gui::IGUIButton* btnDeleteCategory;
irr::gui::IGUIButton* btnNewDeck;
irr::gui::IGUIButton* btnRenameDeck; irr::gui::IGUIButton* btnRenameDeck;
//deck rename irr::gui::IGUIButton* btnDMDeleteDeck;
irr::gui::IGUIWindow* wRenameDeck; irr::gui::IGUIButton* btnMoveDeck;
irr::gui::IGUIEditBox* ebREName; irr::gui::IGUIButton* btnCopyDeck;
irr::gui::IGUIButton* btnREYes; irr::gui::IGUIWindow* wDMQuery;
irr::gui::IGUIButton* btnRENo; irr::gui::IGUIStaticText* stDMMessage;
irr::gui::IGUIStaticText* stDMMessage2;
irr::gui::IGUIEditBox* ebDMName;
irr::gui::IGUIComboBox* cbDMCategory;
irr::gui::IGUIButton* btnDMOK;
irr::gui::IGUIButton* btnDMCancel;
irr::gui::IGUIComboBox* cbLFList;
//filter //filter
irr::gui::IGUIStaticText* wFilter; irr::gui::IGUIStaticText* wFilter;
irr::gui::IGUIScrollBar* scrFilter; irr::gui::IGUIScrollBar* scrFilter;
...@@ -552,12 +583,28 @@ extern Game* mainGame; ...@@ -552,12 +583,28 @@ extern Game* mainGame;
#define CHECKBOX_HP_READY 125 #define CHECKBOX_HP_READY 125
#define BUTTON_HP_READY 126 #define BUTTON_HP_READY 126
#define BUTTON_HP_NOTREADY 127 #define BUTTON_HP_NOTREADY 127
#define COMBOBOX_HP_CATEGORY 128
#define LISTBOX_REPLAY_LIST 130 #define LISTBOX_REPLAY_LIST 130
#define BUTTON_LOAD_REPLAY 131 #define BUTTON_LOAD_REPLAY 131
#define BUTTON_CANCEL_REPLAY 132 #define BUTTON_CANCEL_REPLAY 132
#define BUTTON_DELETE_REPLAY 133 #define BUTTON_DELETE_REPLAY 133
#define BUTTON_RENAME_REPLAY 134 #define BUTTON_RENAME_REPLAY 134
#define EDITBOX_CHAT 140 #define BUTTON_REPLAY_START 140
#define BUTTON_REPLAY_PAUSE 141
#define BUTTON_REPLAY_STEP 142
#define BUTTON_REPLAY_UNDO 143
#define BUTTON_REPLAY_EXIT 144
#define BUTTON_REPLAY_SWAP 145
#define BUTTON_REPLAY_SAVE 146
#define BUTTON_REPLAY_CANCEL 147
#define LISTBOX_SINGLEPLAY_LIST 150
#define BUTTON_LOAD_SINGLEPLAY 151
#define BUTTON_CANCEL_SINGLEPLAY 152
#define LISTBOX_BOT_LIST 153
#define BUTTON_BOT_START 154
#define CHECKBOX_BOT_OLD_RULE 155
#define EDITBOX_CHAT 199
#define BUTTON_MSG_OK 200 #define BUTTON_MSG_OK 200
#define BUTTON_YES 201 #define BUTTON_YES 201
#define BUTTON_NO 202 #define BUTTON_NO 202
...@@ -622,8 +669,8 @@ extern Game* mainGame; ...@@ -622,8 +669,8 @@ extern Game* mainGame;
#define BUTTON_DISPLAY_4 294 #define BUTTON_DISPLAY_4 294
#define SCROLL_CARD_DISPLAY 295 #define SCROLL_CARD_DISPLAY 295
#define BUTTON_CARD_DISP_OK 296 #define BUTTON_CARD_DISP_OK 296
#define BUTTON_CATEGORY_OK 300 #define BUTTON_MANAGE_DECK 300
#define COMBOBOX_DBLFLIST 301 #define COMBOBOX_DBCATEGORY 301
#define COMBOBOX_DBDECKS 302 #define COMBOBOX_DBDECKS 302
#define BUTTON_CLEAR_DECK 303 #define BUTTON_CLEAR_DECK 303
#define BUTTON_SAVE_DECK 304 #define BUTTON_SAVE_DECK 304
...@@ -642,37 +689,37 @@ extern Game* mainGame; ...@@ -642,37 +689,37 @@ extern Game* mainGame;
#define BUTTON_CLEAR_FILTER 317 #define BUTTON_CLEAR_FILTER 317
#define COMBOBOX_ATTRIBUTE 318 #define COMBOBOX_ATTRIBUTE 318
#define COMBOBOX_RACE 319 #define COMBOBOX_RACE 319
#define BUTTON_REPLAY_START 320 #define COMBOBOX_LIMIT 320
#define BUTTON_REPLAY_PAUSE 321 #define BUTTON_CATEGORY_OK 321
#define BUTTON_REPLAY_STEP 322 #define BUTTON_MARKS_FILTER 322
#define BUTTON_REPLAY_UNDO 323 #define BUTTON_MARKERS_OK 323
#define BUTTON_REPLAY_EXIT 324 #define COMBOBOX_SORTTYPE 324
#define BUTTON_REPLAY_SWAP 325
#define BUTTON_REPLAY_SAVE 330 #define WINDOW_DECK_MANAGE 330
#define BUTTON_REPLAY_CANCEL 331 #define BUTTON_NEW_CATEGORY 331
#define BUTTON_BOT_START 340 #define BUTTON_RENAME_CATEGORY 332
#define LISTBOX_BOT_LIST 341 #define BUTTON_DELETE_CATEGORY 333
#define CHECKBOX_BOT_OLD_RULE 342 #define BUTTON_NEW_DECK 334
#define LISTBOX_SINGLEPLAY_LIST 343 #define BUTTON_RENAME_DECK 335
#define BUTTON_LOAD_SINGLEPLAY 344 #define BUTTON_DELETE_DECK_DM 336
#define BUTTON_CANCEL_SINGLEPLAY 345 #define BUTTON_MOVE_DECK 337
#define SCROLL_TAB_HELPER 350 #define BUTTON_COPY_DECK 338
#define SCROLL_TAB_SYSTEM 351 #define LISTBOX_CATEGORIES 339
#define LISTBOX_DECKS 340
#define BUTTON_DM_OK 341
#define BUTTON_DM_CANCEL 342
#define COMBOBOX_LFLIST 349
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372 #define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373 #define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_DISABLE_CHAT 364 #define CHECKBOX_DISABLE_CHAT 364
#define CHECKBOX_DRAW_FIELD_SPELL 368 #define CHECKBOX_DRAW_FIELD_SPELL 368
#define CHECKBOX_QUICK_ANIMATION 369 #define CHECKBOX_QUICK_ANIMATION 369
#define COMBOBOX_SORTTYPE 370 #define SCROLL_TAB_HELPER 370
#define COMBOBOX_LIMIT 371 #define SCROLL_TAB_SYSTEM 371
#define CHECKBOX_MULTI_KEYWORDS 372
#define BUTTON_MARKS_FILTER 380 #define CHECKBOX_PREFER_EXPANSION 373
#define BUTTON_MARKERS_OK 381
#define BUTTON_RENAME_DECK 386
#define BUTTON_RENAME_DECK_SAVE 387
#define BUTTON_RENAME_DECK_CANCEL 388
#define DEFAULT_DUEL_RULE 4 #define DEFAULT_DUEL_RULE 4
......
...@@ -50,6 +50,31 @@ public: ...@@ -50,6 +50,31 @@ public:
return MakeDir(wdir); return MakeDir(wdir);
} }
static bool Rename(const wchar_t* woldname, const wchar_t* wnewname) {
return MoveFileW(woldname, wnewname);
}
static bool Rename(const char* oldname, const char* newname) {
wchar_t woldname[1024];
wchar_t wnewname[1024];
BufferIO::DecodeUTF8(oldname, woldname);
BufferIO::DecodeUTF8(newname, wnewname);
return Rename(woldname, wnewname);
}
static bool DeleteDir(const wchar_t* wdir) {
wchar_t pdir[256];
BufferIO::CopyWStr(wdir, pdir, 256);
pdir[wcslen(wdir) + 1] = 0;
SHFILEOPSTRUCTW lpFileOp;
lpFileOp.hwnd = NULL;
lpFileOp.wFunc = FO_DELETE;
lpFileOp.pFrom = pdir;
lpFileOp.pTo = 0;
lpFileOp.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
return SHFileOperationW(&lpFileOp) == 0;
}
static void TraversalDir(const wchar_t* wpath, const std::function<void(const wchar_t*, bool)>& cb) { static void TraversalDir(const wchar_t* wpath, const std::function<void(const wchar_t*, bool)>& cb) {
wchar_t findstr[1024]; wchar_t findstr[1024];
wcscpy(findstr, wpath); wcscpy(findstr, wpath);
...@@ -59,7 +84,8 @@ public: ...@@ -59,7 +84,8 @@ public:
if(fh == INVALID_HANDLE_VALUE) if(fh == INVALID_HANDLE_VALUE)
return; return;
do { do {
cb(fdataw.cFileName, (fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); if(mywcsncasecmp(fdataw.cFileName, L".", 1) && mywcsncasecmp(fdataw.cFileName, L"..", 2))
cb(fdataw.cFileName, (fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
} while(FindNextFileW(fh, &fdataw)); } while(FindNextFileW(fh, &fdataw));
FindClose(fh); FindClose(fh);
} }
......
include "lzma/." include "lzma/."
include "spmemvfs/."
project "ygopro" project "ygopro"
kind "WindowedApp" kind "WindowedApp"
files { "**.cpp", "**.cc", "**.c", "**.h" } files { "**.cpp", "**.cc", "**.c", "**.h" }
excludes "lzma/**" excludes { "lzma/**", "spmemvfs/**" }
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event" } links { "ocgcore", "clzma", "cspmemvfs", "Irrlicht", "freetype", "sqlite3", "lua" , "event" }
configuration "windows" configuration "windows"
files "ygopro.rc" files "ygopro.rc"
......
...@@ -358,6 +358,7 @@ ...@@ -358,6 +358,7 @@
!system 1325 关键字: !system 1325 关键字:
!system 1326 效果 !system 1326 效果
!system 1327 搜索 !system 1327 搜索
!system 1328 管理
!system 1329 字段: !system 1329 字段:
!system 1330 主卡组: !system 1330 主卡组:
!system 1331 额外卡组: !system 1331 额外卡组:
...@@ -432,6 +433,27 @@ ...@@ -432,6 +433,27 @@
!system 1419 副卡组数量应不超过15张,当前卡组数量为%d张。 !system 1419 副卡组数量应不超过15张,当前卡组数量为%d张。
!system 1420 有额外卡组卡片存在于主卡组,可能是额外卡组数量超过15张。 !system 1420 有额外卡组卡片存在于主卡组,可能是额外卡组数量超过15张。
!system 1421 宣言的卡不符合条件,不存在于本主机卡池中。 !system 1421 宣言的卡不符合条件,不存在于本主机卡池中。
!system 1450 卡包展示
!system 1451 人机卡组
!system 1452 未分类卡组
!system 1453 --------
!system 1460 卡组管理
!system 1461 新建分类
!system 1462 重命名分类
!system 1463 删除分类
!system 1464 新建卡组
!system 1465 重命名卡组
!system 1466 删除卡组
!system 1467 移动到分类
!system 1468 复制到分类
!system 1469 请输入分类名:
!system 1470 确实要删除此分类和分类下全部卡组吗?
!system 1471 请输入卡组名:
!system 1472 请选择要移动到的分类:
!system 1473 请选择要复制到的分类:
!system 1474 已存在同名分类
!system 1475 已存在同名卡组
!system 1476 删除失败
!system 1500 决斗结束。 !system 1500 决斗结束。
!system 1501 录像结束。 !system 1501 录像结束。
!system 1502 连接已断开。 !system 1502 连接已断开。
......
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