Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
ygopro
Commits
9addd246
Commit
9addd246
authored
Jul 15, 2019
by
DailyShana
Committed by
GitHub
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use standard mutex library (#2224)
parent
7ab508ab
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
224 additions
and
281 deletions
+224
-281
gframe/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/config.h
gframe/config.h
+1
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+8
-8
gframe/duelclient.cpp
gframe/duelclient.cpp
+173
-173
gframe/game.cpp
gframe/game.cpp
+2
-2
gframe/game.h
gframe/game.h
+1
-2
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+6
-6
gframe/mymutex.h
gframe/mymutex.h
+0
-56
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+18
-18
gframe/single_mode.cpp
gframe/single_mode.cpp
+13
-13
No files found.
gframe/client_field.cpp
View file @
9addd246
...
...
@@ -595,7 +595,7 @@ void ClientField::ShowSelectOption(int select_hint) {
wchar_t
textBuffer
[
256
];
int
count
=
select_options
.
size
();
bool
quickmode
=
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
for
(
auto
option
:
select_options
)
{
if
(
mainGame
->
guiFont
->
getDimension
(
dataManager
.
GetDesc
(
option
)).
Width
>
310
)
{
quickmode
=
false
;
...
...
@@ -643,7 +643,7 @@ void ClientField::ShowSelectOption(int select_hint) {
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
555
));
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
void
ClientField
::
ReplaySwap
()
{
std
::
swap
(
deck
[
0
],
deck
[
1
]);
...
...
gframe/config.h
View file @
9addd246
...
...
@@ -66,9 +66,9 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <memory.h>
#include <time.h>
#include <thread>
#include <mutex>
#include "bufferio.h"
#include "myfilesystem.h"
#include "mymutex.h"
#include "mysignal.h"
#include "../ocgcore/ocgapi.h"
#include "../ocgcore/common.h"
...
...
gframe/deck_con.cpp
View file @
9addd246
...
...
@@ -129,10 +129,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
id
)
{
case
BUTTON_CLEAR_DECK
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
dataManager
.
GetSysString
(
1339
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
break
;
}
...
...
@@ -183,22 +183,22 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_sel
=
sel
;
break
;
}
case
BUTTON_LEAVE_GAME
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
break
;
}
...
...
@@ -368,10 +368,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
case
COMBOBOX_DBDECKS
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
break
;
}
...
...
gframe/duelclient.cpp
View file @
9addd246
...
...
@@ -77,14 +77,14 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
bot_mode
&&
!
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
event_base_loopbreak
(
client_base
);
}
...
...
@@ -168,14 +168,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
bot_mode
&&
!
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
else
if
(
connect_state
==
0x7
)
{
if
(
!
mainGame
->
dInfo
.
isStarted
&&
!
mainGame
->
is_building
)
{
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
...
...
@@ -183,7 +183,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
...
...
@@ -194,9 +194,9 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
if
(
events
&
BEV_EVENT_EOF
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1401
));
else
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1502
));
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
...
...
@@ -205,11 +205,11 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
is_building
=
false
;
...
...
@@ -218,7 +218,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
}
...
...
@@ -251,7 +251,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
if
(
pkt
->
code
==
0
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1403
));
...
...
@@ -259,12 +259,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1404
));
else
if
(
pkt
->
code
==
2
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1405
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
event_base_loopbreak
(
client_base
);
break
;
}
case
ERRMSG_DECKERROR
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
unsigned
int
code
=
pkt
->
code
&
0xFFFFFFF
;
int
flag
=
pkt
->
code
>>
28
;
wchar_t
msgbuf
[
256
];
...
...
@@ -313,14 +313,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
msgbuf
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
ERRMSG_SIDEERROR
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1408
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
ERRMSG_VERERROR
:
{
...
...
@@ -329,12 +329,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1411
),
pkt
->
code
>>
12
,
(
pkt
->
code
>>
4
)
&
0xff
,
pkt
->
code
&
0xf
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
msgbuf
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
event_base_loopbreak
(
client_base
);
break
;
}
...
...
@@ -346,9 +346,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_SELECT_TP
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
PopupElement
(
mainGame
->
wFTSelect
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
STOC_HAND_RESULT
:
{
...
...
@@ -365,7 +365,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_CHANGE_SIDE
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dField
.
Clear
();
mainGame
->
is_building
=
true
;
...
...
@@ -398,15 +398,15 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
deckBuilder
.
pre_extrac
=
deckManager
.
current_deck
.
extra
.
size
();
mainGame
->
deckBuilder
.
pre_sidec
=
deckManager
.
current_deck
.
side
.
size
();
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
deckBuilder
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
STOC_WAITING_SIDE
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
Clear
();
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
mainGame
->
stHintMsg
->
setVisible
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
STOC_JOIN_GAME
:
{
...
...
@@ -442,7 +442,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf
(
msgbuf
,
L"*%ls
\n
"
,
dataManager
.
GetSysString
(
1230
));
str
.
append
(
msgbuf
);
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
pkt
->
info
.
mode
==
2
)
{
mainGame
->
dInfo
.
isTag
=
true
;
mainGame
->
chkHostPrepReady
[
2
]
->
setVisible
(
true
);
...
...
@@ -486,7 +486,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
dInfo
.
duel_rule
=
pkt
->
info
.
duel_rule
;
watching
=
0
;
connect_state
|=
0x4
;
...
...
@@ -568,7 +568,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case
STOC_DUEL_START
:
{
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
isStarted
=
true
;
mainGame
->
dInfo
.
isFinished
=
false
;
...
...
@@ -632,12 +632,12 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
dInfo
.
tag_player
[
0
]
=
false
;
mainGame
->
dInfo
.
tag_player
[
1
]
=
false
;
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
match_kill
=
0
;
break
;
}
case
STOC_DUEL_END
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
btnSpectatorSwap
->
setVisible
(
false
);
...
...
@@ -648,13 +648,13 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
wSurrender
->
setVisible
(
false
);
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1500
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
is_building
=
false
;
...
...
@@ -670,14 +670,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
event_base_loopbreak
(
client_base
);
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
break
;
}
case
STOC_REPLAY
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wPhase
->
setVisible
(
false
);
mainGame
->
wSurrender
->
setVisible
(
false
);
if
(
mainGame
->
dInfo
.
player_type
<
7
)
...
...
@@ -698,7 +698,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
}
...
...
@@ -708,7 +708,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
30
);
}
if
(
mainGame
->
actionParam
||
!
is_host
)
{
...
...
@@ -765,9 +765,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
wchar_t
msg
[
256
];
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
AddChatMsg
(
msg
,
player
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
...
...
@@ -792,9 +792,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
else
if
(
pkt
->
pos
==
1
)
BufferIO
::
CopyWStr
(
pkt
->
name
,
mainGame
->
dInfo
.
clientname
,
20
);
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stHostPrepDuelist
[
pkt
->
pos
]
->
setText
(
name
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
FlashWindow
();
break
;
}
...
...
@@ -804,7 +804,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
unsigned
char
state
=
pkt
->
status
&
0xf
;
if
(
pos
>
3
)
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
state
<
8
)
{
soundManager
.
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
wchar_t
*
prename
=
(
wchar_t
*
)
mainGame
->
stHostPrepDuelist
[
pos
]
->
getText
();
...
...
@@ -848,7 +848,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
else
{
mainGame
->
btnHostPrepStart
->
setEnabled
(
false
);
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
STOC_HS_WATCH_CHANGE
:
{
...
...
@@ -856,9 +856,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
watching
=
pkt
->
watch_count
;
wchar_t
watchbuf
[
32
];
myswprintf
(
watchbuf
,
L"%ls%d"
,
dataManager
.
GetSysString
(
1253
),
watching
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stHostPrepOB
->
setText
(
watchbuf
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
}
...
...
@@ -876,24 +876,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
waitFrame
=
-
1
;
mainGame
->
stHintMsg
->
setVisible
(
false
);
if
(
mainGame
->
wCardSelect
->
isVisible
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
11
);
}
if
(
mainGame
->
wOptions
->
isVisible
())
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
HideElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
11
);
}
}
if
(
mainGame
->
dInfo
.
time_player
==
1
)
mainGame
->
dInfo
.
time_player
=
2
;
if
(
is_swapping
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
ReplaySwap
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
is_swapping
=
false
;
}
switch
(
mainGame
->
dInfo
.
curMsg
)
{
...
...
@@ -943,26 +943,26 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
default:
break
;
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetDesc
(
err_desc
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
select_hint
=
last_select_hint
;
return
ClientAnalyze
(
last_successful_msg
,
last_successful_msg_length
);
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
if
(
!
mainGame
->
dInfo
.
isSingleMode
)
{
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
...
...
@@ -976,7 +976,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
event_base_loopbreak
(
client_base
);
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
...
...
@@ -995,10 +995,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break
;
}
case
HINT_MESSAGE
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetDesc
(
data
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
break
;
...
...
@@ -1011,10 +1011,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case
HINT_OPSELECTED
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1510
),
dataManager
.
GetDesc
(
data
));
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
break
;
}
...
...
@@ -1028,40 +1028,40 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case
HINT_RACE
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatRace
(
data
));
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
break
;
}
case
HINT_ATTRIB
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatAttribute
(
data
));
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
break
;
}
case
HINT_CODE
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
GetName
(
data
));
mainGame
->
AddLog
(
textBuffer
,
data
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
break
;
}
case
HINT_NUMBER
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1512
),
data
);
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
break
;
}
...
...
@@ -1112,10 +1112,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case
MSG_WAITING
:
{
mainGame
->
waitFrame
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1390
));
mainGame
->
stHintMsg
->
setVisible
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_START
:
{
...
...
@@ -1125,7 +1125,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
showcard
=
101
;
mainGame
->
WaitFrameSignal
(
40
);
mainGame
->
showcard
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
int
playertype
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dInfo
.
isFirst
=
(
playertype
&
0xf
)
?
false
:
true
;
if
(
playertype
&
0xf0
)
...
...
@@ -1159,24 +1159,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dInfo
.
isReplaySwapped
=
false
;
mainGame
->
dField
.
ReplaySwap
();
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_UPDATE_DATA
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
location
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
UpdateFieldCard
(
player
,
location
,
pbuf
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_UPDATE_CARD
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
loc
=
BufferIO
::
ReadInt8
(
pbuf
);
int
seq
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
UpdateCard
(
player
,
loc
,
seq
,
pbuf
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
MSG_SELECT_BATTLECMD
:
{
...
...
@@ -1225,7 +1225,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
attackable_cards
.
push_back
(
pcard
);
pcard
->
cmdFlag
|=
COMMAND_ATTACK
;
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
BufferIO
::
ReadInt8
(
pbuf
))
{
mainGame
->
btnM2
->
setVisible
(
true
);
mainGame
->
btnM2
->
setEnabled
(
true
);
...
...
@@ -1236,7 +1236,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnEP
->
setEnabled
(
true
);
mainGame
->
btnEP
->
setPressed
(
false
);
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_IDLECMD
:
{
...
...
@@ -1387,20 +1387,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
else
{
myswprintf
(
textBuffer
,
dataManager
.
GetDesc
(
desc
),
dataManager
.
GetName
(
code
));
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_YESNO
:
{
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
int
desc
=
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dField
.
highlighting_card
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
dataManager
.
GetDesc
(
desc
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_OPTION
:
{
...
...
@@ -1453,10 +1453,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
);
select_hint
=
0
;
if
(
panelmode
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
(
select_ready
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
else
{
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
...
...
@@ -1533,10 +1533,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
);
select_hint
=
0
;
if
(
panelmode
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
(
mainGame
->
dField
.
select_cancelable
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
else
{
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
...
...
@@ -1621,7 +1621,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
DuelClient
::
SendResponse
();
return
true
;
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
!
conti_exist
)
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
550
));
else
...
...
@@ -1646,7 +1646,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
}
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_PLACE
:
...
...
@@ -1765,9 +1765,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnPSDD
->
setVisible
(
true
);
startpos
+=
145
;
}
else
mainGame
->
btnPSDD
->
setVisible
(
false
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
PopupElement
(
mainGame
->
wPosSelect
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_TRIBUTE
:
{
...
...
@@ -1802,13 +1802,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
if
(
mainGame
->
dField
.
select_cancelable
)
{
mainGame
->
dField
.
ShowCancelOrFinishButton
(
1
);
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_COUNTER
:
{
...
...
@@ -1831,10 +1831,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
is_selectable
=
true
;
}
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
204
),
mainGame
->
dField
.
select_counter_count
,
dataManager
.
GetCounterName
(
mainGame
->
dField
.
select_counter_type
));
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_SELECT_SUM
:
{
...
...
@@ -1944,10 +1944,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pcard
=
*
(
mainGame
->
dField
.
deck
[
player
].
rbegin
()
+
i
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
textBuffer
,
L"*[%ls]"
,
dataManager
.
GetName
(
pcard
->
code
));
mainGame
->
AddLog
(
textBuffer
,
pcard
->
code
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
float
shift
=
-
0.15
f
;
if
(
player
==
1
)
shift
=
0.15
f
;
pcard
->
dPos
=
irr
::
core
::
vector3df
(
shift
,
0
,
0
);
...
...
@@ -1982,10 +1982,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pcard
=
*
(
mainGame
->
dField
.
extra
[
player
].
rbegin
()
+
i
+
mainGame
->
dField
.
extra_p_count
[
player
]);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
textBuffer
,
L"*[%ls]"
,
dataManager
.
GetName
(
pcard
->
code
));
mainGame
->
AddLog
(
textBuffer
,
pcard
->
code
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
player
==
0
)
pcard
->
dPos
=
irr
::
core
::
vector3df
(
0
,
-
0.20
f
,
0
);
else
...
...
@@ -2021,10 +2021,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
)
pcard
->
SetCode
(
code
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
textBuffer
,
L"*[%ls]"
,
dataManager
.
GetName
(
code
));
mainGame
->
AddLog
(
textBuffer
,
code
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
l
&
0x41
)
{
if
(
count
==
1
)
{
float
shift
=
-
0.15
f
;
...
...
@@ -2088,12 +2088,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
if
(
panel_confirm
.
size
())
{
std
::
sort
(
panel_confirm
.
begin
(),
panel_confirm
.
end
(),
ClientCard
::
client_card_sort
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
selectable_cards
=
panel_confirm
;
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
208
),
panel_confirm
.
size
());
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
(
true
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
}
...
...
@@ -2233,7 +2233,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
grave
[
player
].
swap
(
mainGame
->
dField
.
deck
[
player
]);
for
(
auto
cit
=
mainGame
->
dField
.
grave
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
grave
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
location
=
LOCATION_GRAVE
;
...
...
@@ -2253,7 +2253,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
11
);
}
return
true
;
...
...
@@ -2439,9 +2439,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
position
=
cp
;
pcard
->
SetCode
(
code
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
AddCard
(
pcard
,
cc
,
cl
,
cs
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
dField
.
GetCardLocation
(
pcard
,
&
pcard
->
curPos
,
&
pcard
->
curRot
,
true
);
pcard
->
curAlpha
=
5
;
mainGame
->
dField
.
FadeCard
(
pcard
,
255
,
20
);
...
...
@@ -2458,9 +2458,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dField
.
FadeCard
(
pcard
,
5
,
20
);
mainGame
->
WaitFrameSignal
(
20
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RemoveCard
(
pc
,
pl
,
ps
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
pcard
==
mainGame
->
dField
.
hovered_card
)
mainGame
->
dField
.
hovered_card
=
0
;
}
else
...
...
@@ -2492,11 +2492,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
position
=
cp
;
mainGame
->
dField
.
AddCard
(
pcard
,
cc
,
cl
,
cs
);
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RemoveCard
(
pc
,
pl
,
ps
);
pcard
->
position
=
cp
;
mainGame
->
dField
.
AddCard
(
pcard
,
cc
,
cl
,
cs
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
pl
==
cl
&&
pc
==
cc
&&
(
cl
&
0x71
))
{
pcard
->
dPos
=
irr
::
core
::
vector3df
(
-
0.3
f
,
0
,
0
);
pcard
->
dRot
=
irr
::
core
::
vector3df
(
0
,
0
,
0
);
...
...
@@ -2508,24 +2508,24 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
5
);
}
else
{
if
(
cl
==
0x4
&&
pcard
->
overlayed
.
size
()
>
0
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
for
(
size_t
i
=
0
;
i
<
pcard
->
overlayed
.
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
pcard
->
overlayed
[
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
10
);
}
if
(
cl
==
0x2
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
for
(
size_t
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
cc
].
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
cc
][
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
if
(
pl
==
0x2
)
for
(
size_t
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
pc
].
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
pc
][
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
mainGame
->
WaitFrameSignal
(
5
);
}
...
...
@@ -2547,21 +2547,21 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
location
=
0x80
;
pcard
->
sequence
=
olcard
->
overlayed
.
size
()
-
1
;
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RemoveCard
(
pc
,
pl
,
ps
);
olcard
->
overlayed
.
push_back
(
pcard
);
mainGame
->
dField
.
overlay_cards
.
insert
(
pcard
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
pcard
->
overlayTarget
=
olcard
;
pcard
->
location
=
0x80
;
pcard
->
sequence
=
olcard
->
overlayed
.
size
()
-
1
;
if
(
olcard
->
location
==
0x4
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
if
(
pl
==
0x2
)
for
(
size_t
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
pc
].
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
pc
][
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
5
);
}
}
...
...
@@ -2577,7 +2577,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for
(
size_t
i
=
0
;
i
<
olcard
->
overlayed
.
size
();
++
i
)
olcard
->
overlayed
[
i
]
->
sequence
=
i
;
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
olcard
->
overlayed
.
erase
(
olcard
->
overlayed
.
begin
()
+
pcard
->
sequence
);
pcard
->
overlayTarget
=
0
;
pcard
->
position
=
cp
;
...
...
@@ -2587,11 +2587,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard
->
overlayed
[
i
]
->
sequence
=
i
;
mainGame
->
dField
.
MoveCard
(
olcard
->
overlayed
[
i
],
2
);
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
5
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
5
);
}
}
else
{
...
...
@@ -2608,7 +2608,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard1
->
overlayed
[
i
]
->
sequence
=
i
;
}
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
olcard1
->
overlayed
.
erase
(
olcard1
->
overlayed
.
begin
()
+
pcard
->
sequence
);
olcard2
->
overlayed
.
push_back
(
pcard
);
pcard
->
sequence
=
olcard2
->
overlayed
.
size
()
-
1
;
...
...
@@ -2619,7 +2619,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
MoveCard
(
olcard1
->
overlayed
[
i
],
2
);
}
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
5
);
}
}
...
...
@@ -2674,7 +2674,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RemoveCard
(
c1
,
l1
,
s1
);
mainGame
->
dField
.
RemoveCard
(
c2
,
l2
,
s2
);
mainGame
->
dField
.
AddCard
(
pc1
,
c2
,
l2
,
s2
);
...
...
@@ -2685,7 +2685,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
MoveCard
(
pc1
->
overlayed
[
i
],
10
);
for
(
size_t
i
=
0
;
i
<
pc2
->
overlayed
.
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
pc2
->
overlayed
[
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
11
);
}
else
{
mainGame
->
dField
.
RemoveCard
(
c1
,
l1
,
s1
);
...
...
@@ -2844,9 +2844,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1609
),
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
chains
.
push_back
(
mainGame
->
dField
.
current_chain
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
ct
>
1
)
mainGame
->
WaitFrameSignal
(
20
);
mainGame
->
dField
.
last_chain
=
true
;
...
...
@@ -2980,13 +2980,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
else
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
soundManager
.
PlaySoundEffect
(
SOUND_DRAW
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
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
.
AddCard
(
pcard
,
player
,
LOCATION_HAND
,
0
);
for
(
size_t
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
player
].
size
();
++
i
)
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
player
][
i
],
10
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
5
);
}
}
...
...
@@ -3021,9 +3021,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_RECOVER
:
{
...
...
@@ -3050,9 +3050,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_EQUIP
:
{
...
...
@@ -3073,7 +3073,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc2
->
equipped
.
insert
(
pc1
);
}
else
{
soundManager
.
PlaySoundEffect
(
SOUND_EQUIP
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
pc1
->
equipTarget
)
{
pc1
->
is_showequip
=
false
;
pc1
->
equipTarget
->
is_showequip
=
false
;
...
...
@@ -3085,7 +3085,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc2
->
is_showequip
=
true
;
else
if
(
mainGame
->
dField
.
hovered_card
==
pc2
)
pc1
->
is_showequip
=
true
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
return
true
;
}
...
...
@@ -3102,9 +3102,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
dInfo
.
lp
[
player
]
=
val
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_UNEQUIP
:
{
...
...
@@ -3117,14 +3117,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc
->
equipTarget
->
equipped
.
erase
(
pc
);
pc
->
equipTarget
=
0
;
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
mainGame
->
dField
.
hovered_card
==
pc
)
pc
->
equipTarget
->
is_showequip
=
false
;
else
if
(
mainGame
->
dField
.
hovered_card
==
pc
->
equipTarget
)
pc
->
is_showequip
=
false
;
pc
->
equipTarget
->
equipped
.
erase
(
pc
);
pc
->
equipTarget
=
0
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
return
true
;
}
...
...
@@ -3143,14 +3143,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1
->
cardTarget
.
insert
(
pc2
);
pc2
->
ownerTarget
.
insert
(
pc1
);
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
pc1
->
cardTarget
.
insert
(
pc2
);
pc2
->
ownerTarget
.
insert
(
pc1
);
if
(
mainGame
->
dField
.
hovered_card
==
pc1
)
pc2
->
is_showtarget
=
true
;
else
if
(
mainGame
->
dField
.
hovered_card
==
pc2
)
pc1
->
is_showtarget
=
true
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
break
;
}
...
...
@@ -3169,14 +3169,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1
->
cardTarget
.
erase
(
pc2
);
pc2
->
ownerTarget
.
erase
(
pc1
);
}
else
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
pc1
->
cardTarget
.
erase
(
pc2
);
pc2
->
ownerTarget
.
erase
(
pc1
);
if
(
mainGame
->
dField
.
hovered_card
==
pc1
)
pc2
->
is_showtarget
=
false
;
else
if
(
mainGame
->
dField
.
hovered_card
==
pc2
)
pc1
->
is_showtarget
=
false
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
break
;
}
...
...
@@ -3202,9 +3202,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_ADD_COUNTER
:
{
...
...
@@ -3222,10 +3222,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
soundManager
.
PlaySoundEffect
(
SOUND_COUNTER_ADD
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1617
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
pc
->
is_highlighting
=
false
;
return
true
;
...
...
@@ -3245,10 +3245,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
soundManager
.
PlaySoundEffect
(
SOUND_COUNTER_REMOVE
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1618
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
pc
->
is_highlighting
=
false
;
return
true
;
...
...
@@ -3321,7 +3321,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int dd = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
ca
,
la
,
sa
);
if
(
aatk
!=
pcard
->
attack
)
{
pcard
->
attack
=
aatk
;
...
...
@@ -3342,7 +3342,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
pcard
->
defstring
,
L"%d"
,
ddef
);
}
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
true
;
}
case
MSG_ATTACK_DISABLED
:
{
...
...
@@ -3377,11 +3377,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
soundManager
.
PlaySoundEffect
(
SOUND_COIN
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
return
true
;
}
...
...
@@ -3400,11 +3400,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
soundManager
.
PlaySoundEffect
(
SOUND_DICE
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
40
);
return
true
;
}
...
...
@@ -3412,9 +3412,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
PopupElement
(
mainGame
->
wHand
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_HAND_RES
:
{
...
...
@@ -3448,10 +3448,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
563
));
select_hint
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_ANNOUNCE_ATTRIB
:
{
...
...
@@ -3468,10 +3468,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
562
));
select_hint
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_ANNOUNCE_CARD
:
{
...
...
@@ -3484,18 +3484,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
564
));
select_hint
=
0
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
ebANCard
->
setText
(
L""
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarableList
();
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
cbANNumber
->
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
value
=
BufferIO
::
ReadInt32
(
pbuf
);
...
...
@@ -3509,7 +3509,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint
=
0
;
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
return
false
;
}
case
MSG_CARD_HINT
:
{
...
...
@@ -3600,7 +3600,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
//
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
if
(
mainGame
->
dField
.
deck
[
player
].
size
()
>
mcount
)
{
while
(
mainGame
->
dField
.
deck
[
player
].
size
()
>
mcount
)
{
ClientCard
*
ccard
=
*
mainGame
->
dField
.
deck
[
player
].
rbegin
();
...
...
@@ -3648,7 +3648,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
dField
.
extra_p_count
[
player
]
=
pcount
;
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
//
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
...
...
@@ -3681,7 +3681,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break
;
}
case
MSG_RELOAD_FIELD
:
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
ReadInt8
(
pbuf
);
int
val
=
0
;
...
...
@@ -3789,7 +3789,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
last_chain
=
true
;
}
}
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
}
...
...
@@ -3937,7 +3937,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
unsigned
int
ipaddr
=
bc_addr
.
sin_addr
.
s_addr
;
HostPacket
*
pHP
=
(
HostPacket
*
)
buf
;
if
(
!
is_closing
&&
pHP
->
identifier
==
NETWORK_SERVER_ID
&&
pHP
->
version
==
PRO_VERSION
&&
remotes
.
find
(
ipaddr
)
==
remotes
.
end
()
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
remotes
.
insert
(
ipaddr
);
pHP
->
ipaddr
=
ipaddr
;
hosts
.
push_back
(
*
pHP
);
...
...
@@ -3959,7 +3959,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
BufferIO
::
CopyWStr
(
pHP
->
name
,
gamename
,
20
);
hoststr
.
append
(
gamename
);
mainGame
->
lstHostList
->
addItem
(
hoststr
.
c_str
());
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
}
...
...
gframe/game.cpp
View file @
9addd246
...
...
@@ -791,7 +791,7 @@ void Game::MainLoop() {
atkframe
+=
0.1
f
;
atkdy
=
(
float
)
sin
(
atkframe
);
driver
->
beginScene
(
true
,
true
,
SColor
(
0
,
0
,
0
,
0
));
gMutex
.
L
ock
();
gMutex
.
l
ock
();
if
(
dInfo
.
isStarted
)
{
if
(
dInfo
.
isFinished
&&
showcardcode
==
1
)
soundManager
.
PlayBGM
(
BGM_WIN
);
...
...
@@ -820,7 +820,7 @@ void Game::MainLoop() {
}
DrawGUI
();
DrawSpec
();
gMutex
.
U
nlock
();
gMutex
.
u
nlock
();
if
(
signalFrame
>
0
)
{
signalFrame
--
;
if
(
!
signalFrame
)
...
...
gframe/game.h
View file @
9addd246
...
...
@@ -175,8 +175,7 @@ public:
void
FlashWindow
();
void
SetCursor
(
ECURSOR_ICON
icon
);
Mutex
gMutex
;
Mutex
gBuffer
;
std
::
mutex
gMutex
;
Signal
frameSignal
;
Signal
actionSignal
;
Signal
replaySignal
;
...
...
gframe/menu_handler.cpp
View file @
9addd246
...
...
@@ -80,10 +80,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
hints
.
ai_flags
=
EVUTIL_AI_ADDRCONFIG
;
int
status
=
evutil_getaddrinfo
(
hostname
,
port
,
&
hints
,
&
answer
);
if
(
status
!=
0
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1412
));
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
else
{
sockaddr_in
*
sin
=
((
struct
sockaddr_in
*
)
answer
->
ai_addr
);
...
...
@@ -245,12 +245,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
lstReplayList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
),
dataManager
.
GetSysString
(
1363
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_sel
=
sel
;
break
;
...
...
@@ -259,11 +259,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
sel
=
mainGame
->
lstReplayList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1364
));
mainGame
->
ebRSName
->
setText
(
mainGame
->
lstReplayList
->
getListItem
(
sel
));
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
prev_operation
=
id
;
prev_sel
=
sel
;
break
;
...
...
gframe/mymutex.h
deleted
100644 → 0
View file @
7ab508ab
#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
gframe/replay_mode.cpp
View file @
9addd246
...
...
@@ -90,7 +90,7 @@ int ReplayMode::ReplayThread() {
exit_pending
=
false
;
current_step
=
0
;
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
while
(
is_continuing
&&
!
exit_pending
)
{
int
result
=
process
(
pduel
);
int
len
=
result
&
0xffff
;
...
...
@@ -99,7 +99,7 @@ int ReplayMode::ReplayThread() {
get_message
(
pduel
,
(
byte
*
)
engineBuffer
);
is_continuing
=
ReplayAnalyze
(
engineBuffer
,
len
);
if
(
is_restarting
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
is_restarting
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
true
;
Restart
(
false
);
...
...
@@ -125,7 +125,7 @@ int ReplayMode::ReplayThread() {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
skip_step
=
step
;
current_step
=
0
;
...
...
@@ -135,7 +135,7 @@ int ReplayMode::ReplayThread() {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
EndDuel
();
return
0
;
...
...
@@ -228,26 +228,26 @@ void ReplayMode::EndDuel() {
end_duel
(
pduel
);
if
(
!
is_closing
)
{
mainGame
->
actionSignal
.
Reset
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1501
));
if
(
mainGame
->
wCardSelect
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isReplay
=
false
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
ShowElement
(
mainGame
->
wReplay
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
}
...
...
@@ -291,9 +291,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
return
true
;
}
if
(
is_swaping
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
ReplaySwap
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
is_swaping
=
false
;
}
char
*
offset
=
pbuf
;
...
...
@@ -304,12 +304,12 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
return
false
;
...
...
@@ -323,7 +323,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
pbuf
+=
2
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
...
...
@@ -505,7 +505,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
if
(
skip_turn
==
0
)
{
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -842,7 +842,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isReplaySkiping
=
false
;
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
}
}
if
(
is_pausing
)
{
...
...
gframe/single_mode.cpp
View file @
9addd246
...
...
@@ -79,7 +79,7 @@ int SingleMode::SinglePlayThread() {
rh
.
version
=
PRO_VERSION
;
rh
.
flag
=
REPLAY_SINGLE_MODE
;
rh
.
seed
=
seed
;
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ClearCardInfo
();
mainGame
->
wCardImg
->
setVisible
(
true
);
...
...
@@ -93,7 +93,7 @@ int SingleMode::SinglePlayThread() {
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
true
;
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
char
engineBuffer
[
0x1000
];
is_closing
=
false
;
is_continuing
=
true
;
...
...
@@ -125,7 +125,7 @@ int SingleMode::SinglePlayThread() {
}
}
last_replay
.
EndRecord
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
time_t
nowtime
=
time
(
NULL
);
tm
*
localedtime
=
localtime
(
&
nowtime
);
wchar_t
timetext
[
40
];
...
...
@@ -134,7 +134,7 @@ int SingleMode::SinglePlayThread() {
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
}
else
{
...
...
@@ -143,26 +143,26 @@ int SingleMode::SinglePlayThread() {
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
WaitFrameSignal
(
30
);
}
if
(
mainGame
->
actionParam
)
last_replay
.
SaveReplay
(
mainGame
->
ebRSName
->
getText
());
end_duel
(
pduel
);
if
(
!
is_closing
)
{
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
}
...
...
@@ -732,9 +732,9 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf
++
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayReload
();
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
break
;
}
case
MSG_AI_NAME
:
{
...
...
@@ -756,10 +756,10 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
pbuf
+=
len
+
1
;
memcpy
(
msgbuf
,
begin
,
len
+
1
);
BufferIO
::
DecodeUTF8
(
msgbuf
,
msg
);
mainGame
->
gMutex
.
L
ock
();
mainGame
->
gMutex
.
l
ock
();
mainGame
->
SetStaticText
(
mainGame
->
stMessage
,
310
,
mainGame
->
guiFont
,
msg
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
gMutex
.
U
nlock
();
mainGame
->
gMutex
.
u
nlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment