Commit 0d449202 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro

parents c3c03409 dad4962a
...@@ -606,7 +606,7 @@ void ClientField::ShowSelectOption(int select_hint) { ...@@ -606,7 +606,7 @@ void ClientField::ShowSelectOption(int select_hint) {
wchar_t textBuffer[256]; wchar_t textBuffer[256];
int count = select_options.size(); int count = select_options.size();
bool quickmode = true; bool quickmode = true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
for(auto option : select_options) { for(auto option : select_options) {
if(mainGame->guiFont->getDimension(dataManager.GetDesc(option)).Width > 310) { if(mainGame->guiFont->getDimension(dataManager.GetDesc(option)).Width > 310) {
quickmode = false; quickmode = false;
...@@ -654,7 +654,7 @@ void ClientField::ShowSelectOption(int select_hint) { ...@@ -654,7 +654,7 @@ void ClientField::ShowSelectOption(int select_hint) {
myswprintf(textBuffer, dataManager.GetSysString(555)); myswprintf(textBuffer, dataManager.GetSysString(555));
mainGame->wOptions->setText(textBuffer); mainGame->wOptions->setText(textBuffer);
mainGame->PopupElement(mainGame->wOptions); mainGame->PopupElement(mainGame->wOptions);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
void ClientField::ReplaySwap() { void ClientField::ReplaySwap() {
std::swap(deck[0], deck[1]); std::swap(deck[0], deck[1]);
......
...@@ -71,9 +71,9 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) { ...@@ -71,9 +71,9 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <memory.h> #include <memory.h>
#include <time.h> #include <time.h>
#include <thread> #include <thread>
#include <mutex>
#include "bufferio.h" #include "bufferio.h"
#include "myfilesystem.h" #include "myfilesystem.h"
#include "mymutex.h"
#include "mysignal.h" #include "mysignal.h"
#include "../ocgcore/ocgapi.h" #include "../ocgcore/ocgapi.h"
#include "../ocgcore/common.h" #include "../ocgcore/common.h"
......
...@@ -211,10 +211,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -211,10 +211,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
soundManager.PlaySoundEffect(SOUND_BUTTON); soundManager.PlaySoundEffect(SOUND_BUTTON);
switch(id) { switch(id) {
case BUTTON_CLEAR_DECK: { case BUTTON_CLEAR_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1339)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1339));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
...@@ -273,7 +273,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -273,7 +273,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int sel = mainGame->cbDBDecks->getSelected(); int sel = mainGame->cbDBDecks->getSelected();
if(sel == -1) if(sel == -1)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wDeckCode->setText(dataManager.GetSysString(1387)); mainGame->wDeckCode->setText(dataManager.GetSysString(1387));
if(deckManager.current_deck.main.size() > 0 || deckManager.current_deck.extra.size() > 0 || deckManager.current_deck.side.size() > 0) { if(deckManager.current_deck.main.size() > 0 || deckManager.current_deck.extra.size() > 0 || deckManager.current_deck.side.size() > 0) {
wchar_t deck_code[2048]; wchar_t deck_code[2048];
...@@ -284,7 +284,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -284,7 +284,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
} else } else
mainGame->ebDeckCode->setText(L""); mainGame->ebDeckCode->setText(L"");
mainGame->PopupElement(mainGame->wDeckCode); mainGame->PopupElement(mainGame->wDeckCode);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
break; break;
...@@ -314,22 +314,22 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -314,22 +314,22 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int sel = mainGame->cbDBDecks->getSelected(); int sel = mainGame->cbDBDecks->getSelected();
if(sel == -1) if(sel == -1)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
wchar_t textBuffer[256]; wchar_t textBuffer[256];
myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
...@@ -363,10 +363,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -363,10 +363,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
} }
case BUTTON_MANAGE_DECK: { case BUTTON_MANAGE_DECK: {
if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
...@@ -374,69 +374,69 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -374,69 +374,69 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NEW_CATEGORY: { case BUTTON_NEW_CATEGORY: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1469)); mainGame->stDMMessage->setText(dataManager.GetSysString(1469));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
mainGame->ebDMName->setText(L""); mainGame->ebDMName->setText(L"");
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_RENAME_CATEGORY: { case BUTTON_RENAME_CATEGORY: {
if(mainGame->lstCategories->getSelected() < 4) if(mainGame->lstCategories->getSelected() < 4)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1469)); mainGame->stDMMessage->setText(dataManager.GetSysString(1469));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
mainGame->ebDMName->setText(L""); mainGame->ebDMName->setText(L"");
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_DELETE_CATEGORY: { case BUTTON_DELETE_CATEGORY: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1470)); mainGame->stDMMessage->setText(dataManager.GetSysString(1470));
mainGame->stDMMessage2->setVisible(true); mainGame->stDMMessage2->setVisible(true);
mainGame->stDMMessage2->setText(mainGame->lstCategories->getListItem(mainGame->lstCategories->getSelected())); mainGame->stDMMessage2->setText(mainGame->lstCategories->getListItem(mainGame->lstCategories->getSelected()));
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_NEW_DECK: { case BUTTON_NEW_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1471)); mainGame->stDMMessage->setText(dataManager.GetSysString(1471));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
mainGame->ebDMName->setText(L""); mainGame->ebDMName->setText(L"");
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_RENAME_DECK: { case BUTTON_RENAME_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1471)); mainGame->stDMMessage->setText(dataManager.GetSysString(1471));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
mainGame->ebDMName->setText(L""); mainGame->ebDMName->setText(L"");
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_DELETE_DECK_DM: { case BUTTON_DELETE_DECK_DM: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1337)); mainGame->stDMMessage->setText(dataManager.GetSysString(1337));
mainGame->stDMMessage2->setVisible(true); mainGame->stDMMessage2->setVisible(true);
mainGame->stDMMessage2->setText(mainGame->lstDecks->getListItem(mainGame->lstDecks->getSelected())); mainGame->stDMMessage2->setText(mainGame->lstDecks->getListItem(mainGame->lstDecks->getSelected()));
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_MOVE_DECK: { case BUTTON_MOVE_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1472)); mainGame->stDMMessage->setText(dataManager.GetSysString(1472));
mainGame->cbDMCategory->setVisible(true); mainGame->cbDMCategory->setVisible(true);
mainGame->cbDMCategory->clear(); mainGame->cbDMCategory->clear();
...@@ -448,12 +448,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -448,12 +448,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDMCategory->addItem(mainGame->lstCategories->getListItem(i)); mainGame->cbDMCategory->addItem(mainGame->lstCategories->getListItem(i));
} }
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
case BUTTON_COPY_DECK: { case BUTTON_COPY_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1473)); mainGame->stDMMessage->setText(dataManager.GetSysString(1473));
mainGame->cbDMCategory->setVisible(true); mainGame->cbDMCategory->setVisible(true);
mainGame->cbDMCategory->clear(); mainGame->cbDMCategory->clear();
...@@ -465,7 +465,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -465,7 +465,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDMCategory->addItem(mainGame->lstCategories->getListItem(i)); mainGame->cbDMCategory->addItem(mainGame->lstCategories->getListItem(i));
} }
mainGame->PopupElement(mainGame->wDMQuery); mainGame->PopupElement(mainGame->wDMQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
...@@ -888,10 +888,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -888,10 +888,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
...@@ -904,10 +904,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -904,10 +904,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
break; break;
} }
......
...@@ -87,14 +87,14 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) { ...@@ -87,14 +87,14 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(bot_mode && !mainGame->wSinglePlay->isVisible()) if(bot_mode && !mainGame->wSinglePlay->isVisible())
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else if(!bot_mode && !mainGame->wLanWindow->isVisible()) else if(!bot_mode && !mainGame->wLanWindow->isVisible())
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
} }
...@@ -182,14 +182,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -182,14 +182,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(bot_mode && !mainGame->wSinglePlay->isVisible()) if(bot_mode && !mainGame->wSinglePlay->isVisible())
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else if(!bot_mode && !mainGame->wLanWindow->isVisible()) else if(!bot_mode && !mainGame->wLanWindow->isVisible())
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} else if(connect_state == 0x7) { } else if(connect_state == 0x7) {
if(!mainGame->dInfo.isStarted && !mainGame->is_building) { if(!mainGame->dInfo.isStarted && !mainGame->is_building) {
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
...@@ -197,7 +197,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -197,7 +197,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
if(bot_mode) if(bot_mode)
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
...@@ -208,9 +208,9 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -208,9 +208,9 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
if(events & BEV_EVENT_EOF) if(events & BEV_EVENT_EOF)
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1401)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1401));
else mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402)); else mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1502)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1502));
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
...@@ -219,11 +219,11 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -219,11 +219,11 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->stTip->setVisible(false); mainGame->stTip->setVisible(false);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set(); mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
mainGame->is_building = false; mainGame->is_building = false;
...@@ -232,7 +232,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -232,7 +232,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else else
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
} }
} }
...@@ -268,7 +268,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -268,7 +268,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
if(pkt->code == 0) if(pkt->code == 0)
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1403)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1403));
...@@ -276,12 +276,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -276,12 +276,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1404)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1404));
else if(pkt->code == 2) else if(pkt->code == 2)
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1405)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1405));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
break; break;
} }
case ERRMSG_DECKERROR: { case ERRMSG_DECKERROR: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
unsigned int code = pkt->code & 0xFFFFFFF; unsigned int code = pkt->code & 0xFFFFFFF;
int flag = pkt->code >> 28; int flag = pkt->code >> 28;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
...@@ -331,14 +331,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -331,14 +331,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->env->addMessageBox(L"", msgbuf); mainGame->env->addMessageBox(L"", msgbuf);
mainGame->cbCategorySelect->setEnabled(true); mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case ERRMSG_SIDEERROR: { case ERRMSG_SIDEERROR: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1408)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1408));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case ERRMSG_VERERROR: { case ERRMSG_VERERROR: {
...@@ -349,12 +349,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -349,12 +349,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1411), pkt->code >> 12, (pkt->code >> 4) & 0xff, pkt->code & 0xf); myswprintf(msgbuf, dataManager.GetSysString(1411), pkt->code >> 12, (pkt->code >> 4) & 0xff, pkt->code & 0xf);
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", msgbuf); mainGame->env->addMessageBox(L"", msgbuf);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
} else { } else {
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
...@@ -368,7 +368,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -368,7 +368,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
case STOC_SRVPRO_ROOMLIST: { case STOC_SRVPRO_ROOMLIST: {
is_srvpro = true; is_srvpro = true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->lstHostList->clear(); mainGame->lstHostList->clear();
hosts_srvpro.clear(); hosts_srvpro.clear();
unsigned short count = BufferIO::ReadUInt16(pdata); unsigned short count = BufferIO::ReadUInt16(pdata);
...@@ -418,7 +418,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -418,7 +418,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
mainGame->lstHostList->addItem(hoststr); mainGame->lstHostList->addItem(hoststr);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_SELECT_HAND: { case STOC_SELECT_HAND: {
...@@ -426,9 +426,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -426,9 +426,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_SELECT_TP: { case STOC_SELECT_TP: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->PopupElement(mainGame->wFTSelect); mainGame->PopupElement(mainGame->wFTSelect);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_HAND_RESULT: { case STOC_HAND_RESULT: {
...@@ -445,7 +445,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -445,7 +445,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_CHANGE_SIDE: { case STOC_CHANGE_SIDE: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->is_building = true; mainGame->is_building = true;
...@@ -478,15 +478,15 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -478,15 +478,15 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->deckBuilder.pre_extrac = deckManager.current_deck.extra.size(); mainGame->deckBuilder.pre_extrac = deckManager.current_deck.extra.size();
mainGame->deckBuilder.pre_sidec = deckManager.current_deck.side.size(); mainGame->deckBuilder.pre_sidec = deckManager.current_deck.side.size();
mainGame->device->setEventReceiver(&mainGame->deckBuilder); mainGame->device->setEventReceiver(&mainGame->deckBuilder);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_WAITING_SIDE: { case STOC_WAITING_SIDE: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->stHintMsg->setText(dataManager.GetSysString(1409)); mainGame->stHintMsg->setText(dataManager.GetSysString(1409));
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_JOIN_GAME: { case STOC_JOIN_GAME: {
...@@ -523,7 +523,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -523,7 +523,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1230)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1230));
str.append(msgbuf); str.append(msgbuf);
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(pkt->info.mode == 2) { if(pkt->info.mode == 2) {
mainGame->dInfo.isTag = true; mainGame->dInfo.isTag = true;
mainGame->chkHostPrepReady[2]->setVisible(true); mainGame->chkHostPrepReady[2]->setVisible(true);
...@@ -569,7 +569,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -569,7 +569,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->ShowElement(mainGame->wHostPrepare); mainGame->ShowElement(mainGame->wHostPrepare);
//if(!mainGame->chkIgnore1->isChecked()) //if(!mainGame->chkIgnore1->isChecked())
mainGame->wChat->setVisible(true); mainGame->wChat->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->dInfo.duel_rule = pkt->info.duel_rule; mainGame->dInfo.duel_rule = pkt->info.duel_rule;
watching = 0; watching = 0;
connect_state |= 0x4; connect_state |= 0x4;
...@@ -651,7 +651,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -651,7 +651,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case STOC_DUEL_START: { case STOC_DUEL_START: {
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
...@@ -719,12 +719,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -719,12 +719,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.tag_player[0] = false; mainGame->dInfo.tag_player[0] = false;
mainGame->dInfo.tag_player[1] = false; mainGame->dInfo.tag_player[1] = false;
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
match_kill = 0; match_kill = 0;
break; break;
} }
case STOC_DUEL_END: { case STOC_DUEL_END: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(mainGame->dInfo.player_type < 7) if(mainGame->dInfo.player_type < 7)
mainGame->btnLeaveGame->setVisible(false); mainGame->btnLeaveGame->setVisible(false);
mainGame->btnSpectatorSwap->setVisible(false); mainGame->btnSpectatorSwap->setVisible(false);
...@@ -738,13 +738,13 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -738,13 +738,13 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->stMessage->setText(dataManager.GetSysString(1500)); mainGame->stMessage->setText(dataManager.GetSysString(1500));
if(!auto_watch_mode) { if(!auto_watch_mode) {
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set(); mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
} }
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
...@@ -762,14 +762,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -762,14 +762,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else else
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
if(exit_on_return) if(exit_on_return)
mainGame->device->closeDevice(); mainGame->device->closeDevice();
break; break;
} }
case STOC_REPLAY: { case STOC_REPLAY: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wPhase->setVisible(false); mainGame->wPhase->setVisible(false);
mainGame->wSurrender->setVisible(false); mainGame->wSurrender->setVisible(false);
if(mainGame->dInfo.player_type < 7) if(mainGame->dInfo.player_type < 7)
...@@ -790,7 +790,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -790,7 +790,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
if(!mainGame->chkAutoSaveReplay->isChecked()) { if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340)); mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave); mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->replaySignal.Reset(); mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait(); mainGame->replaySignal.Wait();
} }
...@@ -800,7 +800,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -800,7 +800,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf(msgbuf, dataManager.GetSysString(1367), 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();
mainGame->WaitFrameSignal(30); mainGame->WaitFrameSignal(30);
} }
if(mainGame->actionParam || !is_host) { if(mainGame->actionParam || !is_host) {
...@@ -861,9 +861,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -861,9 +861,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
wchar_t msg[256]; wchar_t msg[256];
BufferIO::CopyWStr(pkt->msg, msg, 256); BufferIO::CopyWStr(pkt->msg, msg, 256);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->AddChatMsg(msg, player); mainGame->AddChatMsg(msg, player);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_HS_PLAYER_ENTER: { case STOC_HS_PLAYER_ENTER: {
...@@ -888,9 +888,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -888,9 +888,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
else if(pkt->pos == 1) else if(pkt->pos == 1)
BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname, 20); BufferIO::CopyWStr(pkt->name, mainGame->dInfo.clientname, 20);
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stHostPrepDuelist[pkt->pos]->setText(name); mainGame->stHostPrepDuelist[pkt->pos]->setText(name);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->FlashWindow(); mainGame->FlashWindow();
break; break;
} }
...@@ -900,7 +900,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -900,7 +900,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
unsigned char state = pkt->status & 0xf; unsigned char state = pkt->status & 0xf;
if(pos > 3) if(pos > 3)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(state < 8) { if(state < 8) {
soundManager.PlaySoundEffect(SOUND_PLAYER_ENTER); soundManager.PlaySoundEffect(SOUND_PLAYER_ENTER);
wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText(); wchar_t* prename = (wchar_t*)mainGame->stHostPrepDuelist[pos]->getText();
...@@ -944,7 +944,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -944,7 +944,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} else { } else {
mainGame->btnHostPrepStart->setEnabled(false); mainGame->btnHostPrepStart->setEnabled(false);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case STOC_HS_WATCH_CHANGE: { case STOC_HS_WATCH_CHANGE: {
...@@ -952,9 +952,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -952,9 +952,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
watching = pkt->watch_count; watching = pkt->watch_count;
wchar_t watchbuf[32]; wchar_t watchbuf[32];
myswprintf(watchbuf, L"%ls%d", dataManager.GetSysString(1253), watching); myswprintf(watchbuf, L"%ls%d", dataManager.GetSysString(1253), watching);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stHostPrepOB->setText(watchbuf); mainGame->stHostPrepOB->setText(watchbuf);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
} }
...@@ -972,24 +972,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -972,24 +972,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->waitFrame = -1; mainGame->waitFrame = -1;
mainGame->stHintMsg->setVisible(false); mainGame->stHintMsg->setVisible(false);
if(mainGame->wCardSelect->isVisible()) { if(mainGame->wCardSelect->isVisible()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->HideElement(mainGame->wOptions); mainGame->HideElement(mainGame->wOptions);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
} }
} }
if(mainGame->dInfo.time_player == 1) if(mainGame->dInfo.time_player == 1)
mainGame->dInfo.time_player = 2; mainGame->dInfo.time_player = 2;
if(is_swapping) { if(is_swapping) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.ReplaySwap(); mainGame->dField.ReplaySwap();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
is_swapping = false; is_swapping = false;
} }
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
...@@ -1039,26 +1039,26 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1039,26 +1039,26 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
default: default:
break; break;
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stMessage->setText(dataManager.GetDesc(err_desc)); mainGame->stMessage->setText(dataManager.GetDesc(err_desc));
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
select_hint = last_select_hint; select_hint = last_select_hint;
return ClientAnalyze(last_successful_msg, last_successful_msg_length); return ClientAnalyze(last_successful_msg, last_successful_msg_length);
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
if(!mainGame->dInfo.isSingleMode) { if(!mainGame->dInfo.isSingleMode) {
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set(); mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
...@@ -1072,7 +1072,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1072,7 +1072,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else else
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
if(exit_on_return) if(exit_on_return)
mainGame->device->closeDevice(); mainGame->device->closeDevice();
...@@ -1091,10 +1091,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1091,10 +1091,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case HINT_MESSAGE: { case HINT_MESSAGE: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stMessage->setText(dataManager.GetDesc(data)); mainGame->stMessage->setText(dataManager.GetDesc(data));
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
break; break;
...@@ -1107,10 +1107,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1107,10 +1107,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case HINT_OPSELECTED: { case HINT_OPSELECTED: {
myswprintf(textBuffer, dataManager.GetSysString(1510), dataManager.GetDesc(data)); myswprintf(textBuffer, dataManager.GetSysString(1510), dataManager.GetDesc(data));
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
break; break;
} }
...@@ -1124,40 +1124,40 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1124,40 +1124,40 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case HINT_RACE: { case HINT_RACE: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatRace(data)); myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatRace(data));
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
break; break;
} }
case HINT_ATTRIB: { case HINT_ATTRIB: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatAttribute(data)); myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.FormatAttribute(data));
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
break; break;
} }
case HINT_CODE: { case HINT_CODE: {
myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.GetName(data)); myswprintf(textBuffer, dataManager.GetSysString(1511), dataManager.GetName(data));
mainGame->AddLog(textBuffer, data); mainGame->AddLog(textBuffer, data);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
break; break;
} }
case HINT_NUMBER: { case HINT_NUMBER: {
myswprintf(textBuffer, dataManager.GetSysString(1512), data); myswprintf(textBuffer, dataManager.GetSysString(1512), data);
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
break; break;
} }
...@@ -1211,9 +1211,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1211,9 +1211,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
if(!mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadInt8(pbuf);
int type = BufferIO::ReadInt8(pbuf); int type = BufferIO::ReadInt8(pbuf);
...@@ -1250,10 +1250,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1250,10 +1250,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
case MSG_WAITING: { case MSG_WAITING: {
mainGame->waitFrame = 0; mainGame->waitFrame = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stHintMsg->setText(dataManager.GetSysString(1390)); mainGame->stHintMsg->setText(dataManager.GetSysString(1390));
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_START: { case MSG_START: {
...@@ -1263,7 +1263,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1263,7 +1263,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcard = 101; mainGame->showcard = 101;
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
mainGame->showcard = 0; mainGame->showcard = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
int playertype = BufferIO::ReadInt8(pbuf); int playertype = BufferIO::ReadInt8(pbuf);
mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true; mainGame->dInfo.isFirst = (playertype & 0xf) ? false : true;
if(playertype & 0xf0) if(playertype & 0xf0)
...@@ -1300,24 +1300,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1300,24 +1300,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dInfo.isReplaySwapped = false; mainGame->dInfo.isReplaySwapped = false;
mainGame->dField.ReplaySwap(); mainGame->dField.ReplaySwap();
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_UPDATE_DATA: { case MSG_UPDATE_DATA: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int location = BufferIO::ReadInt8(pbuf); int location = BufferIO::ReadInt8(pbuf);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.UpdateFieldCard(player, location, pbuf); mainGame->dField.UpdateFieldCard(player, location, pbuf);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_UPDATE_CARD: { case MSG_UPDATE_CARD: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int loc = BufferIO::ReadInt8(pbuf); int loc = BufferIO::ReadInt8(pbuf);
int seq = BufferIO::ReadInt8(pbuf); int seq = BufferIO::ReadInt8(pbuf);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.UpdateCard(player, loc, seq, pbuf); mainGame->dField.UpdateCard(player, loc, seq, pbuf);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
...@@ -1367,7 +1367,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1367,7 +1367,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->cmdFlag |= COMMAND_ATTACK; pcard->cmdFlag |= COMMAND_ATTACK;
} }
mainGame->dField.RefreshCardCountDisplay(); mainGame->dField.RefreshCardCountDisplay();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadInt8(pbuf)) {
mainGame->btnM2->setVisible(true); mainGame->btnM2->setVisible(true);
mainGame->btnM2->setEnabled(true); mainGame->btnM2->setEnabled(true);
...@@ -1378,7 +1378,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1378,7 +1378,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnEP->setEnabled(true); mainGame->btnEP->setEnabled(true);
mainGame->btnEP->setPressed(false); mainGame->btnEP->setPressed(false);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
...@@ -1529,20 +1529,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1529,20 +1529,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} else { } else {
myswprintf(textBuffer, dataManager.GetDesc(desc), dataManager.GetName(code)); myswprintf(textBuffer, dataManager.GetDesc(desc), dataManager.GetName(code));
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_YESNO: { case MSG_SELECT_YESNO: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf); /*int selecting_player = */BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf); int desc = BufferIO::ReadInt32(pbuf);
mainGame->dField.highlighting_card = 0; mainGame->dField.highlighting_card = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetDesc(desc)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, dataManager.GetDesc(desc));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_OPTION: { case MSG_SELECT_OPTION: {
...@@ -1599,10 +1599,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1599,10 +1599,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(560), mainGame->dField.select_min, mainGame->dField.select_max); else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(560), mainGame->dField.select_min, mainGame->dField.select_max);
select_hint = 0; select_hint = 0;
if (panelmode) { if (panelmode) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wCardSelect->setText(textBuffer); mainGame->wCardSelect->setText(textBuffer);
mainGame->dField.ShowSelectCard(select_ready); mainGame->dField.ShowSelectCard(select_ready);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} else { } else {
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
...@@ -1687,10 +1687,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1687,10 +1687,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(560), mainGame->dField.select_min, mainGame->dField.select_max); else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(560), mainGame->dField.select_min, mainGame->dField.select_max);
select_hint = 0; select_hint = 0;
if (panelmode) { if (panelmode) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wCardSelect->setText(textBuffer); mainGame->wCardSelect->setText(textBuffer);
mainGame->dField.ShowSelectCard(mainGame->dField.select_cancelable); mainGame->dField.ShowSelectCard(mainGame->dField.select_cancelable);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} else { } else {
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
...@@ -1775,7 +1775,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1775,7 +1775,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
DuelClient::SendResponse(); DuelClient::SendResponse();
return true; return true;
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(!conti_exist) if(!conti_exist)
mainGame->stHintMsg->setText(dataManager.GetSysString(550)); mainGame->stHintMsg->setText(dataManager.GetSysString(550));
else else
...@@ -1800,7 +1800,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1800,7 +1800,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
} }
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
...@@ -1919,9 +1919,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1919,9 +1919,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnPSDD->setVisible(true); mainGame->btnPSDD->setVisible(true);
startpos += 145; startpos += 145;
} else mainGame->btnPSDD->setVisible(false); } else mainGame->btnPSDD->setVisible(false);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->PopupElement(mainGame->wPosSelect); mainGame->PopupElement(mainGame->wPosSelect);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_TRIBUTE: { case MSG_SELECT_TRIBUTE: {
...@@ -1956,13 +1956,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1956,13 +1956,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.select_min, mainGame->dField.select_max); mainGame->dField.select_min, mainGame->dField.select_max);
else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(531), mainGame->dField.select_min, mainGame->dField.select_max); else myswprintf(textBuffer, L"%ls(%d-%d)", dataManager.GetSysString(531), mainGame->dField.select_min, mainGame->dField.select_max);
select_hint = 0; select_hint = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
if (mainGame->dField.select_cancelable) { if (mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1); mainGame->dField.ShowCancelOrFinishButton(1);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_COUNTER: { case MSG_SELECT_COUNTER: {
...@@ -1985,10 +1985,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1985,10 +1985,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_selectable = true; pcard->is_selectable = true;
} }
myswprintf(textBuffer, dataManager.GetSysString(204), mainGame->dField.select_counter_count, dataManager.GetCounterName(mainGame->dField.select_counter_type)); myswprintf(textBuffer, dataManager.GetSysString(204), mainGame->dField.select_counter_count, dataManager.GetCounterName(mainGame->dField.select_counter_type));
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
...@@ -2098,10 +2098,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2098,10 +2098,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.deck[player].rbegin() + i); pcard = *(mainGame->dField.deck[player].rbegin() + i);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code)); myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code));
mainGame->AddLog(textBuffer, pcard->code); mainGame->AddLog(textBuffer, pcard->code);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
float shift = -0.15f; float shift = -0.15f;
if (player == 1) shift = 0.15f; if (player == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0); pcard->dPos = irr::core::vector3df(shift, 0, 0);
...@@ -2136,10 +2136,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2136,10 +2136,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.extra[player].rbegin() + i + mainGame->dField.extra_p_count[player]); pcard = *(mainGame->dField.extra[player].rbegin() + i + mainGame->dField.extra_p_count[player]);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code)); myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code));
mainGame->AddLog(textBuffer, pcard->code); mainGame->AddLog(textBuffer, pcard->code);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if (player == 0) if (player == 0)
pcard->dPos = irr::core::vector3df(0, -0.20f, 0); pcard->dPos = irr::core::vector3df(0, -0.20f, 0);
else else
...@@ -2179,10 +2179,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2179,10 +2179,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard = mainGame->dField.GetCard(c, l, s); pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0) if (code != 0)
pcard->SetCode(code); pcard->SetCode(code);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code)); myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code));
mainGame->AddLog(textBuffer, code); mainGame->AddLog(textBuffer, code);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if (l & 0x41 || l == 0) { if (l & 0x41 || l == 0) {
if(count == 1 && l != 0) { if(count == 1 && l != 0) {
float shift = -0.15f; float shift = -0.15f;
...@@ -2246,12 +2246,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2246,12 +2246,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
if (panel_confirm.size() && !auto_watch_mode) { if (panel_confirm.size() && !auto_watch_mode) {
std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort); std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.selectable_cards = panel_confirm; mainGame->dField.selectable_cards = panel_confirm;
myswprintf(textBuffer, dataManager.GetSysString(208), panel_confirm.size()); myswprintf(textBuffer, dataManager.GetSysString(208), panel_confirm.size());
mainGame->wCardSelect->setText(textBuffer); mainGame->wCardSelect->setText(textBuffer);
mainGame->dField.ShowSelectCard(true); mainGame->dField.ShowSelectCard(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
} }
...@@ -2391,7 +2391,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2391,7 +2391,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} }
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]); mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit) { for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit) {
(*cit)->location = LOCATION_GRAVE; (*cit)->location = LOCATION_GRAVE;
...@@ -2411,7 +2411,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2411,7 +2411,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
} }
return true; return true;
...@@ -2601,9 +2601,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2601,9 +2601,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->position = cp; pcard->position = cp;
pcard->SetCode(code); pcard->SetCode(code);
if(!mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.AddCard(pcard, cc, cl, cs); mainGame->dField.AddCard(pcard, cc, cl, cs);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->dField.GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true); mainGame->dField.GetCardLocation(pcard, &pcard->curPos, &pcard->curRot, true);
pcard->curAlpha = 5; pcard->curAlpha = 5;
mainGame->dField.FadeCard(pcard, 255, 20); mainGame->dField.FadeCard(pcard, 255, 20);
...@@ -2620,9 +2620,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2620,9 +2620,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(!mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
mainGame->dField.FadeCard(pcard, 5, 20); mainGame->dField.FadeCard(pcard, 5, 20);
mainGame->WaitFrameSignal(20); mainGame->WaitFrameSignal(20);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if(pcard == mainGame->dField.hovered_card) if(pcard == mainGame->dField.hovered_card)
mainGame->dField.hovered_card = 0; mainGame->dField.hovered_card = 0;
} else } else
...@@ -2654,11 +2654,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2654,11 +2654,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->position = cp; pcard->position = cp;
mainGame->dField.AddCard(pcard, cc, cl, cs); mainGame->dField.AddCard(pcard, cc, cl, cs);
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
pcard->position = cp; pcard->position = cp;
mainGame->dField.AddCard(pcard, cc, cl, cs); mainGame->dField.AddCard(pcard, cc, cl, cs);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if (pl == cl && pc == cc && (cl & 0x71)) { if (pl == cl && pc == cc && (cl & 0x71)) {
pcard->dPos = irr::core::vector3df(-0.3f, 0, 0); pcard->dPos = irr::core::vector3df(-0.3f, 0, 0);
pcard->dRot = irr::core::vector3df(0, 0, 0); pcard->dRot = irr::core::vector3df(0, 0, 0);
...@@ -2670,24 +2670,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2670,24 +2670,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} else { } else {
if (cl == 0x4 && pcard->overlayed.size() > 0) { if (cl == 0x4 && pcard->overlayed.size() > 0) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
for (size_t i = 0; i < pcard->overlayed.size(); ++i) for (size_t i = 0; i < pcard->overlayed.size(); ++i)
mainGame->dField.MoveCard(pcard->overlayed[i], 10); mainGame->dField.MoveCard(pcard->overlayed[i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(10); mainGame->WaitFrameSignal(10);
} }
if (cl == 0x2) { if (cl == 0x2) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
for (size_t i = 0; i < mainGame->dField.hand[cc].size(); ++i) for (size_t i = 0; i < mainGame->dField.hand[cc].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.hand[cc][i], 10); mainGame->dField.MoveCard(mainGame->dField.hand[cc][i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
if (pl == 0x2) if (pl == 0x2)
for (size_t i = 0; i < mainGame->dField.hand[pc].size(); ++i) for (size_t i = 0; i < mainGame->dField.hand[pc].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.hand[pc][i], 10); mainGame->dField.MoveCard(mainGame->dField.hand[pc][i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
...@@ -2709,21 +2709,21 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2709,21 +2709,21 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->location = 0x80; pcard->location = 0x80;
pcard->sequence = olcard->overlayed.size() - 1; pcard->sequence = olcard->overlayed.size() - 1;
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
olcard->overlayed.push_back(pcard); olcard->overlayed.push_back(pcard);
mainGame->dField.overlay_cards.insert(pcard); mainGame->dField.overlay_cards.insert(pcard);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
pcard->overlayTarget = olcard; pcard->overlayTarget = olcard;
pcard->location = 0x80; pcard->location = 0x80;
pcard->sequence = olcard->overlayed.size() - 1; pcard->sequence = olcard->overlayed.size() - 1;
if (olcard->location & 0x0c) { if (olcard->location & 0x0c) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
if (pl == 0x2) if (pl == 0x2)
for (size_t i = 0; i < mainGame->dField.hand[pc].size(); ++i) for (size_t i = 0; i < mainGame->dField.hand[pc].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.hand[pc][i], 10); mainGame->dField.MoveCard(mainGame->dField.hand[pc][i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
} }
...@@ -2739,7 +2739,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2739,7 +2739,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (size_t i = 0; i < olcard->overlayed.size(); ++i) for (size_t i = 0; i < olcard->overlayed.size(); ++i)
olcard->overlayed[i]->sequence = i; olcard->overlayed[i]->sequence = i;
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence); olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence);
pcard->overlayTarget = 0; pcard->overlayTarget = 0;
pcard->position = cp; pcard->position = cp;
...@@ -2749,11 +2749,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2749,11 +2749,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard->overlayed[i]->sequence = i; olcard->overlayed[i]->sequence = i;
mainGame->dField.MoveCard(olcard->overlayed[i], 2); mainGame->dField.MoveCard(olcard->overlayed[i], 2);
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
} else { } else {
...@@ -2770,7 +2770,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2770,7 +2770,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard1->overlayed[i]->sequence = i; olcard1->overlayed[i]->sequence = i;
} }
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence); olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence);
olcard2->overlayed.push_back(pcard); olcard2->overlayed.push_back(pcard);
pcard->sequence = olcard2->overlayed.size() - 1; pcard->sequence = olcard2->overlayed.size() - 1;
...@@ -2781,7 +2781,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2781,7 +2781,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(olcard1->overlayed[i], 2); mainGame->dField.MoveCard(olcard1->overlayed[i], 2);
} }
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
} }
...@@ -2836,7 +2836,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2836,7 +2836,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1); ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2); ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(!mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RemoveCard(c1, l1, s1); mainGame->dField.RemoveCard(c1, l1, s1);
mainGame->dField.RemoveCard(c2, l2, s2); mainGame->dField.RemoveCard(c2, l2, s2);
mainGame->dField.AddCard(pc1, c2, l2, s2); mainGame->dField.AddCard(pc1, c2, l2, s2);
...@@ -2847,7 +2847,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2847,7 +2847,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(pc1->overlayed[i], 10); mainGame->dField.MoveCard(pc1->overlayed[i], 10);
for (size_t i = 0; i < pc2->overlayed.size(); ++i) for (size_t i = 0; i < pc2->overlayed.size(); ++i)
mainGame->dField.MoveCard(pc2->overlayed[i], 10); mainGame->dField.MoveCard(pc2->overlayed[i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
} else { } else {
mainGame->dField.RemoveCard(c1, l1, s1); mainGame->dField.RemoveCard(c1, l1, s1);
...@@ -3006,9 +3006,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3006,9 +3006,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code)); myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.chains.push_back(mainGame->dField.current_chain); mainGame->dField.chains.push_back(mainGame->dField.current_chain);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if (ct > 1) if (ct > 1)
mainGame->WaitFrameSignal(20); mainGame->WaitFrameSignal(20);
mainGame->dField.last_chain = true; mainGame->dField.last_chain = true;
...@@ -3151,13 +3151,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3151,13 +3151,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} else { } else {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
soundManager.PlaySoundEffect(SOUND_DRAW); soundManager.PlaySoundEffect(SOUND_DRAW);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1); pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1); mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1);
mainGame->dField.AddCard(pcard, player, LOCATION_HAND, 0); mainGame->dField.AddCard(pcard, player, LOCATION_HAND, 0);
for(size_t i = 0; i < mainGame->dField.hand[player].size(); ++i) for(size_t i = 0; i < mainGame->dField.hand[player].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.hand[player][i], 10); mainGame->dField.MoveCard(mainGame->dField.hand[player][i], 10);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
} }
...@@ -3192,9 +3192,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3192,9 +3192,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->lpcstring = 0; mainGame->lpcstring = 0;
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
...@@ -3221,9 +3221,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3221,9 +3221,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->lpcstring = 0; mainGame->lpcstring = 0;
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
...@@ -3244,7 +3244,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3244,7 +3244,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc2->equipped.insert(pc1); pc2->equipped.insert(pc1);
} else { } else {
soundManager.PlaySoundEffect(SOUND_EQUIP); soundManager.PlaySoundEffect(SOUND_EQUIP);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(pc1->equipTarget) { if(pc1->equipTarget) {
pc1->is_showequip = false; pc1->is_showequip = false;
pc1->equipTarget->is_showequip = false; pc1->equipTarget->is_showequip = false;
...@@ -3256,7 +3256,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3256,7 +3256,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc2->is_showequip = true; pc2->is_showequip = true;
else if (mainGame->dField.hovered_card == pc2) else if (mainGame->dField.hovered_card == pc2)
pc1->is_showequip = true; pc1->is_showequip = true;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
return true; return true;
} }
...@@ -3273,9 +3273,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3273,9 +3273,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lpframe = 10; mainGame->lpframe = 10;
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->dInfo.lp[player] = val; mainGame->dInfo.lp[player] = val;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_UNEQUIP: { case MSG_UNEQUIP: {
...@@ -3288,14 +3288,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3288,14 +3288,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc->equipTarget->equipped.erase(pc); pc->equipTarget->equipped.erase(pc);
pc->equipTarget = 0; pc->equipTarget = 0;
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if (mainGame->dField.hovered_card == pc) if (mainGame->dField.hovered_card == pc)
pc->equipTarget->is_showequip = false; pc->equipTarget->is_showequip = false;
else if (mainGame->dField.hovered_card == pc->equipTarget) else if (mainGame->dField.hovered_card == pc->equipTarget)
pc->is_showequip = false; pc->is_showequip = false;
pc->equipTarget->equipped.erase(pc); pc->equipTarget->equipped.erase(pc);
pc->equipTarget = 0; pc->equipTarget = 0;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
return true; return true;
} }
...@@ -3314,14 +3314,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3314,14 +3314,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1->cardTarget.insert(pc2); pc1->cardTarget.insert(pc2);
pc2->ownerTarget.insert(pc1); pc2->ownerTarget.insert(pc1);
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
pc1->cardTarget.insert(pc2); pc1->cardTarget.insert(pc2);
pc2->ownerTarget.insert(pc1); pc2->ownerTarget.insert(pc1);
if (mainGame->dField.hovered_card == pc1) if (mainGame->dField.hovered_card == pc1)
pc2->is_showtarget = true; pc2->is_showtarget = true;
else if (mainGame->dField.hovered_card == pc2) else if (mainGame->dField.hovered_card == pc2)
pc1->is_showtarget = true; pc1->is_showtarget = true;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
break; break;
} }
...@@ -3340,14 +3340,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3340,14 +3340,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1->cardTarget.erase(pc2); pc1->cardTarget.erase(pc2);
pc2->ownerTarget.erase(pc1); pc2->ownerTarget.erase(pc1);
} else { } else {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
pc1->cardTarget.erase(pc2); pc1->cardTarget.erase(pc2);
pc2->ownerTarget.erase(pc1); pc2->ownerTarget.erase(pc1);
if (mainGame->dField.hovered_card == pc1) if (mainGame->dField.hovered_card == pc1)
pc2->is_showtarget = false; pc2->is_showtarget = false;
else if (mainGame->dField.hovered_card == pc2) else if (mainGame->dField.hovered_card == pc2)
pc1->is_showtarget = false; pc1->is_showtarget = false;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
break; break;
} }
...@@ -3373,9 +3373,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3373,9 +3373,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->lpcstring = 0; mainGame->lpcstring = 0;
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
...@@ -3393,10 +3393,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3393,10 +3393,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
soundManager.PlaySoundEffect(SOUND_COUNTER_ADD); soundManager.PlaySoundEffect(SOUND_COUNTER_ADD);
myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type)); myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true; pc->is_highlighting = true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stACMessage->setText(textBuffer); mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
pc->is_highlighting = false; pc->is_highlighting = false;
return true; return true;
...@@ -3416,10 +3416,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3416,10 +3416,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
soundManager.PlaySoundEffect(SOUND_COUNTER_REMOVE); soundManager.PlaySoundEffect(SOUND_COUNTER_REMOVE);
myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type)); myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true; pc->is_highlighting = true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stACMessage->setText(textBuffer); mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
pc->is_highlighting = false; pc->is_highlighting = false;
return true; return true;
...@@ -3495,7 +3495,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3495,7 +3495,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int dd = */BufferIO::ReadInt8(pbuf); /*int dd = */BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
ClientCard* pcard = mainGame->dField.GetCard(ca, la, sa); ClientCard* pcard = mainGame->dField.GetCard(ca, la, sa);
if(aatk != pcard->attack) { if(aatk != pcard->attack) {
pcard->attack = aatk; pcard->attack = aatk;
...@@ -3516,7 +3516,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3516,7 +3516,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(pcard->defstring, L"%d", ddef); myswprintf(pcard->defstring, L"%d", ddef);
} }
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return true; return true;
} }
case MSG_ATTACK_DISABLED: { case MSG_ATTACK_DISABLED: {
...@@ -3551,11 +3551,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3551,11 +3551,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_COIN); soundManager.PlaySoundEffect(SOUND_COIN);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer); mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
return true; return true;
} }
...@@ -3574,11 +3574,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3574,11 +3574,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_DICE); soundManager.PlaySoundEffect(SOUND_DICE);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer); mainGame->stACMessage->setText(textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
return true; return true;
} }
...@@ -3586,9 +3586,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3586,9 +3586,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->PopupElement(mainGame->wHand); mainGame->PopupElement(mainGame->wHand);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_HAND_RES: { case MSG_HAND_RES: {
...@@ -3622,10 +3622,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3622,10 +3622,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint)); myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint));
else myswprintf(textBuffer, dataManager.GetSysString(563)); else myswprintf(textBuffer, dataManager.GetSysString(563));
select_hint = 0; select_hint = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wANRace->setText(textBuffer); mainGame->wANRace->setText(textBuffer);
mainGame->PopupElement(mainGame->wANRace); mainGame->PopupElement(mainGame->wANRace);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_ANNOUNCE_ATTRIB: { case MSG_ANNOUNCE_ATTRIB: {
...@@ -3642,10 +3642,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3642,10 +3642,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint)); myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint));
else myswprintf(textBuffer, dataManager.GetSysString(562)); else myswprintf(textBuffer, dataManager.GetSysString(562));
select_hint = 0; select_hint = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wANAttribute->setText(textBuffer); mainGame->wANAttribute->setText(textBuffer);
mainGame->PopupElement(mainGame->wANAttribute); mainGame->PopupElement(mainGame->wANAttribute);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_ANNOUNCE_CARD: { case MSG_ANNOUNCE_CARD: {
...@@ -3658,18 +3658,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3658,18 +3658,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint)); myswprintf(textBuffer, L"%ls", dataManager.GetDesc(select_hint));
else myswprintf(textBuffer, dataManager.GetSysString(564)); else myswprintf(textBuffer, dataManager.GetSysString(564));
select_hint = 0; select_hint = 0;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->ebANCard->setText(L""); mainGame->ebANCard->setText(L"");
mainGame->wANCard->setText(textBuffer); mainGame->wANCard->setText(textBuffer);
mainGame->dField.UpdateDeclarableList(); mainGame->dField.UpdateDeclarableList();
mainGame->PopupElement(mainGame->wANCard); mainGame->PopupElement(mainGame->wANCard);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_ANNOUNCE_NUMBER: { case MSG_ANNOUNCE_NUMBER: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->cbANNumber->clear(); mainGame->cbANNumber->clear();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int value = BufferIO::ReadInt32(pbuf); int value = BufferIO::ReadInt32(pbuf);
...@@ -3683,7 +3683,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3683,7 +3683,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint = 0; select_hint = 0;
mainGame->wANNumber->setText(textBuffer); mainGame->wANNumber->setText(textBuffer);
mainGame->PopupElement(mainGame->wANNumber); mainGame->PopupElement(mainGame->wANNumber);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
return false; return false;
} }
case MSG_CARD_HINT: { case MSG_CARD_HINT: {
...@@ -3774,7 +3774,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3774,7 +3774,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
// //
if(!mainGame->dInfo.isReplaySkiping) if(!mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
if(mainGame->dField.deck[player].size() > mcount) { if(mainGame->dField.deck[player].size() > mcount) {
while(mainGame->dField.deck[player].size() > mcount) { while(mainGame->dField.deck[player].size() > mcount) {
ClientCard* ccard = *mainGame->dField.deck[player].rbegin(); ClientCard* ccard = *mainGame->dField.deck[player].rbegin();
...@@ -3822,7 +3822,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3822,7 +3822,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
mainGame->dField.extra_p_count[player] = pcount; mainGame->dField.extra_p_count[player] = pcount;
if(!mainGame->dInfo.isReplaySkiping) if(!mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
// //
if(!mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) { for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
...@@ -3856,7 +3856,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3856,7 +3856,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_RELOAD_FIELD: { case MSG_RELOAD_FIELD: {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.duel_rule = BufferIO::ReadInt8(pbuf); mainGame->dInfo.duel_rule = BufferIO::ReadInt8(pbuf);
int val = 0; int val = 0;
...@@ -3964,7 +3964,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3964,7 +3964,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.last_chain = true; mainGame->dField.last_chain = true;
} }
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
} }
...@@ -4122,7 +4122,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) { ...@@ -4122,7 +4122,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
unsigned int ipaddr = bc_addr.sin_addr.s_addr; unsigned int ipaddr = bc_addr.sin_addr.s_addr;
HostPacket* pHP = (HostPacket*)buf; HostPacket* pHP = (HostPacket*)buf;
if(!is_closing && pHP->identifier == NETWORK_SERVER_ID && remotes.find(ipaddr) == remotes.end() ) { if(!is_closing && pHP->identifier == NETWORK_SERVER_ID && remotes.find(ipaddr) == remotes.end() ) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
remotes.insert(ipaddr); remotes.insert(ipaddr);
pHP->ipaddr = ipaddr; pHP->ipaddr = ipaddr;
hosts.push_back(*pHP); hosts.push_back(*pHP);
...@@ -4144,7 +4144,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) { ...@@ -4144,7 +4144,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
BufferIO::CopyWStr(pHP->name, gamename, 20); BufferIO::CopyWStr(pHP->name, gamename, 20);
hoststr.append(gamename); hoststr.append(gamename);
mainGame->lstHostList->addItem(hoststr.c_str()); mainGame->lstHostList->addItem(hoststr.c_str());
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
} }
} }
......
...@@ -1697,9 +1697,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1697,9 +1697,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(!mainGame->dInfo.isReplay && !mainGame->HasFocus(EGUIET_EDIT_BOX)) { if(!mainGame->dInfo.isReplay && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->dInfo.isReplaySkiping = event.KeyInput.PressedDown; mainGame->dInfo.isReplaySkiping = event.KeyInput.PressedDown;
if(mainGame->dInfo.isStarted && !mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isStarted && !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
} }
break; break;
......
...@@ -879,7 +879,7 @@ void Game::MainLoop() { ...@@ -879,7 +879,7 @@ void Game::MainLoop() {
atkframe += 0.1f; atkframe += 0.1f;
atkdy = (float)sin(atkframe); atkdy = (float)sin(atkframe);
driver->beginScene(true, true, SColor(0, 0, 0, 0)); driver->beginScene(true, true, SColor(0, 0, 0, 0));
gMutex.Lock(); gMutex.lock();
if(dInfo.isStarted) { if(dInfo.isStarted) {
if(dInfo.isFinished && showcardcode == 1) if(dInfo.isFinished && showcardcode == 1)
soundManager.PlayBGM(BGM_WIN); soundManager.PlayBGM(BGM_WIN);
...@@ -908,7 +908,7 @@ void Game::MainLoop() { ...@@ -908,7 +908,7 @@ void Game::MainLoop() {
} }
DrawGUI(); DrawGUI();
DrawSpec(); DrawSpec();
gMutex.Unlock(); gMutex.unlock();
if(signalFrame > 0) { if(signalFrame > 0) {
signalFrame--; signalFrame--;
if(!signalFrame) if(!signalFrame)
...@@ -925,7 +925,7 @@ void Game::MainLoop() { ...@@ -925,7 +925,7 @@ void Game::MainLoop() {
} }
} }
driver->endScene(); driver->endScene();
if(closeSignal.Wait(0)) if(closeSignal.Wait(1))
CloseDuelWindow(); CloseDuelWindow();
fps++; fps++;
cur_time = timer->getTime(); cur_time = timer->getTime();
......
...@@ -203,8 +203,7 @@ public: ...@@ -203,8 +203,7 @@ public:
void takeScreenshot(); void takeScreenshot();
void SetCursor(ECURSOR_ICON icon); void SetCursor(ECURSOR_ICON icon);
Mutex gMutex; std::mutex gMutex;
Mutex gBuffer;
Signal frameSignal; Signal frameSignal;
Signal actionSignal; Signal actionSignal;
Signal replaySignal; Signal replaySignal;
......
...@@ -82,10 +82,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -82,10 +82,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
hints.ai_flags = EVUTIL_AI_ADDRCONFIG; hints.ai_flags = EVUTIL_AI_ADDRCONFIG;
int status = evutil_getaddrinfo(hostname, port, &hints, &answer); int status = evutil_getaddrinfo(hostname, port, &hints, &answer);
if(status != 0) { if(status != 0) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO); soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1412)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1412));
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} else { } else {
sockaddr_in * sin = ((struct sockaddr_in *)answer->ai_addr); sockaddr_in * sin = ((struct sockaddr_in *)answer->ai_addr);
...@@ -250,12 +250,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -250,12 +250,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int sel = mainGame->lstReplayList->getSelected(); int sel = mainGame->lstReplayList->getSelected();
if(sel == -1) if(sel == -1)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
wchar_t textBuffer[256]; wchar_t textBuffer[256];
myswprintf(textBuffer, L"%ls\n%ls", mainGame->lstReplayList->getListItem(sel), dataManager.GetSysString(1363)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->lstReplayList->getListItem(sel), dataManager.GetSysString(1363));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
break; break;
...@@ -264,11 +264,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -264,11 +264,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int sel = mainGame->lstReplayList->getSelected(); int sel = mainGame->lstReplayList->getSelected();
if(sel == -1) if(sel == -1)
break; break;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->wReplaySave->setText(dataManager.GetSysString(1364)); mainGame->wReplaySave->setText(dataManager.GetSysString(1364));
mainGame->ebRSName->setText(mainGame->lstReplayList->getListItem(sel)); mainGame->ebRSName->setText(mainGame->lstReplayList->getListItem(sel));
mainGame->PopupElement(mainGame->wReplaySave); mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
break; break;
......
#ifndef MUTEX_H
#define MUTEX_H
#ifdef _WIN32
#include <windows.h>
class Mutex {
public:
Mutex() {
InitializeCriticalSection(&_mutex);
}
~Mutex() {
DeleteCriticalSection(&_mutex);
}
void Lock() {
EnterCriticalSection(&_mutex);
}
void Unlock() {
LeaveCriticalSection(&_mutex);
}
bool TryLock() {
return TryEnterCriticalSection(&_mutex) == TRUE;
}
private:
CRITICAL_SECTION _mutex;
};
#else // _WIN32
#include <pthread.h>
class Mutex {
public:
Mutex() {
pthread_mutex_init(&mutex_t, NULL);
}
~Mutex() {
pthread_mutex_destroy(&mutex_t);
}
void Lock() {
pthread_mutex_lock(&mutex_t);
}
void Unlock() {
pthread_mutex_unlock(&mutex_t);
}
bool TryLock() {
return !pthread_mutex_trylock(&mutex_t);
}
private:
pthread_mutex_t mutex_t;
};
#endif // _WIN32
#endif // MUTEX_H
#ifndef SIGNAL_H #ifndef SIGNAL_H
#define SIGNAL_H #define SIGNAL_H
#ifdef _WIN32 #include <mutex>
#include <condition_variable>
#include <windows.h>
class Signal {
public:
Signal() {
_event = CreateEvent(0, FALSE, FALSE, 0);
_nowait = false;
}
~Signal() {
CloseHandle(_event);
}
void Set() {
SetEvent(_event);
}
void Reset() {
ResetEvent(_event);
}
void Wait() {
if(_nowait)
return;
WaitForSingleObject(_event, INFINITE);
}
bool Wait(long milli) {
if(_nowait)
return false;
return WaitForSingleObject(_event, milli + 1) != WAIT_TIMEOUT;
}
void SetNoWait(bool nowait) {
_nowait = nowait;
}
private:
HANDLE _event;
bool _nowait;
};
#else // _WIN32
#include <sys/time.h>
#include <pthread.h>
class Signal { class Signal {
public: public:
Signal() { Signal() {
_state = false; _state = false;
_nowait = false; _nowait = false;
pthread_mutex_init(&_mutex, NULL);
pthread_cond_init(&_cond, NULL);
} }
~Signal() { ~Signal() {
pthread_cond_destroy(&_cond);
pthread_mutex_destroy(&_mutex);
} }
void Set() { void Set() {
if(pthread_mutex_lock(&_mutex)) std::unique_lock<std::mutex> lock(_mutex);
return;
_state = true; _state = true;
if(pthread_cond_broadcast(&_cond)) _cond.notify_all();
{
pthread_mutex_unlock(&_mutex);
// ERROR Broadcasting event status!
return;
}
pthread_mutex_unlock(&_mutex);
} }
void Reset() { void Reset() {
if(pthread_mutex_lock(&_mutex)) std::unique_lock<std::mutex> lock(_mutex);
return;
_state = false; _state = false;
pthread_mutex_unlock(&_mutex);
} }
void Wait() { void Wait() {
if(_nowait || pthread_mutex_lock(&_mutex)) if(_nowait)
return;
while(!_state)
{
if(pthread_cond_wait(&_cond, &_mutex))
{
pthread_mutex_unlock(&_mutex);
// ERROR Waiting events;
return; return;
} std::unique_lock<std::mutex> lock(_mutex);
} _cond.wait(lock, [this]() { return _state; });
_state = false; _state = false;
pthread_mutex_unlock(&_mutex);
} }
bool Wait(long milliseconds) bool Wait(long milliseconds) {
{ if(_nowait)
if (_nowait || pthread_mutex_lock(&_mutex) != 0)
return false;
int rc = 0;
struct timespec abstime;
struct timeval tv;
gettimeofday(&tv, NULL);
abstime.tv_sec = tv.tv_sec + milliseconds / 1000;
abstime.tv_nsec = tv.tv_usec*1000 + (milliseconds % 1000)*1000000;
if (abstime.tv_nsec >= 1000000000)
{
abstime.tv_nsec -= 1000000000;
abstime.tv_sec++;
}
while (!_state)
{
if ((rc = pthread_cond_timedwait(&_cond, &_mutex, &abstime)))
{
if (rc == ETIMEDOUT) break;
pthread_mutex_unlock(&_mutex);
return false; return false;
} std::unique_lock<std::mutex> lock(_mutex);
} bool res = _cond.wait_for(lock, std::chrono::milliseconds(milliseconds), [this]() { return _state; });
_state = false; _state = false;
pthread_mutex_unlock(&_mutex); return res;
return rc == 0;
} }
void SetNoWait(bool nowait) { void SetNoWait(bool nowait) {
_nowait = nowait; _nowait = nowait;
} }
private: private:
pthread_mutex_t _mutex; std::mutex _mutex;
pthread_cond_t _cond; std::condition_variable _cond;
bool _state; bool _state;
bool _nowait; bool _nowait;
}; };
#endif // _WIN32
#endif // SIGNAL_H #endif // SIGNAL_H
...@@ -90,7 +90,7 @@ int ReplayMode::ReplayThread() { ...@@ -90,7 +90,7 @@ int ReplayMode::ReplayThread() {
exit_pending = false; exit_pending = false;
current_step = 0; current_step = 0;
if(mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
while (is_continuing && !exit_pending) { while (is_continuing && !exit_pending) {
int result = process(pduel); int result = process(pduel);
int len = result & 0xffff; int len = result & 0xffff;
...@@ -99,7 +99,7 @@ int ReplayMode::ReplayThread() { ...@@ -99,7 +99,7 @@ int ReplayMode::ReplayThread() {
get_message(pduel, (byte*)engineBuffer); get_message(pduel, (byte*)engineBuffer);
is_continuing = ReplayAnalyze(engineBuffer, len); is_continuing = ReplayAnalyze(engineBuffer, len);
if(is_restarting) { if(is_restarting) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
is_restarting = false; is_restarting = false;
mainGame->dInfo.isReplaySkiping = true; mainGame->dInfo.isReplaySkiping = true;
Restart(false); Restart(false);
...@@ -125,7 +125,7 @@ int ReplayMode::ReplayThread() { ...@@ -125,7 +125,7 @@ int ReplayMode::ReplayThread() {
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
skip_step = step; skip_step = step;
current_step = 0; current_step = 0;
...@@ -135,7 +135,7 @@ int ReplayMode::ReplayThread() { ...@@ -135,7 +135,7 @@ int ReplayMode::ReplayThread() {
if(mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
EndDuel(); EndDuel();
return 0; return 0;
...@@ -232,26 +232,26 @@ void ReplayMode::EndDuel() { ...@@ -232,26 +232,26 @@ void ReplayMode::EndDuel() {
end_duel(pduel); end_duel(pduel);
if(!is_closing) { if(!is_closing) {
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stMessage->setText(dataManager.GetSysString(1501)); mainGame->stMessage->setText(dataManager.GetSysString(1501));
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
mainGame->dInfo.isReplay = false; mainGame->dInfo.isReplay = false;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set(); mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->ShowElement(mainGame->wReplay); mainGame->ShowElement(mainGame->wReplay);
mainGame->stTip->setVisible(false); mainGame->stTip->setVisible(false);
mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if(exit_on_return) if(exit_on_return)
mainGame->device->closeDevice(); mainGame->device->closeDevice();
} }
...@@ -295,9 +295,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -295,9 +295,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
return true; return true;
} }
if(is_swaping) { if(is_swaping) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.ReplaySwap(); mainGame->dField.ReplaySwap();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
is_swaping = false; is_swaping = false;
} }
char* offset = pbuf; char* offset = pbuf;
...@@ -308,12 +308,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -308,12 +308,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if(mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
return false; return false;
...@@ -327,7 +327,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -327,7 +327,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if(mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
pbuf += 2; pbuf += 2;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
...@@ -509,7 +509,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -509,7 +509,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if(skip_turn == 0) { if(skip_turn == 0) {
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
} }
player = BufferIO::ReadInt8(pbuf); player = BufferIO::ReadInt8(pbuf);
...@@ -846,7 +846,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -846,7 +846,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
mainGame->dInfo.isReplaySkiping = false; mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
} }
} }
if(is_pausing) { if(is_pausing) {
......
...@@ -84,7 +84,7 @@ int SingleMode::SinglePlayThread() { ...@@ -84,7 +84,7 @@ int SingleMode::SinglePlayThread() {
rh.version = PRO_VERSION; rh.version = PRO_VERSION;
rh.flag = REPLAY_SINGLE_MODE; rh.flag = REPLAY_SINGLE_MODE;
rh.seed = seed; rh.seed = seed;
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ClearCardInfo(); mainGame->ClearCardInfo();
mainGame->wCardImg->setVisible(true); mainGame->wCardImg->setVisible(true);
...@@ -98,7 +98,7 @@ int SingleMode::SinglePlayThread() { ...@@ -98,7 +98,7 @@ int SingleMode::SinglePlayThread() {
mainGame->dInfo.isFinished = false; mainGame->dInfo.isFinished = false;
mainGame->dInfo.isSingleMode = true; mainGame->dInfo.isSingleMode = true;
mainGame->device->setEventReceiver(&mainGame->dField); mainGame->device->setEventReceiver(&mainGame->dField);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
char engineBuffer[0x1000]; char engineBuffer[0x1000];
is_closing = false; is_closing = false;
is_continuing = true; is_continuing = true;
...@@ -130,7 +130,7 @@ int SingleMode::SinglePlayThread() { ...@@ -130,7 +130,7 @@ int SingleMode::SinglePlayThread() {
} }
} }
last_replay.EndRecord(); last_replay.EndRecord();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
tm* localedtime = localtime(&nowtime); tm* localedtime = localtime(&nowtime);
wchar_t timetext[40]; wchar_t timetext[40];
...@@ -139,7 +139,7 @@ int SingleMode::SinglePlayThread() { ...@@ -139,7 +139,7 @@ int SingleMode::SinglePlayThread() {
if(!mainGame->chkAutoSaveReplay->isChecked()) { if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340)); mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave); mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->replaySignal.Reset(); mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait(); mainGame->replaySignal.Wait();
} else { } else {
...@@ -148,26 +148,26 @@ int SingleMode::SinglePlayThread() { ...@@ -148,26 +148,26 @@ int SingleMode::SinglePlayThread() {
myswprintf(msgbuf, dataManager.GetSysString(1367), 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();
mainGame->WaitFrameSignal(30); mainGame->WaitFrameSignal(30);
} }
if(mainGame->actionParam) if(mainGame->actionParam)
last_replay.SaveReplay(mainGame->ebRSName->getText()); last_replay.SaveReplay(mainGame->ebRSName->getText());
end_duel(pduel); end_duel(pduel);
if(!is_closing) { if(!is_closing) {
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
mainGame->dInfo.isSingleMode = false; mainGame->dInfo.isSingleMode = false;
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->closeDoneSignal.Reset(); mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set(); mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait(); mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
mainGame->stTip->setVisible(false); mainGame->stTip->setVisible(false);
mainGame->device->setEventReceiver(&mainGame->menuHandler); mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
if(exit_on_return) if(exit_on_return)
mainGame->device->closeDevice(); mainGame->device->closeDevice();
} }
...@@ -737,9 +737,9 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -737,9 +737,9 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf++; pbuf++;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
SinglePlayReload(); SinglePlayReload();
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->dField.RefreshAllCards(); mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
break; break;
} }
case MSG_AI_NAME: { case MSG_AI_NAME: {
...@@ -761,10 +761,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -761,10 +761,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf += len + 1; pbuf += len + 1;
memcpy(msgbuf, begin, len + 1); memcpy(msgbuf, begin, len + 1);
BufferIO::DecodeUTF8(msgbuf, msg); BufferIO::DecodeUTF8(msgbuf, msg);
mainGame->gMutex.Lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
break; break;
......
#[2019.7][2019.4 TCG][2019.4][2019.1][2018.10][2018.7][2018.4][2018.1][2017.10][2017.7][2017.4][2017.1][2016.10][2016.7][2016.4][2016.1][2015.10][2015.4][2015.1][2014.10][2014.7][2014.4][2014.2][2013.9][2019.1 TCG][2018.12 TCG][2018.9 TCG][2018.5 TCG][2018.2 TCG][2017.11 TCG][2017.9 TCG][2017.6 TCG][2017.3 TCG][2016.8 TCG][2016.4 TCG][2015.11 TCG][2015.7 TCG][2015.4 TCG][2015.1 TCG][2014.10 TCG][2014.7 TCG][2014.4 TCG][2014.1.1 TCG][2013.10.11 TCG][2013.3.1][2012.9.1][2012.3.1][2011.9.1] #[2019.7][2019.7 TCG][2019.4][2019.1][2018.10][2018.7][2018.4][2018.1][2017.10][2017.7][2017.4][2017.1][2016.10][2016.7][2016.4][2016.1][2015.10][2015.4][2015.1][2014.10][2014.7][2014.4][2014.2][2013.9][2019.4 TCG][2019.1 TCG][2018.12 TCG][2018.9 TCG][2018.5 TCG][2018.2 TCG][2017.11 TCG][2017.9 TCG][2017.6 TCG][2017.3 TCG][2016.8 TCG][2016.4 TCG][2015.11 TCG][2015.7 TCG][2015.4 TCG][2015.1 TCG][2014.10 TCG][2014.7 TCG][2014.4 TCG][2014.1.1 TCG][2013.10.11 TCG][2013.3.1][2012.9.1][2012.3.1][2011.9.1]
!2019.7 !2019.7
#forbidden #forbidden
...@@ -173,21 +173,12 @@ ...@@ -173,21 +173,12 @@
40605147 2 --神の通告 40605147 2 --神の通告
53936268 2 --パーソナル・スプーフィング 53936268 2 --パーソナル・スプーフィング
!2019.4 TCG !2019.7 TCG
#forbidden #forbidden
55623480 0 --妖精伝姫-シラユキ
75732622 0 --トーチ・ゴーレム
22593417 0 --トポロジック・ガンブラー・ドラゴン
10389142 0 --No.42 スターシップ・ギャラクシー・トマホーク
63504681 0 --No.86 HC ロンゴミアント
54447022 0 --ソウル・チャージ
05043010 0 --ファイアウォール・ドラゴン
05592689 0 --サクリファイス・ロータス
39064822 0 --トロイメア・ゴブリン
04423206 0 --M.X-セイバー インヴォーカー
76794549 0 --アストログラフ・マジシャン 76794549 0 --アストログラフ・マジシャン
20663556 0 --イレカエル 20663556 0 --イレカエル
44910027 0 --ヴィクトリー・ドラゴン 44910027 0 --ヴィクトリー・ドラゴン
51858306 0 --エクリプス・ワイバーン
25862681 0 --エンシェント・フェアリー・ドラゴン 25862681 0 --エンシェント・フェアリー・ドラゴン
53804307 0 --焔征竜-ブラスター 53804307 0 --焔征竜-ブラスター
07563579 0 --Emヒグルミ 07563579 0 --Emヒグルミ
...@@ -200,6 +191,7 @@ ...@@ -200,6 +191,7 @@
65536818 0 --源竜星-ボウテンコウ 65536818 0 --源竜星-ボウテンコウ
49684352 0 --虹彩の魔術師 49684352 0 --虹彩の魔術師
34124316 0 --サイバーポッド 34124316 0 --サイバーポッド
05592689 0 --サクリファイス・ロータス
88071625 0 --The tyrant NEPTUNE 88071625 0 --The tyrant NEPTUNE
61665245 0 --サモン・ソーサレス 61665245 0 --サモン・ソーサレス
48905153 0 --十二獣ドランシア 48905153 0 --十二獣ドランシア
...@@ -209,24 +201,31 @@ ...@@ -209,24 +201,31 @@
21377582 0 --真竜剣皇マスターP 21377582 0 --真竜剣皇マスターP
81122844 0 --発条空母ゼンマイティ 81122844 0 --発条空母ゼンマイティ
23434538 0 --増殖するG 23434538 0 --増殖するG
00581014 0 --ダイガスタ・エメラル
15341821 0 --ダンディライオン 15341821 0 --ダンディライオン
18326736 0 --星守の騎士 プトレマイオス 18326736 0 --星守の騎士 プトレマイオス
33184167 0 --同族感染ウィルス 33184167 0 --同族感染ウィルス
75732622 0 --トーチ・ゴーレム
22593417 0 --トポロジック・ガンブラー・ドラゴン
39064822 0 --トロイメア・ゴブリン
54719828 0 --No.16 色の支配者ショック·ルーラー 54719828 0 --No.16 色の支配者ショック·ルーラー
10389142 0 --No.42 スターシップ・ギャラクシー・トマホーク
63504681 0 --No.86 HC ロンゴミアント
58820923 0 --No.95 ギャラクシーアイズ・ダークマター・ドラゴン 58820923 0 --No.95 ギャラクシーアイズ・ダークマター・ドラゴン
43387895 0 --覇王眷竜スターヴ・ヴェノム 43387895 0 --覇王眷竜スターヴ・ヴェノム
26400609 0 --瀑征竜-タイダル 26400609 0 --瀑征竜-タイダル
78706415 0 --ファイバーポッド 78706415 0 --ファイバーポッド
05043010 0 --ファイアウォール・ドラゴン
26692769 0 --幻影騎士団ラスティ・バルディッシュ
93369354 0 --フィッシュボーグ-ガンナー 93369354 0 --フィッシュボーグ-ガンナー
55623480 0 --妖精伝姫-シラユキ
23558733 0 --フェニキシアン・クラスター・アマリリス 23558733 0 --フェニキシアン・クラスター・アマリリス
09929398 0 --BF-朧影のゴウフウ 09929398 0 --BF-朧影のゴウフウ
31178212 0 --マジェスペクター・ユニコーン 31178212 0 --マジェスペクター・ユニコーン
34206604 0 --魔導サイエンティスト 34206604 0 --魔導サイエンティスト
04423206 0 --M.X-セイバー インヴォーカー
96782886 0 --メンタルマスター 96782886 0 --メンタルマスター
03078576 0 --八汰烏 03078576 0 --八汰烏
34086406 0 --ラヴァルバル·チェイン 34086406 0 --ラヴァルバル·チェイン
89399912 0 --嵐征竜-テンペスト
57421866 0 --レベル・スティーラー 57421866 0 --レベル・スティーラー
41482598 0 --悪夢の蜃気楼 41482598 0 --悪夢の蜃気楼
44763025 0 --いたずら好きな双子悪魔 44763025 0 --いたずら好きな双子悪魔
...@@ -240,6 +239,7 @@ ...@@ -240,6 +239,7 @@
04031928 0 --心変わり 04031928 0 --心変わり
23557835 0 --次元融合 23557835 0 --次元融合
57953380 0 --生還の宝札 57953380 0 --生還の宝札
54447022 0 --ソウル・チャージ
60682203 0 --大寒波 60682203 0 --大寒波
67616300 0 --チキンレース 67616300 0 --チキンレース
67169062 0 --貪欲な壺 67169062 0 --貪欲な壺
...@@ -266,35 +266,21 @@ ...@@ -266,35 +266,21 @@
80604091 0 --血の代償 80604091 0 --血の代償
28566710 0 --ラストバトル! 28566710 0 --ラストバトル!
#limit #limit
82301904 1 --混沌帝龍 -終焉の使者-
69015963 1 --デビル·フランケン
14536035 1 --ダーク・グレファー
90307777 1 --影霊衣の術士 シュリット
20366274 1 --エルシャドール・ネフィリム
07394770 1 --ブリリアント・フュージョン
75500286 1 --封印の黄金櫃
71650854 1 --半魔導帯域
73915051 1 --スケープ・ゴート
71344451 1 --一撃必殺!居合いドロー
28985331 1 --終末の騎士
40044918 1 --E·HERO エアーマン
33508719 1 --メタモルポット
24094258 1 --ヘビーメタルフォーゼ・エレクトラム
74586817 1 --PSYフレームロード・Ω
08949584 1 --ヒーローアライブ
72892473 1 --手札抹殺
52340444 1 --閃刀機-ホーネットビット
64034255 1 --A·ジェネクス·バードマン 64034255 1 --A·ジェネクス·バードマン
61901281 1 --暗黒竜 コラプサーペント
45222299 1 --イビリチュア·ガストクラーケ 45222299 1 --イビリチュア·ガストクラーケ
11877465 1 --イビリチュア·マインドオーガス 11877465 1 --イビリチュア·マインドオーガス
99177923 1 --インフェルニティ·デーモン 99177923 1 --インフェルニティ·デーモン
68184115 1 --甲虫装機 ダンセル
27552504 1 --永遠の淑女 ベアトリーチェ 27552504 1 --永遠の淑女 ベアトリーチェ
68819554 1 --Emダメージ・ジャグラー 20366274 1 --エルシャドール・ネフィリム
65518099 1 --クリフォート・ツール 42790071 1 --オルターガイスト・マルチフェイカー
99234526 1 --輝白竜 ワイバースター
12958919 1 --幻銃士 12958919 1 --幻銃士
74586817 1 --PSYフレームロード・Ω
26889158 1 --転生炎獣ガゼル
39512984 1 --ジェムナイトマスター・ダイヤ 39512984 1 --ジェムナイトマスター・ダイヤ
78872731 1 --十二獣モルモラット 78872731 1 --十二獣モルモラット
28985331 1 --終末の騎士
78868119 1 --深海のディーヴァ 78868119 1 --深海のディーヴァ
58984738 1 --真竜拳士ダイナマイトK 58984738 1 --真竜拳士ダイナマイトK
04474060 1 --SPYRAL GEAR-ドローン 04474060 1 --SPYRAL GEAR-ドローン
...@@ -303,62 +289,81 @@ ...@@ -303,62 +289,81 @@
48063985 1 --聖霊獣騎 カンナホーク 48063985 1 --聖霊獣騎 カンナホーク
63288573 1 --閃刀姫-カガリ 63288573 1 --閃刀姫-カガリ
65192027 1 --ダーク·アームド·ドラゴン 65192027 1 --ダーク·アームド·ドラゴン
96570609 1 --天帝アイテール 14536035 1 --ダーク・グレファー
00581014 1 --ダイガスタ・エメラル
69015963 1 --デビル·フランケン
16226786 1 --深淵の暗殺者 16226786 1 --深淵の暗殺者
18239909 1 --爆竜剣士イグニスターP 18239909 1 --爆竜剣士イグニスターP
57143342 1 --彼岸の悪鬼 ガトルホッグ 57143342 1 --彼岸の悪鬼 ガトルホッグ
20758643 1 --彼岸の悪鬼 グラバースニッチ 20758643 1 --彼岸の悪鬼 グラバースニッチ
70583986 1 --氷結界の虎王ドゥローレン 70583986 1 --氷結界の虎王ドゥローレン
52687916 1 --氷結界の龍 トリシューラ
33396948 1 --封印されしエクゾディア 33396948 1 --封印されしエクゾディア
07902349 1 --封印されし者の左腕 07902349 1 --封印されし者の左腕
70903634 1 --封印されし者の右腕 70903634 1 --封印されし者の右腕
44519536 1 --封印されし者の左足 44519536 1 --封印されし者の左足
08124921 1 --封印されし者の右足 08124921 1 --封印されし者の右足
24094258 1 --ヘビーメタルフォーゼ・エレクトラム
10802915 1 --魔界発現世行きデスガイド 10802915 1 --魔界発現世行きデスガイド
33508719 1 --メタモルポット
89463537 1 --ユニコールの影霊衣 89463537 1 --ユニコールの影霊衣
89399912 1 --嵐征竜-テンペスト
88264978 1 --レッドアイズ·ダークネスメタルドラゴン 88264978 1 --レッドアイズ·ダークネスメタルドラゴン
16188701 1 --レディ・デバッガー 16188701 1 --レディ・デバッガー
71344451 1 --一撃必殺!居合いドロー
33782437 1 --一時休戦 33782437 1 --一時休戦
66957584 1 --インフェルニティガン 66957584 1 --インフェルニティガン
72405967 1 --王家の生け贄
81439173 1 --おろかな埋葬 81439173 1 --おろかな埋葬
67723438 1 --緊急テレポート 67723438 1 --緊急テレポート
45305419 1 --継承の印 45305419 1 --継承の印
52155219 1 --転生炎獣の炎陣
12580477 1 --サンダー·ボルト 12580477 1 --サンダー·ボルト
81674782 1 --次元の裂け目
83764718 1 --死者蘇生
95308449 1 --終焉のカウントダウン 95308449 1 --終焉のカウントダウン
74845897 1 --真炎の爆発
35125879 1 --真竜皇の復活 35125879 1 --真竜皇の復活
73915051 1 --スケープ・ゴート
54631665 1 --SPYRAL RESORT 54631665 1 --SPYRAL RESORT
24010609 1 --閃刀機関-マルチロール
52340444 1 --閃刀機-ホーネットビット
32807846 1 --増援 32807846 1 --増援
14087893 1 --月の書 72892473 1 --手札抹殺
81674782 1 --次元の裂け目
83764718 1 --死者蘇生
91623717 1 --連鎖爆撃 91623717 1 --連鎖爆撃
14087893 1 --月の書
73628505 1 --テラ・フォーミング
35371948 1 --トリックスター・ライトステージ
70368879 1 --成金ゴブリン 70368879 1 --成金ゴブリン
22842126 1 --汎神の帝王 22842126 1 --汎神の帝王
53129443 1 --ブラック·ホール 71650854 1 --半魔導帯域
08949584 1 --ヒーローアライブ
75500286 1 --封印の黄金櫃
07394770 1 --ブリリアント・フュージョン
73468603 1 --盆回し 73468603 1 --盆回し
15854426 1 --霞の谷の神風 15854426 1 --霞の谷の神風
58577036 1 --名推理 58577036 1 --名推理
43040603 1 --モンスターゲート
14733538 1 --竜呼相打つ 14733538 1 --竜呼相打つ
27970830 1 --六武の門 27970830 1 --六武の門
02295440 1 --ワン·フォー·ワン 02295440 1 --ワン·フォー·ワン
61740673 1 --王宮の勅命 61740673 1 --王宮の勅命
84749824 1 --神の警告 84749824 1 --神の警告
41420027 1 --神の宣告
82732705 1 --スキルドレイン 82732705 1 --スキルドレイン
73599290 1 --ソウルドレイン 73599290 1 --ソウルドレイン
17078030 1 --光の護封壁 17078030 1 --光の護封壁
30241314 1 --マクロコスモス 30241314 1 --マクロコスモス
32723153 1 --マジカル·エクスプロージョン 32723153 1 --マジカル·エクスプロージョン
89208725 1 --メタバース
#semi limit #semi limit
68184115 2 --甲虫装機 ダンセル
40044918 2 --E·HERO エアーマン
68819554 2 --Emダメージ・ジャグラー
82301904 2 --混沌帝龍 -終焉の使者-
09411399 2 --DHERO ディアボリックガイ 09411399 2 --DHERO ディアボリックガイ
73628505 2 --テラ・フォーミング 43694650 2 --Danger!? Jackalope?
99745551 2 --Danger!? Tsuchinoko?
70711847 2 --Danger! Nessie!
96570609 2 --天帝アイテール
90307777 2 --影霊衣の術士 シュリット
28297833 2 --ネクロフェイス 28297833 2 --ネクロフェイス
92746535 2 --竜剣士ラスターP 72405967 2 --王家の生け贄
48130397 2 --超融合
!2019.4 !2019.4
#forbidden #forbidden
...@@ -3781,6 +3786,193 @@ ...@@ -3781,6 +3786,193 @@
53582587 2 --激流葬 53582587 2 --激流葬
29401950 2 --奈落の落とし穴 29401950 2 --奈落の落とし穴
!2019.4 TCG
#forbidden
55623480 0 --妖精伝姫-シラユキ
75732622 0 --トーチ・ゴーレム
22593417 0 --トポロジック・ガンブラー・ドラゴン
10389142 0 --No.42 スターシップ・ギャラクシー・トマホーク
63504681 0 --No.86 HC ロンゴミアント
54447022 0 --ソウル・チャージ
05043010 0 --ファイアウォール・ドラゴン
05592689 0 --サクリファイス・ロータス
39064822 0 --トロイメア・ゴブリン
04423206 0 --M.X-セイバー インヴォーカー
76794549 0 --アストログラフ・マジシャン
20663556 0 --イレカエル
44910027 0 --ヴィクトリー・ドラゴン
25862681 0 --エンシェント・フェアリー・ドラゴン
53804307 0 --焔征竜-ブラスター
07563579 0 --Emヒグルミ
40318957 0 --EMドクロバット・ジョーカー
17330916 0 --EMモンキーボード
79106360 0 --カオスポッド
90411554 0 --巌征竜-レドックス
08903700 0 --儀式魔人リリーサー
17412721 0 --旧神ノーデン
65536818 0 --源竜星-ボウテンコウ
49684352 0 --虹彩の魔術師
34124316 0 --サイバーポッド
88071625 0 --The tyrant NEPTUNE
61665245 0 --サモン・ソーサレス
48905153 0 --十二獣ドランシア
85115440 0 --十二獣ブルホーン
21593977 0 --処刑人-マキュラ
30539496 0 --真竜皇リトスアジムD
21377582 0 --真竜剣皇マスターP
81122844 0 --発条空母ゼンマイティ
23434538 0 --増殖するG
00581014 0 --ダイガスタ・エメラル
15341821 0 --ダンディライオン
18326736 0 --星守の騎士 プトレマイオス
33184167 0 --同族感染ウィルス
54719828 0 --No.16 色の支配者ショック·ルーラー
58820923 0 --No.95 ギャラクシーアイズ・ダークマター・ドラゴン
43387895 0 --覇王眷竜スターヴ・ヴェノム
26400609 0 --瀑征竜-タイダル
78706415 0 --ファイバーポッド
93369354 0 --フィッシュボーグ-ガンナー
23558733 0 --フェニキシアン・クラスター・アマリリス
09929398 0 --BF-朧影のゴウフウ
31178212 0 --マジェスペクター・ユニコーン
34206604 0 --魔導サイエンティスト
96782886 0 --メンタルマスター
03078576 0 --八汰烏
34086406 0 --ラヴァルバル·チェイン
89399912 0 --嵐征竜-テンペスト
57421866 0 --レベル・スティーラー
41482598 0 --悪夢の蜃気楼
44763025 0 --いたずら好きな双子悪魔
19613556 0 --大嵐
17375316 0 --押収
35059553 0 --カイザーコロシアム
74191942 0 --苦渋の選択
42829885 0 --強引な番兵
45986603 0 --強奪
55144522 0 --強欲な壺
04031928 0 --心変わり
23557835 0 --次元融合
57953380 0 --生還の宝札
60682203 0 --大寒波
67616300 0 --チキンレース
67169062 0 --貪欲な壺
27770341 0 --超再生能力
69243953 0 --蝶の短剣-エルマ
79571449 0 --天使の施し
11110587 0 --隣の芝刈り
42703248 0 --ハリケーン
18144506 0 --ハーピィの羽根帚
70828912 0 --早すぎた埋葬
34906152 0 --マスドライバー
46448938 0 --魔導書の神判
46411259 0 --突然変異
85602018 0 --遺言状
94220427 0 --RUM-アージェント・カオス・フォース
03298689 0 --RUM-幻影騎士団ラウンチ
27174286 0 --異次元からの帰還
93016201 0 --王宮の弾圧
05851097 0 --虚無空間
57585212 0 --自爆スイッチ
03280747 0 --第六感
64697231 0 --ダスト·シュート
35316708 0 --刻の封印
80604091 0 --血の代償
28566710 0 --ラストバトル!
#limit
82301904 1 --混沌帝龍 -終焉の使者-
69015963 1 --デビル·フランケン
14536035 1 --ダーク・グレファー
90307777 1 --影霊衣の術士 シュリット
20366274 1 --エルシャドール・ネフィリム
07394770 1 --ブリリアント・フュージョン
75500286 1 --封印の黄金櫃
71650854 1 --半魔導帯域
73915051 1 --スケープ・ゴート
71344451 1 --一撃必殺!居合いドロー
28985331 1 --終末の騎士
40044918 1 --E·HERO エアーマン
33508719 1 --メタモルポット
24094258 1 --ヘビーメタルフォーゼ・エレクトラム
74586817 1 --PSYフレームロード・Ω
08949584 1 --ヒーローアライブ
72892473 1 --手札抹殺
52340444 1 --閃刀機-ホーネットビット
64034255 1 --A·ジェネクス·バードマン
45222299 1 --イビリチュア·ガストクラーケ
11877465 1 --イビリチュア·マインドオーガス
99177923 1 --インフェルニティ·デーモン
68184115 1 --甲虫装機 ダンセル
27552504 1 --永遠の淑女 ベアトリーチェ
68819554 1 --Emダメージ・ジャグラー
65518099 1 --クリフォート・ツール
12958919 1 --幻銃士
39512984 1 --ジェムナイトマスター・ダイヤ
78872731 1 --十二獣モルモラット
78868119 1 --深海のディーヴァ
58984738 1 --真竜拳士ダイナマイトK
04474060 1 --SPYRAL GEAR-ドローン
78080961 1 --SPYRAL-ジーニアス
81275020 1 --SRベイゴマックス
48063985 1 --聖霊獣騎 カンナホーク
63288573 1 --閃刀姫-カガリ
65192027 1 --ダーク·アームド·ドラゴン
96570609 1 --天帝アイテール
16226786 1 --深淵の暗殺者
18239909 1 --爆竜剣士イグニスターP
57143342 1 --彼岸の悪鬼 ガトルホッグ
20758643 1 --彼岸の悪鬼 グラバースニッチ
70583986 1 --氷結界の虎王ドゥローレン
52687916 1 --氷結界の龍 トリシューラ
33396948 1 --封印されしエクゾディア
07902349 1 --封印されし者の左腕
70903634 1 --封印されし者の右腕
44519536 1 --封印されし者の左足
08124921 1 --封印されし者の右足
10802915 1 --魔界発現世行きデスガイド
89463537 1 --ユニコールの影霊衣
88264978 1 --レッドアイズ·ダークネスメタルドラゴン
16188701 1 --レディ・デバッガー
33782437 1 --一時休戦
66957584 1 --インフェルニティガン
72405967 1 --王家の生け贄
81439173 1 --おろかな埋葬
67723438 1 --緊急テレポート
45305419 1 --継承の印
12580477 1 --サンダー·ボルト
95308449 1 --終焉のカウントダウン
74845897 1 --真炎の爆発
35125879 1 --真竜皇の復活
54631665 1 --SPYRAL RESORT
32807846 1 --増援
14087893 1 --月の書
81674782 1 --次元の裂け目
83764718 1 --死者蘇生
91623717 1 --連鎖爆撃
70368879 1 --成金ゴブリン
22842126 1 --汎神の帝王
53129443 1 --ブラック·ホール
73468603 1 --盆回し
15854426 1 --霞の谷の神風
58577036 1 --名推理
43040603 1 --モンスターゲート
14733538 1 --竜呼相打つ
27970830 1 --六武の門
02295440 1 --ワン·フォー·ワン
61740673 1 --王宮の勅命
84749824 1 --神の警告
41420027 1 --神の宣告
82732705 1 --スキルドレイン
73599290 1 --ソウルドレイン
17078030 1 --光の護封壁
30241314 1 --マクロコスモス
32723153 1 --マジカル·エクスプロージョン
#semi limit
09411399 2 --DHERO ディアボリックガイ
73628505 2 --テラ・フォーミング
28297833 2 --ネクロフェイス
92746535 2 --竜剣士ラスターP
48130397 2 --超融合
!2019.1 TCG !2019.1 TCG
#forbidden #forbidden
55623480 0 --妖精伝姫-シラユキ 55623480 0 --妖精伝姫-シラユキ
......
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