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
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
MyCard
ygopro
Commits
e1d52185
Commit
e1d52185
authored
Sep 28, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
parents
0433b3a7
1cfa1a1c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
62 additions
and
38 deletions
+62
-38
gframe/data_manager.cpp
gframe/data_manager.cpp
+1
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+2
-0
gframe/drawing.cpp
gframe/drawing.cpp
+12
-10
gframe/duelclient.cpp
gframe/duelclient.cpp
+1
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/network.h
gframe/network.h
+1
-1
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+3
-2
gframe/replay_mode.h
gframe/replay_mode.h
+2
-2
gframe/single_duel.cpp
gframe/single_duel.cpp
+14
-6
gframe/single_duel.h
gframe/single_duel.h
+3
-3
gframe/single_mode.cpp
gframe/single_mode.cpp
+3
-2
gframe/single_mode.h
gframe/single_mode.h
+2
-2
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+14
-6
gframe/tag_duel.h
gframe/tag_duel.h
+3
-3
No files found.
gframe/data_manager.cpp
View file @
e1d52185
...
@@ -11,7 +11,6 @@ DataManager dataManager;
...
@@ -11,7 +11,6 @@ DataManager dataManager;
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
bool
DataManager
::
LoadDB
(
const
wchar_t
*
wfile
)
{
char
file
[
256
];
char
file
[
256
];
wchar_t
strBuffer
[
4096
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
#ifdef _WIN32
#ifdef _WIN32
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
wfile
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
wfile
);
...
@@ -37,6 +36,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -37,6 +36,7 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
return
Error
(
&
db
);
return
Error
(
&
db
);
CardDataC
cd
;
CardDataC
cd
;
CardString
cs
;
CardString
cs
;
wchar_t
strBuffer
[
4096
];
int
step
=
0
;
int
step
=
0
;
do
{
do
{
step
=
sqlite3_step
(
pStmt
);
step
=
sqlite3_step
(
pStmt
);
...
...
gframe/deck_con.cpp
View file @
e1d52185
...
@@ -118,6 +118,7 @@ void DeckBuilder::Terminate() {
...
@@ -118,6 +118,7 @@ void DeckBuilder::Terminate() {
mainGame
->
showingcode
=
0
;
mainGame
->
showingcode
=
0
;
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setPos
(
0
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
if
(
catesel
>=
0
)
if
(
catesel
>=
0
)
BufferIO
::
CopyWStr
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyWStr
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
...
@@ -1637,6 +1638,7 @@ void DeckBuilder::RefreshPackListScroll() {
...
@@ -1637,6 +1638,7 @@ void DeckBuilder::RefreshPackListScroll() {
}
}
}
else
{
}
else
{
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setPos
(
0
);
}
}
}
}
void
DeckBuilder
::
ChangeCategory
(
int
catesel
)
{
void
DeckBuilder
::
ChangeCategory
(
int
catesel
)
{
...
...
gframe/drawing.cpp
View file @
e1d52185
...
@@ -517,12 +517,14 @@ void Game::DrawMisc() {
...
@@ -517,12 +517,14 @@ void Game::DrawMisc() {
}
}
driver
->
draw2DImage
(
imageManager
.
tLPFrame
,
Resize
(
330
,
10
,
629
,
30
),
recti
(
0
,
0
,
200
,
20
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPFrame
,
Resize
(
330
,
10
,
629
,
30
),
recti
(
0
,
0
,
200
,
20
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPFrame
,
Resize
(
691
,
10
,
990
,
30
),
recti
(
0
,
0
,
200
,
20
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPFrame
,
Resize
(
691
,
10
,
990
,
30
),
recti
(
0
,
0
,
200
,
20
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
0
]
>=
8000
)
if
(
dInfo
.
start_lp
)
{
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
335
,
12
,
625
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
0
]
>=
dInfo
.
start_lp
)
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
335
,
12
,
335
+
290
*
dInfo
.
lp
[
0
]
/
8000
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
335
,
12
,
625
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
1
]
>=
8000
)
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
335
,
12
,
335
+
290
*
dInfo
.
lp
[
0
]
/
dInfo
.
start_lp
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
696
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
if
(
dInfo
.
lp
[
1
]
>=
dInfo
.
start_lp
)
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
986
-
290
*
dInfo
.
lp
[
1
]
/
8000
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
696
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
986
-
290
*
dInfo
.
lp
[
1
]
/
dInfo
.
start_lp
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
}
if
(
lpframe
)
{
if
(
lpframe
)
{
dInfo
.
lp
[
lpplayer
]
-=
lpd
;
dInfo
.
lp
[
lpplayer
]
-=
lpd
;
myswprintf
(
dInfo
.
strLP
[
lpplayer
],
L"%d"
,
dInfo
.
lp
[
lpplayer
]);
myswprintf
(
dInfo
.
strLP
[
lpplayer
],
L"%d"
,
dInfo
.
lp
[
lpplayer
]);
...
@@ -685,10 +687,10 @@ void Game::DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2) {
...
@@ -685,10 +687,10 @@ void Game::DrawStatus(ClientCard* pcard, int x1, int y1, int x2, int y2) {
}
}
}
}
void
Game
::
DrawGUI
()
{
void
Game
::
DrawGUI
()
{
if
(
imageLoading
.
size
())
{
while
(
imageLoading
.
size
())
{
for
(
auto
mit
=
imageLoading
.
begin
();
mit
!=
imageLoading
.
end
();
++
mit
)
auto
mit
=
imageLoading
.
cbegin
();
mit
->
first
->
setImage
(
imageManager
.
GetTexture
(
mit
->
second
));
mit
->
first
->
setImage
(
imageManager
.
GetTexture
(
mit
->
second
));
imageLoading
.
clear
(
);
imageLoading
.
erase
(
mit
);
}
}
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();)
{
for
(
auto
fit
=
fadingList
.
begin
();
fit
!=
fadingList
.
end
();)
{
auto
fthis
=
fit
++
;
auto
fthis
=
fit
++
;
...
...
gframe/duelclient.cpp
View file @
e1d52185
...
@@ -495,6 +495,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -495,6 +495,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
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
;
mainGame
->
dInfo
.
start_lp
=
pkt
->
info
.
start_lp
;
watching
=
0
;
watching
=
0
;
connect_state
|=
0x4
;
connect_state
|=
0x4
;
break
;
break
;
...
...
gframe/game.h
View file @
e1d52185
...
@@ -75,6 +75,7 @@ struct DuelInfo {
...
@@ -75,6 +75,7 @@ struct DuelInfo {
bool
is_shuffling
;
bool
is_shuffling
;
bool
tag_player
[
2
];
bool
tag_player
[
2
];
int
lp
[
2
];
int
lp
[
2
];
int
start_lp
;
int
duel_rule
;
int
duel_rule
;
int
turn
;
int
turn
;
short
curMsg
;
short
curMsg
;
...
...
gframe/network.h
View file @
e1d52185
...
@@ -141,7 +141,7 @@ public:
...
@@ -141,7 +141,7 @@ public:
DuelPlayer
*
host_player
;
DuelPlayer
*
host_player
;
HostInfo
host_info
;
HostInfo
host_info
;
int
duel_stage
;
int
duel_stage
;
unsigned
long
pduel
;
intptr_t
pduel
;
wchar_t
name
[
20
];
wchar_t
name
[
20
];
wchar_t
pass
[
20
];
wchar_t
pass
[
20
];
};
};
...
...
gframe/replay_mode.cpp
View file @
e1d52185
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
namespace
ygo
{
namespace
ygo
{
long
ReplayMode
::
pduel
=
0
;
intptr_t
ReplayMode
::
pduel
=
0
;
Replay
ReplayMode
::
cur_replay
;
Replay
ReplayMode
::
cur_replay
;
bool
ReplayMode
::
is_continuing
=
true
;
bool
ReplayMode
::
is_continuing
=
true
;
bool
ReplayMode
::
is_closing
=
false
;
bool
ReplayMode
::
is_closing
=
false
;
...
@@ -175,6 +175,7 @@ bool ReplayMode::StartDuel() {
...
@@ -175,6 +175,7 @@ bool ReplayMode::StartDuel() {
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
mainGame
->
dInfo
.
lp
[
0
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
0
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
1
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
1
]
=
start_lp
;
mainGame
->
dInfo
.
start_lp
=
start_lp
;
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
mainGame
->
dInfo
.
turn
=
0
;
mainGame
->
dInfo
.
turn
=
0
;
...
@@ -943,7 +944,7 @@ void ReplayMode::ReplayReload() {
...
@@ -943,7 +944,7 @@ void ReplayMode::ReplayReload() {
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
}
int
ReplayMode
::
MessageHandler
(
long
fduel
,
int
type
)
{
int
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
return
0
;
return
0
;
char
msgbuf
[
1024
];
char
msgbuf
[
1024
];
...
...
gframe/replay_mode.h
View file @
e1d52185
...
@@ -11,7 +11,7 @@ namespace ygo {
...
@@ -11,7 +11,7 @@ namespace ygo {
class
ReplayMode
{
class
ReplayMode
{
private:
private:
static
long
pduel
;
static
intptr_t
pduel
;
static
bool
is_continuing
;
static
bool
is_continuing
;
static
bool
is_closing
;
static
bool
is_closing
;
static
bool
is_pausing
;
static
bool
is_pausing
;
...
@@ -47,7 +47,7 @@ public:
...
@@ -47,7 +47,7 @@ public:
static
void
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
ReplayReload
();
static
void
ReplayReload
();
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
};
};
}
}
...
...
gframe/single_duel.cpp
View file @
e1d52185
...
@@ -484,6 +484,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -484,6 +484,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
RefreshExtra
(
0
);
RefreshExtra
(
0
);
RefreshExtra
(
1
);
RefreshExtra
(
1
);
start_duel
(
pduel
,
opt
);
start_duel
(
pduel
,
opt
);
if
(
host_info
.
time_limit
)
{
time_elapsed
=
0
;
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
}
Process
();
Process
();
}
}
void
SingleDuel
::
Process
()
{
void
SingleDuel
::
Process
()
{
...
@@ -1410,7 +1415,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
...
@@ -1410,7 +1415,7 @@ void SingleDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
if
(
time_limit
[
dp
->
type
]
>=
time_elapsed
)
if
(
time_limit
[
dp
->
type
]
>=
time_elapsed
)
time_limit
[
dp
->
type
]
-=
time_elapsed
;
time_limit
[
dp
->
type
]
-=
time_elapsed
;
else
time_limit
[
dp
->
type
]
=
0
;
else
time_limit
[
dp
->
type
]
=
0
;
event_del
(
etimer
)
;
time_elapsed
=
0
;
}
}
Process
();
Process
();
}
}
...
@@ -1427,6 +1432,7 @@ void SingleDuel::EndDuel() {
...
@@ -1427,6 +1432,7 @@ void SingleDuel::EndDuel() {
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
end_duel
(
pduel
);
end_duel
(
pduel
);
event_del
(
etimer
);
pduel
=
0
;
pduel
=
0
;
}
}
void
SingleDuel
::
WaitforResponse
(
int
playerid
)
{
void
SingleDuel
::
WaitforResponse
(
int
playerid
)
{
...
@@ -1449,9 +1455,8 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
...
@@ -1449,9 +1455,8 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
if
(
dp
->
type
!=
last_response
)
if
(
dp
->
type
!=
last_response
)
return
;
return
;
players
[
last_response
]
->
state
=
CTOS_RESPONSE
;
players
[
last_response
]
->
state
=
CTOS_RESPONSE
;
time_elapsed
=
0
;
if
(
time_elapsed
<
10
)
timeval
timeout
=
{
1
,
0
};
time_elapsed
=
0
;
event_add
(
etimer
,
&
timeout
);
}
}
void
SingleDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
void
SingleDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
char
query_buffer
[
0x2000
];
char
query_buffer
[
0x2000
];
...
@@ -1560,7 +1565,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
...
@@ -1560,7 +1565,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
}
}
int
SingleDuel
::
MessageHandler
(
long
fduel
,
int
type
)
{
int
SingleDuel
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
return
0
;
return
0
;
char
msgbuf
[
1024
];
char
msgbuf
[
1024
];
...
@@ -1571,7 +1576,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
...
@@ -1571,7 +1576,7 @@ int SingleDuel::MessageHandler(long fduel, int type) {
void
SingleDuel
::
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
void
SingleDuel
::
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
SingleDuel
*
sd
=
static_cast
<
SingleDuel
*>
(
arg
);
SingleDuel
*
sd
=
static_cast
<
SingleDuel
*>
(
arg
);
sd
->
time_elapsed
++
;
sd
->
time_elapsed
++
;
if
(
sd
->
time_elapsed
>=
sd
->
time_limit
[
sd
->
last_response
])
{
if
(
sd
->
time_elapsed
>=
sd
->
time_limit
[
sd
->
last_response
]
||
sd
->
time_limit
[
sd
->
last_response
]
<=
0
)
{
unsigned
char
wbuf
[
3
];
unsigned
char
wbuf
[
3
];
uint32
player
=
sd
->
last_response
;
uint32
player
=
sd
->
last_response
;
wbuf
[
0
]
=
MSG_WIN
;
wbuf
[
0
]
=
MSG_WIN
;
...
@@ -1591,7 +1596,10 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
...
@@ -1591,7 +1596,10 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
sd
->
EndDuel
();
sd
->
EndDuel
();
sd
->
DuelEndProc
();
sd
->
DuelEndProc
();
event_del
(
sd
->
etimer
);
event_del
(
sd
->
etimer
);
return
;
}
}
timeval
timeout
=
{
1
,
0
};
event_add
(
sd
->
etimer
,
&
timeout
);
}
}
}
}
gframe/single_duel.h
View file @
e1d52185
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
protected:
protected:
...
@@ -56,8 +56,8 @@ protected:
...
@@ -56,8 +56,8 @@ protected:
unsigned
char
duel_count
;
unsigned
char
duel_count
;
unsigned
char
tp_player
;
unsigned
char
tp_player
;
unsigned
char
match_result
[
3
];
unsigned
char
match_result
[
3
];
unsigned
short
time_limit
[
2
];
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
short
time_elapsed
;
};
};
}
}
...
...
gframe/single_mode.cpp
View file @
e1d52185
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
namespace
ygo
{
namespace
ygo
{
long
SingleMode
::
pduel
=
0
;
intptr_t
SingleMode
::
pduel
=
0
;
bool
SingleMode
::
is_closing
=
false
;
bool
SingleMode
::
is_closing
=
false
;
bool
SingleMode
::
is_continuing
=
false
;
bool
SingleMode
::
is_continuing
=
false
;
Replay
SingleMode
::
last_replay
;
Replay
SingleMode
::
last_replay
;
...
@@ -44,6 +44,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -44,6 +44,7 @@ int SingleMode::SinglePlayThread() {
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
mainGame
->
dInfo
.
lp
[
0
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
0
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
1
]
=
start_lp
;
mainGame
->
dInfo
.
lp
[
1
]
=
start_lp
;
mainGame
->
dInfo
.
start_lp
=
start_lp
;
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebNickName
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
...
@@ -843,7 +844,7 @@ void SingleMode::SinglePlayReload() {
...
@@ -843,7 +844,7 @@ void SingleMode::SinglePlayReload() {
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
}
int
SingleMode
::
MessageHandler
(
long
fduel
,
int
type
)
{
int
SingleMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
return
0
;
return
0
;
char
msgbuf
[
1024
];
char
msgbuf
[
1024
];
...
...
gframe/single_mode.h
View file @
e1d52185
...
@@ -7,7 +7,7 @@ namespace ygo {
...
@@ -7,7 +7,7 @@ namespace ygo {
class
SingleMode
{
class
SingleMode
{
private:
private:
static
long
pduel
;
static
intptr_t
pduel
;
static
bool
is_closing
;
static
bool
is_closing
;
static
bool
is_continuing
;
static
bool
is_continuing
;
...
@@ -26,7 +26,7 @@ public:
...
@@ -26,7 +26,7 @@ public:
static
void
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
SinglePlayReload
();
static
void
SinglePlayReload
();
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
protected:
protected:
static
Replay
last_replay
;
static
Replay
last_replay
;
...
...
gframe/tag_duel.cpp
View file @
e1d52185
...
@@ -480,6 +480,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -480,6 +480,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
RefreshExtra
(
0
);
RefreshExtra
(
0
);
RefreshExtra
(
1
);
RefreshExtra
(
1
);
start_duel
(
pduel
,
opt
);
start_duel
(
pduel
,
opt
);
if
(
host_info
.
time_limit
)
{
time_elapsed
=
0
;
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
}
Process
();
Process
();
}
}
void
TagDuel
::
Process
()
{
void
TagDuel
::
Process
()
{
...
@@ -1491,7 +1496,7 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
...
@@ -1491,7 +1496,7 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
if
(
time_limit
[
resp_type
]
>=
time_elapsed
)
if
(
time_limit
[
resp_type
]
>=
time_elapsed
)
time_limit
[
resp_type
]
-=
time_elapsed
;
time_limit
[
resp_type
]
-=
time_elapsed
;
else
time_limit
[
resp_type
]
=
0
;
else
time_limit
[
resp_type
]
=
0
;
event_del
(
etimer
)
;
time_elapsed
=
0
;
}
}
Process
();
Process
();
}
}
...
@@ -1510,6 +1515,7 @@ void TagDuel::EndDuel() {
...
@@ -1510,6 +1515,7 @@ void TagDuel::EndDuel() {
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
end_duel
(
pduel
);
end_duel
(
pduel
);
event_del
(
etimer
);
pduel
=
0
;
pduel
=
0
;
}
}
void
TagDuel
::
WaitforResponse
(
int
playerid
)
{
void
TagDuel
::
WaitforResponse
(
int
playerid
)
{
...
@@ -1536,9 +1542,8 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
...
@@ -1536,9 +1542,8 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
if
(
dp
!=
cur_player
[
last_response
])
if
(
dp
!=
cur_player
[
last_response
])
return
;
return
;
cur_player
[
last_response
]
->
state
=
CTOS_RESPONSE
;
cur_player
[
last_response
]
->
state
=
CTOS_RESPONSE
;
time_elapsed
=
0
;
if
(
time_elapsed
<
10
)
timeval
timeout
=
{
1
,
0
};
time_elapsed
=
0
;
event_add
(
etimer
,
&
timeout
);
}
}
void
TagDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
void
TagDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
char
query_buffer
[
0x4000
];
char
query_buffer
[
0x4000
];
...
@@ -1676,7 +1681,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
...
@@ -1676,7 +1681,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
}
}
}
}
}
}
int
TagDuel
::
MessageHandler
(
long
fduel
,
int
type
)
{
int
TagDuel
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
if
(
!
enable_log
)
if
(
!
enable_log
)
return
0
;
return
0
;
char
msgbuf
[
1024
];
char
msgbuf
[
1024
];
...
@@ -1687,7 +1692,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
...
@@ -1687,7 +1692,7 @@ int TagDuel::MessageHandler(long fduel, int type) {
void
TagDuel
::
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
void
TagDuel
::
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
TagDuel
*
sd
=
static_cast
<
TagDuel
*>
(
arg
);
TagDuel
*
sd
=
static_cast
<
TagDuel
*>
(
arg
);
sd
->
time_elapsed
++
;
sd
->
time_elapsed
++
;
if
(
sd
->
time_elapsed
>=
sd
->
time_limit
[
sd
->
last_response
])
{
if
(
sd
->
time_elapsed
>=
sd
->
time_limit
[
sd
->
last_response
]
||
sd
->
time_limit
[
sd
->
last_response
]
<=
0
)
{
unsigned
char
wbuf
[
3
];
unsigned
char
wbuf
[
3
];
uint32
player
=
sd
->
last_response
;
uint32
player
=
sd
->
last_response
;
wbuf
[
0
]
=
MSG_WIN
;
wbuf
[
0
]
=
MSG_WIN
;
...
@@ -1700,7 +1705,10 @@ void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
...
@@ -1700,7 +1705,10 @@ void TagDuel::TagTimer(evutil_socket_t fd, short events, void* arg) {
sd
->
EndDuel
();
sd
->
EndDuel
();
sd
->
DuelEndProc
();
sd
->
DuelEndProc
();
event_del
(
sd
->
etimer
);
event_del
(
sd
->
etimer
);
return
;
}
}
timeval
timeout
=
{
1
,
0
};
event_add
(
sd
->
etimer
,
&
timeout
);
}
}
}
}
gframe/tag_duel.h
View file @
e1d52185
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
protected:
protected:
...
@@ -53,8 +53,8 @@ protected:
...
@@ -53,8 +53,8 @@ protected:
unsigned
char
last_response
;
unsigned
char
last_response
;
Replay
last_replay
;
Replay
last_replay
;
unsigned
char
turn_count
;
unsigned
char
turn_count
;
unsigned
short
time_limit
[
2
];
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
short
time_elapsed
;
};
};
}
}
...
...
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