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
MobiusMei
ygopro
Commits
4e324d60
Commit
4e324d60
authored
Jul 24, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix player quit when finger-guessing
parent
c4222113
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
gframe/single_duel.cpp
gframe/single_duel.cpp
+5
-3
gframe/single_duel.h
gframe/single_duel.h
+1
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+4
-2
gframe/tag_duel.h
gframe/tag_duel.h
+1
-0
No files found.
gframe/single_duel.cpp
View file @
4e324d60
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
namespace
ygo
{
namespace
ygo
{
SingleDuel
::
SingleDuel
(
bool
is_match
)
{
SingleDuel
::
SingleDuel
(
bool
is_match
)
{
game_started
=
false
;
match_mode
=
is_match
;
match_mode
=
is_match
;
match_kill
=
0
;
match_kill
=
0
;
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
...
@@ -145,7 +146,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
...
@@ -145,7 +146,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
NetServer
::
StopServer
();
NetServer
::
StopServer
();
}
else
if
(
dp
->
type
==
NETPLAYER_TYPE_OBSERVER
)
{
}
else
if
(
dp
->
type
==
NETPLAYER_TYPE_OBSERVER
)
{
observers
.
erase
(
dp
);
observers
.
erase
(
dp
);
if
(
!
pduel
)
{
if
(
!
game_started
)
{
STOC_HS_WatchChange
scwc
;
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
observers
.
size
();
scwc
.
watch_count
=
observers
.
size
();
if
(
players
[
0
])
if
(
players
[
0
])
...
@@ -157,7 +158,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
...
@@ -157,7 +158,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
}
}
NetServer
::
DisconnectPlayer
(
dp
);
NetServer
::
DisconnectPlayer
(
dp
);
}
else
{
}
else
{
if
(
!
pduel
&&
duel_count
==
0
)
{
if
(
!
game_started
&&
duel_count
==
0
)
{
STOC_HS_PlayerChange
scpc
;
STOC_HS_PlayerChange
scpc
;
players
[
dp
->
type
]
=
0
;
players
[
dp
->
type
]
=
0
;
ready
[
dp
->
type
]
=
false
;
ready
[
dp
->
type
]
=
false
;
...
@@ -170,7 +171,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
...
@@ -170,7 +171,7 @@ void SingleDuel::LeaveGame(DuelPlayer* dp) {
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
NetServer
::
SendPacketToPlayer
(
*
pit
,
STOC_HS_PLAYER_CHANGE
,
scpc
);
NetServer
::
DisconnectPlayer
(
dp
);
NetServer
::
DisconnectPlayer
(
dp
);
}
else
{
}
else
{
if
(
!
pduel
)
{
if
(
!
game_started
)
{
if
(
!
ready
[
0
])
if
(
!
ready
[
0
])
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_DUEL_START
);
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_DUEL_START
);
if
(
!
ready
[
1
])
if
(
!
ready
[
1
])
...
@@ -310,6 +311,7 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
...
@@ -310,6 +311,7 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
return
;
return
;
NetServer
::
StopListen
();
NetServer
::
StopListen
();
//NetServer::StopBroadcast();
//NetServer::StopBroadcast();
game_started
=
true
;
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_DUEL_START
);
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_DUEL_START
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
{
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
{
...
...
gframe/single_duel.h
View file @
4e324d60
...
@@ -52,6 +52,7 @@ protected:
...
@@ -52,6 +52,7 @@ protected:
Replay
last_replay
;
Replay
last_replay
;
bool
match_mode
;
bool
match_mode
;
int
match_kill
;
int
match_kill
;
bool
game_started
;
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
];
...
...
gframe/tag_duel.cpp
View file @
4e324d60
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
namespace
ygo
{
namespace
ygo
{
TagDuel
::
TagDuel
()
{
TagDuel
::
TagDuel
()
{
game_started
=
false
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
players
[
i
]
=
0
;
players
[
i
]
=
0
;
ready
[
i
]
=
false
;
ready
[
i
]
=
false
;
...
@@ -119,7 +120,7 @@ void TagDuel::LeaveGame(DuelPlayer* dp) {
...
@@ -119,7 +120,7 @@ void TagDuel::LeaveGame(DuelPlayer* dp) {
NetServer
::
StopServer
();
NetServer
::
StopServer
();
}
else
if
(
dp
->
type
==
NETPLAYER_TYPE_OBSERVER
)
{
}
else
if
(
dp
->
type
==
NETPLAYER_TYPE_OBSERVER
)
{
observers
.
erase
(
dp
);
observers
.
erase
(
dp
);
if
(
!
pduel
)
{
if
(
!
game_started
)
{
STOC_HS_WatchChange
scwc
;
STOC_HS_WatchChange
scwc
;
scwc
.
watch_count
=
observers
.
size
();
scwc
.
watch_count
=
observers
.
size
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
...
@@ -130,7 +131,7 @@ void TagDuel::LeaveGame(DuelPlayer* dp) {
...
@@ -130,7 +131,7 @@ void TagDuel::LeaveGame(DuelPlayer* dp) {
}
}
NetServer
::
DisconnectPlayer
(
dp
);
NetServer
::
DisconnectPlayer
(
dp
);
}
else
{
}
else
{
if
(
!
pduel
)
{
if
(
!
game_started
)
{
STOC_HS_PlayerChange
scpc
;
STOC_HS_PlayerChange
scpc
;
players
[
dp
->
type
]
=
0
;
players
[
dp
->
type
]
=
0
;
ready
[
dp
->
type
]
=
false
;
ready
[
dp
->
type
]
=
false
;
...
@@ -263,6 +264,7 @@ void TagDuel::StartDuel(DuelPlayer* dp) {
...
@@ -263,6 +264,7 @@ void TagDuel::StartDuel(DuelPlayer* dp) {
if
(
!
ready
[
0
]
||
!
ready
[
1
]
||
!
ready
[
2
]
||
!
ready
[
3
])
if
(
!
ready
[
0
]
||
!
ready
[
1
]
||
!
ready
[
2
]
||
!
ready
[
3
])
return
;
return
;
NetServer
::
StopListen
();
NetServer
::
StopListen
();
game_started
=
true
;
//NetServer::StopBroadcast();
//NetServer::StopBroadcast();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
NetServer
::
SendPacketToPlayer
(
players
[
i
],
STOC_DUEL_START
);
NetServer
::
SendPacketToPlayer
(
players
[
i
],
STOC_DUEL_START
);
...
...
gframe/tag_duel.h
View file @
4e324d60
...
@@ -51,6 +51,7 @@ protected:
...
@@ -51,6 +51,7 @@ protected:
unsigned
char
hand_result
[
2
];
unsigned
char
hand_result
[
2
];
unsigned
char
last_response
;
unsigned
char
last_response
;
Replay
last_replay
;
Replay
last_replay
;
bool
game_started
;
unsigned
char
turn_count
;
unsigned
char
turn_count
;
unsigned
short
time_limit
[
2
];
unsigned
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
unsigned
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