Commit 146f9952 authored by nanahira's avatar nanahira

catchup

parents db64011c 4a5626ea
...@@ -126,7 +126,7 @@ void ClientCard::UpdateInfo(char* buf) { ...@@ -126,7 +126,7 @@ void ClientCard::UpdateInfo(char* buf) {
if(flag & QUERY_REASON) if(flag & QUERY_REASON)
reason = BufferIO::ReadInt32(buf); reason = BufferIO::ReadInt32(buf);
if(flag & QUERY_REASON_CARD) if(flag & QUERY_REASON_CARD)
BufferIO::ReadInt32(buf); buf += 4;
if(flag & QUERY_EQUIP_CARD) { if(flag & QUERY_EQUIP_CARD) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadInt8(buf);
int l = BufferIO::ReadInt8(buf); int l = BufferIO::ReadInt8(buf);
......
...@@ -1477,11 +1477,11 @@ void ClientField::UpdateDeclarableCodeType(bool enter) { ...@@ -1477,11 +1477,11 @@ void ClientField::UpdateDeclarableCodeType(bool enter) {
return; return;
} }
for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) { for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) {
if(cit->second.name.find(pname) != std::wstring::npos) { if(cit->second.name.find(pname) != std::wstring::npos || mainGame->CheckRegEx(cit->second.name, pname)) {
auto cp = dataManager.GetCodePointer(cit->first); //verified by _strings auto cp = dataManager.GetCodePointer(cit->first); //verified by _strings
//datas.alias can be double card names or alias //datas.alias can be double card names or alias
if(is_declarable(cp->second, declarable_type)) { if(is_declarable(cp->second, declarable_type)) {
if(pname == cit->second.name) { //exact match if(pname == cit->second.name || mainGame->CheckRegEx(cit->second.name, pname, true)) { //exact match
mainGame->lstANCard->insertItem(0, cit->second.name.c_str(), -1); mainGame->lstANCard->insertItem(0, cit->second.name.c_str(), -1);
ancard.insert(ancard.begin(), cit->first); ancard.insert(ancard.begin(), cit->first);
} else { } else {
...@@ -1524,11 +1524,11 @@ void ClientField::UpdateDeclarableCodeOpcode(bool enter) { ...@@ -1524,11 +1524,11 @@ void ClientField::UpdateDeclarableCodeOpcode(bool enter) {
return; return;
} }
for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) { for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) {
if(cit->second.name.find(pname) != std::wstring::npos) { if(cit->second.name.find(pname) != std::wstring::npos || mainGame->CheckRegEx(cit->second.name, pname)) {
auto cp = dataManager.GetCodePointer(cit->first); //verified by _strings auto cp = dataManager.GetCodePointer(cit->first); //verified by _strings
//datas.alias can be double card names or alias //datas.alias can be double card names or alias
if(is_declarable(cp->second, opcode)) { if(is_declarable(cp->second, opcode)) {
if(pname == cit->second.name) { //exact match if(pname == cit->second.name || mainGame->CheckRegEx(cit->second.name, pname, true)) { //exact match
mainGame->lstANCard->insertItem(0, cit->second.name.c_str(), -1); mainGame->lstANCard->insertItem(0, cit->second.name.c_str(), -1);
ancard.insert(ancard.begin(), cit->first); ancard.insert(ancard.begin(), cit->first);
} else { } else {
......
#include "data_manager.h" #include "data_manager.h"
#include "game.h"
#include <stdio.h> #include <stdio.h>
namespace ygo { namespace ygo {
...@@ -195,7 +196,11 @@ const wchar_t* DataManager::GetSetName(int code) { ...@@ -195,7 +196,11 @@ const wchar_t* DataManager::GetSetName(int code) {
unsigned int DataManager::GetSetCode(const wchar_t* setname) { unsigned int DataManager::GetSetCode(const wchar_t* setname) {
for(auto csit = _setnameStrings.begin(); csit != _setnameStrings.end(); ++csit) { for(auto csit = _setnameStrings.begin(); csit != _setnameStrings.end(); ++csit) {
auto xpos = csit->second.find_first_of(L'|');//setname|extra info auto xpos = csit->second.find_first_of(L'|');//setname|extra info
if(csit->second.compare(0, xpos, setname) == 0) if(csit->second.compare(0, xpos, setname) == 0
#ifndef YGOPRO_SERVER_MODE
|| mainGame->CheckRegEx(csit->second, setname, true)
#endif
)
return csit->first; return csit->first;
} }
return 0; return 0;
......
...@@ -184,7 +184,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -184,7 +184,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(sel == -1) if(sel == -1)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->wRenameDeck->setText(dataManager.GetSysString(1367)); mainGame->wRenameDeck->setText(dataManager.GetSysString(1376));
mainGame->ebREName->setText(mainGame->cbDBDecks->getItem(sel)); mainGame->ebREName->setText(mainGame->cbDBDecks->getItem(sel));
mainGame->PopupElement(mainGame->wRenameDeck); mainGame->PopupElement(mainGame->wRenameDeck);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
...@@ -203,7 +203,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -203,7 +203,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(DeckManager::RenameDeck(mainGame->cbDBDecks->getItem(prev_sel), newname)) { if(DeckManager::RenameDeck(mainGame->cbDBDecks->getItem(prev_sel), newname)) {
mainGame->RefreshDeck(mainGame->cbDBDecks); mainGame->RefreshDeck(mainGame->cbDBDecks);
mainGame->cbDBDecks->setSelected(prev_sel); mainGame->cbDBDecks->setSelected(prev_sel);
mainGame->stACMessage->setText(dataManager.GetSysString(1366)); mainGame->stACMessage->setText(dataManager.GetSysString(1375));
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
} else { } else {
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1365)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1365));
...@@ -944,6 +944,7 @@ void DeckBuilder::FilterCards() { ...@@ -944,6 +944,7 @@ void DeckBuilder::FilterCards() {
int trycode = BufferIO::GetVal(elements_iterator->c_str()); int trycode = BufferIO::GetVal(elements_iterator->c_str());
bool tryresult = dataManager.GetData(trycode, 0); bool tryresult = dataManager.GetData(trycode, 0);
if(!tryresult && !CardNameContains(text.name.c_str(), elements_iterator->c_str()) && text.text.find(elements_iterator->c_str()) == std::wstring::npos if(!tryresult && !CardNameContains(text.name.c_str(), elements_iterator->c_str()) && text.text.find(elements_iterator->c_str()) == std::wstring::npos
&& !mainGame->CheckRegEx(text.text, elements_iterator->c_str())
&& (!set_code_map[*elements_iterator] || !check_set_code(data, set_code_map[*elements_iterator]))) { && (!set_code_map[*elements_iterator] || !check_set_code(data, set_code_map[*elements_iterator]))) {
is_target = false; is_target = false;
break; break;
...@@ -1011,7 +1012,7 @@ void DeckBuilder::SortList() { ...@@ -1011,7 +1012,7 @@ void DeckBuilder::SortList() {
auto left = results.begin(); auto left = results.begin();
const wchar_t* pstr = mainGame->ebCardName->getText(); const wchar_t* pstr = mainGame->ebCardName->getText();
for(auto it = results.begin(); it != results.end(); ++it) { for(auto it = results.begin(); it != results.end(); ++it) {
if(wcscmp(pstr, dataManager.GetName((*it)->first)) == 0) { if(wcscmp(pstr, dataManager.GetName((*it)->first)) == 0 || mainGame->CheckRegEx(dataManager.GetName((*it)->first), pstr, true)) {
std::iter_swap(left, it); std::iter_swap(left, it);
++left; ++left;
} }
...@@ -1059,6 +1060,8 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl ...@@ -1059,6 +1060,8 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl
if (!haystack) { if (!haystack) {
return false; return false;
} }
if(mainGame->CheckRegEx(haystack, needle))
return true;
int i = 0; int i = 0;
int j = 0; int j = 0;
while (haystack[i]) { while (haystack[i]) {
......
...@@ -712,12 +712,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -712,12 +712,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnCancelOrFinish->setVisible(false); mainGame->btnCancelOrFinish->setVisible(false);
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime); tm* localedtime = localtime(&nowtime);
char timebuf[40]; wchar_t timetext[40];
strftime(timebuf, 40, "%Y-%m-%d %H-%M-%S", localedtime); wcsftime(timetext, 40, L"%Y-%m-%d %H-%M-%S", localedtime);
size_t size = strlen(timebuf) + 1;
wchar_t timetext[80];
mbstowcs(timetext, timebuf, size);
mainGame->ebRSName->setText(timetext); mainGame->ebRSName->setText(timetext);
if(!mainGame->chkAutoSaveReplay->isChecked()) { if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340)); mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
...@@ -729,7 +726,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -729,7 +726,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
else { else {
mainGame->actionParam = 1; mainGame->actionParam = 1;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1376), timetext); myswprintf(msgbuf, dataManager.GetSysString(1367), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
......
...@@ -1857,6 +1857,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1857,6 +1857,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case CHECKBOX_REGEX: {
mainGame->gameConf.search_regex = mainGame->chkRegex->isChecked() ? 1 : 0;
if(mainGame->is_building && !mainGame->is_siding)
mainGame->deckBuilder.InstantSearch();
return true;
break;
}
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
case CHECKBOX_ENABLE_MUSIC: { case CHECKBOX_ENABLE_MUSIC: {
if(!mainGame->chkEnableMusic->isChecked()) if(!mainGame->chkEnableMusic->isChecked())
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "netserver.h" #include "netserver.h"
#include "single_mode.h" #include "single_mode.h"
#include <sstream> #include <sstream>
#include <regex>
#endif //YGOPRO_SERVER_MODE #endif //YGOPRO_SERVER_MODE
unsigned short PRO_VERSION = 0x1346; unsigned short PRO_VERSION = 0x1346;
...@@ -377,7 +378,7 @@ bool Game::Initialize() { ...@@ -377,7 +378,7 @@ bool Game::Initialize() {
chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299)); chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299));
chkQuickAnimation->setChecked(gameConf.quick_animation != 0); chkQuickAnimation->setChecked(gameConf.quick_animation != 0);
posY += 30; posY += 30;
chkAutoSaveReplay = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1375)); chkAutoSaveReplay = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1366));
chkAutoSaveReplay->setChecked(gameConf.auto_save_replay != 0); chkAutoSaveReplay->setChecked(gameConf.auto_save_replay != 0);
elmTabHelperLast = chkAutoSaveReplay; elmTabHelperLast = chkAutoSaveReplay;
//system //system
...@@ -411,9 +412,12 @@ bool Game::Initialize() { ...@@ -411,9 +412,12 @@ bool Game::Initialize() {
chkAutoSearch = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_AUTO_SEARCH, dataManager.GetSysString(1358)); chkAutoSearch = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_AUTO_SEARCH, dataManager.GetSysString(1358));
chkAutoSearch->setChecked(gameConf.auto_search_limit >= 0); chkAutoSearch->setChecked(gameConf.auto_search_limit >= 0);
posY += 30; posY += 30;
chkMultiKeywords = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_MULTI_KEYWORDS, dataManager.GetSysString(1377)); chkMultiKeywords = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_MULTI_KEYWORDS, dataManager.GetSysString(1378));
chkMultiKeywords->setChecked(gameConf.search_multiple_keywords > 0); chkMultiKeywords->setChecked(gameConf.search_multiple_keywords > 0);
posY += 30; posY += 30;
chkRegex = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_REGEX, dataManager.GetSysString(1379));
chkRegex->setChecked(gameConf.search_regex > 0);
posY += 30;
env->addStaticText(dataManager.GetSysString(1282), rect<s32>(posX + 23, posY + 3, posX + 120, posY + 28), false, false, tabSystem); env->addStaticText(dataManager.GetSysString(1282), rect<s32>(posX + 23, posY + 3, posX + 120, posY + 28), false, false, tabSystem);
btnWinResizeS = env->addButton(rect<s32>(posX + 115, posY, posX + 145, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_S, dataManager.GetSysString(1283)); btnWinResizeS = env->addButton(rect<s32>(posX + 115, posY, posX + 145, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_S, dataManager.GetSysString(1283));
btnWinResizeM = env->addButton(rect<s32>(posX + 150, posY, posX + 180, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_M, dataManager.GetSysString(1284)); btnWinResizeM = env->addButton(rect<s32>(posX + 150, posY, posX + 180, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_M, dataManager.GetSysString(1284));
...@@ -632,10 +636,10 @@ bool Game::Initialize() { ...@@ -632,10 +636,10 @@ bool Game::Initialize() {
scrFilter->setSmallStep(1); scrFilter->setSmallStep(1);
scrFilter->setVisible(false); scrFilter->setVisible(false);
//rename deck //rename deck
wRenameDeck = env->addWindow(rect<s32>(510, 200, 820, 320), false, dataManager.GetSysString(1367)); wRenameDeck = env->addWindow(rect<s32>(510, 200, 820, 320), false, dataManager.GetSysString(1376));
wRenameDeck->getCloseButton()->setVisible(false); wRenameDeck->getCloseButton()->setVisible(false);
wRenameDeck->setVisible(false); wRenameDeck->setVisible(false);
env->addStaticText(dataManager.GetSysString(1368), rect<s32>(20, 25, 290, 45), false, false, wRenameDeck); env->addStaticText(dataManager.GetSysString(1377), rect<s32>(20, 25, 290, 45), false, false, wRenameDeck);
ebREName = env->addEditBox(L"", rect<s32>(20, 50, 290, 70), true, wRenameDeck, -1); ebREName = env->addEditBox(L"", rect<s32>(20, 50, 290, 70), true, wRenameDeck, -1);
ebREName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebREName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnREYes = env->addButton(rect<s32>(70, 80, 140, 105), wRenameDeck, BUTTON_RENAME_DECK_SAVE, dataManager.GetSysString(1341)); btnREYes = env->addButton(rect<s32>(70, 80, 140, 105), wRenameDeck, BUTTON_RENAME_DECK_SAVE, dataManager.GetSysString(1341));
...@@ -1198,6 +1202,7 @@ void Game::LoadConfig() { ...@@ -1198,6 +1202,7 @@ void Game::LoadConfig() {
gameConf.separate_clear_button = 1; gameConf.separate_clear_button = 1;
gameConf.auto_search_limit = 0; gameConf.auto_search_limit = 0;
gameConf.search_multiple_keywords = 1; gameConf.search_multiple_keywords = 1;
gameConf.search_regex = 0;
gameConf.chkIgnoreDeckChanges = 0; gameConf.chkIgnoreDeckChanges = 0;
gameConf.defaultOT = 1; gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 1; gameConf.enable_bot_mode = 1;
...@@ -1275,6 +1280,8 @@ void Game::LoadConfig() { ...@@ -1275,6 +1280,8 @@ void Game::LoadConfig() {
gameConf.auto_search_limit = atoi(valbuf); gameConf.auto_search_limit = atoi(valbuf);
} else if(!strcmp(strbuf, "search_multiple_keywords")) { } else if(!strcmp(strbuf, "search_multiple_keywords")) {
gameConf.search_multiple_keywords = atoi(valbuf); gameConf.search_multiple_keywords = atoi(valbuf);
} else if(!strcmp(strbuf, "search_regex")) {
gameConf.search_regex = atoi(valbuf);
} else if(!strcmp(strbuf, "ignore_deck_changes")) { } else if(!strcmp(strbuf, "ignore_deck_changes")) {
gameConf.chkIgnoreDeckChanges = atoi(valbuf); gameConf.chkIgnoreDeckChanges = atoi(valbuf);
} else if(!strcmp(strbuf, "default_ot")) { } else if(!strcmp(strbuf, "default_ot")) {
...@@ -1391,6 +1398,8 @@ void Game::LoadConfig() { ...@@ -1391,6 +1398,8 @@ void Game::LoadConfig() {
gameConf.auto_search_limit = atoi(valbuf); gameConf.auto_search_limit = atoi(valbuf);
} else if(!strcmp(strbuf, "search_multiple_keywords")) { } else if(!strcmp(strbuf, "search_multiple_keywords")) {
gameConf.search_multiple_keywords = atoi(valbuf); gameConf.search_multiple_keywords = atoi(valbuf);
} else if(!strcmp(strbuf, "search_regex")) {
gameConf.search_regex = atoi(valbuf);
} else if(!strcmp(strbuf, "ignore_deck_changes")) { } else if(!strcmp(strbuf, "ignore_deck_changes")) {
gameConf.chkIgnoreDeckChanges = atoi(valbuf); gameConf.chkIgnoreDeckChanges = atoi(valbuf);
} else if(!strcmp(strbuf, "default_ot")) { } else if(!strcmp(strbuf, "default_ot")) {
...@@ -1521,6 +1530,7 @@ void Game::SaveConfig() { ...@@ -1521,6 +1530,7 @@ void Game::SaveConfig() {
fprintf(fp, "auto_search_limit = %d\n", gameConf.auto_search_limit); fprintf(fp, "auto_search_limit = %d\n", gameConf.auto_search_limit);
fprintf(fp, "#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator \" \". 2: with separator \"+\"\n"); fprintf(fp, "#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator \" \". 2: with separator \"+\"\n");
fprintf(fp, "search_multiple_keywords = %d\n", gameConf.search_multiple_keywords); fprintf(fp, "search_multiple_keywords = %d\n", gameConf.search_multiple_keywords);
fprintf(fp, "search_regex = %d\n", gameConf.search_regex);
fprintf(fp, "ignore_deck_changes = %d\n", (chkIgnoreDeckChanges->isChecked() ? 1 : 0)); fprintf(fp, "ignore_deck_changes = %d\n", (chkIgnoreDeckChanges->isChecked() ? 1 : 0));
fprintf(fp, "default_ot = %d\n", gameConf.defaultOT); fprintf(fp, "default_ot = %d\n", gameConf.defaultOT);
fprintf(fp, "enable_bot_mode = %d\n", gameConf.enable_bot_mode); fprintf(fp, "enable_bot_mode = %d\n", gameConf.enable_bot_mode);
...@@ -1720,7 +1730,7 @@ void Game::ErrorLog(const char* msg) { ...@@ -1720,7 +1730,7 @@ void Game::ErrorLog(const char* msg) {
if(!fp) if(!fp)
return; return;
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime); tm* localedtime = localtime(&nowtime);
char timebuf[40]; char timebuf[40];
strftime(timebuf, 40, "%Y-%m-%d %H:%M:%S", localedtime); strftime(timebuf, 40, "%Y-%m-%d %H:%M:%S", localedtime);
fprintf(fp, "[%s]%s\n", timebuf, msg); fprintf(fp, "[%s]%s\n", timebuf, msg);
...@@ -2165,6 +2175,34 @@ void Game::takeScreenshot() { ...@@ -2165,6 +2175,34 @@ void Game::takeScreenshot() {
} else } else
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING); device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
} }
bool Game::CheckRegEx(const wchar_t* text, const wchar_t* exp, bool exact) {
if(!gameConf.search_regex)
return false;
bool result;
try {
if(exact)
result = std::regex_match(text, std::wregex(exp));
else
result = std::regex_search(text, std::wregex(exp));
} catch(...) {
result = false;
}
return result;
}
bool Game::CheckRegEx(std::wstring text, const wchar_t* exp, bool exact) {
if(!gameConf.search_regex)
return false;
bool result;
try {
if(exact)
result = std::regex_match(text, std::wregex(exp));
else
result = std::regex_search(text, std::wregex(exp));
} catch(...) {
result = false;
}
return result;
}
const char* Game::GetLocaleDir(const char* dir) { const char* Game::GetLocaleDir(const char* dir) {
if(!gameConf.locale || !wcscmp(gameConf.locale, L"default")) if(!gameConf.locale || !wcscmp(gameConf.locale, L"default"))
return dir; return dir;
......
...@@ -47,6 +47,7 @@ struct Config { ...@@ -47,6 +47,7 @@ struct Config {
int separate_clear_button; int separate_clear_button;
int auto_search_limit; int auto_search_limit;
int search_multiple_keywords; int search_multiple_keywords;
int search_regex;
int chkIgnoreDeckChanges; int chkIgnoreDeckChanges;
int defaultOT; int defaultOT;
int enable_bot_mode; int enable_bot_mode;
...@@ -184,6 +185,8 @@ public: ...@@ -184,6 +185,8 @@ public:
int LocalPlayer(int player); int LocalPlayer(int player);
const wchar_t* LocalName(int local_player); const wchar_t* LocalName(int local_player);
const char* GetLocaleDir(const char* dir); const char* GetLocaleDir(const char* dir);
bool CheckRegEx(const wchar_t* text, const wchar_t* exp, bool exact = false);
bool CheckRegEx(std::wstring text, const wchar_t* exp, bool exact = false);
bool HasFocus(EGUI_ELEMENT_TYPE type) const { bool HasFocus(EGUI_ELEMENT_TYPE type) const {
irr::gui::IGUIElement* focus = env->getFocus(); irr::gui::IGUIElement* focus = env->getFocus();
...@@ -321,6 +324,7 @@ public: ...@@ -321,6 +324,7 @@ public:
irr::gui::IGUICheckBox* chkIgnoreDeckChanges; irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
irr::gui::IGUICheckBox* chkAutoSearch; irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkMultiKeywords; irr::gui::IGUICheckBox* chkMultiKeywords;
irr::gui::IGUICheckBox* chkRegex;
irr::gui::IGUICheckBox* chkEnableSound; irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic; irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIScrollBar* scrSoundVolume; irr::gui::IGUIScrollBar* scrSoundVolume;
...@@ -739,6 +743,7 @@ extern HostInfo game_info; ...@@ -739,6 +743,7 @@ extern HostInfo game_info;
#define SCROLL_TAB_SYSTEM 351 #define SCROLL_TAB_SYSTEM 351
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372 #define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_REGEX 373
#define CHECKBOX_ENABLE_SOUND 361 #define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362 #define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363 #define SCROLL_VOLUME 363
......
...@@ -475,7 +475,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -475,7 +475,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
std::wstring repinfo; std::wstring repinfo;
time_t curtime = ReplayMode::cur_replay.pheader.seed; time_t curtime = ReplayMode::cur_replay.pheader.seed;
tm* st = localtime(&curtime); tm* st = localtime(&curtime);
myswprintf(infobuf, L"%d/%d/%d %02d:%02d:%02d\n", st->tm_year + 1900, st->tm_mon + 1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec); wcsftime(infobuf, 256, L"%Y/%m/%d %H:%M:%S\n", st);
repinfo.append(infobuf); repinfo.append(infobuf);
wchar_t namebuf[4][20]; wchar_t namebuf[4][20];
ReplayMode::cur_replay.ReadName(namebuf[0]); ReplayMode::cur_replay.ReadName(namebuf[0]);
...@@ -490,7 +490,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -490,7 +490,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", namebuf[0], namebuf[1]); myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", namebuf[0], namebuf[1]);
repinfo.append(infobuf); repinfo.append(infobuf);
mainGame->ebRepStartTurn->setText(L"1"); mainGame->ebRepStartTurn->setText(L"1");
mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, (wchar_t*)repinfo.c_str()); mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, repinfo.c_str());
break; break;
} }
case LISTBOX_BOT_LIST: { case LISTBOX_BOT_LIST: {
......
...@@ -132,12 +132,9 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -132,12 +132,9 @@ int SingleMode::SinglePlayThread(void* param) {
} }
last_replay.EndRecord(); last_replay.EndRecord();
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime); tm* localedtime = localtime(&nowtime);
char timebuf[40]; wchar_t timetext[40];
strftime(timebuf, 40, "%Y-%m-%d %H-%M-%S", localedtime); wcsftime(timetext, 40, L"%Y-%m-%d %H-%M-%S", localedtime);
size_t size = strlen(timebuf) + 1;
wchar_t timetext[80];
mbstowcs(timetext, timebuf, size);
mainGame->ebRSName->setText(timetext); mainGame->ebRSName->setText(timetext);
if(!mainGame->chkAutoSaveReplay->isChecked()) { if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340)); mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
...@@ -148,7 +145,7 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -148,7 +145,7 @@ int SingleMode::SinglePlayThread(void* param) {
} else { } else {
mainGame->actionParam = 1; mainGame->actionParam = 1;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1376), timetext); myswprintf(msgbuf, dataManager.GetSysString(1367), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
......
Subproject commit 70db00ab03eed38d1138135b789066ae570ff3da Subproject commit 0abaa73057cbd1065ff137750543bd75c5d356a7
...@@ -395,18 +395,19 @@ ...@@ -395,18 +395,19 @@
!system 1363 是否删除这个录像? !system 1363 是否删除这个录像?
!system 1364 重命名录像 !system 1364 重命名录像
!system 1365 重命名失败,可能存在同名文件 !system 1365 重命名失败,可能存在同名文件
!system 1366 重命名成功 !system 1366 自动保存录像
!system 1367 重命名卡组 !system 1367 录像已自动保存为%ls.yrp
!system 1368 卡组文件:
!system 1369 提取卡组 !system 1369 提取卡组
!system 1370 星数↑ !system 1370 星数↑
!system 1371 攻击↑ !system 1371 攻击↑
!system 1372 守备↑ !system 1372 守备↑
!system 1373 名称↓ !system 1373 名称↓
!system 1374 连接标记 !system 1374 连接标记
!system 1375 自动保存录像 !system 1375 重命名成功
!system 1376 录像已自动保存为%ls.yrp !system 1376 重命名卡组
!system 1377 使用多个关键词搜索卡片 !system 1377 卡组文件:
!system 1378 使用多个关键词搜索卡片
!system 1379 使用正则表达式搜索卡片
!system 1380 人机模式 !system 1380 人机模式
!system 1381 残局模式 !system 1381 残局模式
!system 1382 人机信息: !system 1382 人机信息:
......
...@@ -30,9 +30,12 @@ separate_clear_button = 1 ...@@ -30,9 +30,12 @@ separate_clear_button = 1
auto_search_limit = 2 auto_search_limit = 2
#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+" #search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+"
search_multiple_keywords = 1 search_multiple_keywords = 1
search_regex = 0
ignore_deck_changes = 0 ignore_deck_changes = 0
default_ot = 1 default_ot = 1
enable_bot_mode = 1 enable_bot_mode = 1
quick_animation = 1
auto_save_replay = 1
window_maximized = 0 window_maximized = 0
window_width = 1024 window_width = 1024
window_height = 640 window_height = 640
......
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