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
771bd5d3
Commit
771bd5d3
authored
Dec 26, 2023
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "match_result use player_id"
This reverts commit
c4d7ca2d
.
parent
f7952c61
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
14 deletions
+33
-14
gframe/single_duel.cpp
gframe/single_duel.cpp
+32
-14
gframe/single_duel.h
gframe/single_duel.h
+1
-0
No files found.
gframe/single_duel.cpp
View file @
771bd5d3
...
@@ -340,8 +340,6 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
...
@@ -340,8 +340,6 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
hand_result
[
1
]
=
0
;
hand_result
[
1
]
=
0
;
players
[
0
]
->
state
=
CTOS_HAND_RESULT
;
players
[
0
]
->
state
=
CTOS_HAND_RESULT
;
players
[
1
]
->
state
=
CTOS_HAND_RESULT
;
players
[
1
]
->
state
=
CTOS_HAND_RESULT
;
players
[
0
]
->
player_id
=
0
;
players
[
1
]
->
player_id
=
1
;
duel_stage
=
DUEL_STAGE_FINGER
;
duel_stage
=
DUEL_STAGE_FINGER
;
}
}
void
SingleDuel
::
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{
void
SingleDuel
::
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{
...
@@ -389,6 +387,8 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -389,6 +387,8 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
return
;
return
;
duel_stage
=
DUEL_STAGE_DUELING
;
duel_stage
=
DUEL_STAGE_DUELING
;
bool
swapped
=
false
;
bool
swapped
=
false
;
pplayer
[
0
]
=
players
[
0
];
pplayer
[
1
]
=
players
[
1
];
if
((
tp
&&
dp
->
type
==
1
)
||
(
!
tp
&&
dp
->
type
==
0
))
{
if
((
tp
&&
dp
->
type
==
1
)
||
(
!
tp
&&
dp
->
type
==
0
))
{
DuelPlayer
*
p
=
players
[
0
];
DuelPlayer
*
p
=
players
[
0
];
players
[
0
]
=
players
[
1
];
players
[
0
]
=
players
[
1
];
...
@@ -529,6 +529,15 @@ void SingleDuel::DuelEndProc() {
...
@@ -529,6 +529,15 @@ void SingleDuel::DuelEndProc() {
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
duel_stage
=
DUEL_STAGE_END
;
duel_stage
=
DUEL_STAGE_END
;
}
else
{
}
else
{
if
(
players
[
0
]
!=
pplayer
[
0
])
{
players
[
0
]
=
pplayer
[
0
];
players
[
1
]
=
pplayer
[
1
];
players
[
0
]
->
type
=
0
;
players
[
1
]
->
type
=
1
;
Deck
d
=
pdeck
[
0
];
pdeck
[
0
]
=
pdeck
[
1
];
pdeck
[
1
]
=
d
;
}
ready
[
0
]
=
false
;
ready
[
0
]
=
false
;
ready
[
1
]
=
false
;
ready
[
1
]
=
false
;
players
[
0
]
->
state
=
CTOS_UPDATE_DECK
;
players
[
0
]
->
state
=
CTOS_UPDATE_DECK
;
...
@@ -542,7 +551,7 @@ void SingleDuel::DuelEndProc() {
...
@@ -542,7 +551,7 @@ void SingleDuel::DuelEndProc() {
}
}
}
}
void
SingleDuel
::
Surrender
(
DuelPlayer
*
dp
)
{
void
SingleDuel
::
Surrender
(
DuelPlayer
*
dp
)
{
if
(
dp
->
type
>
1
||
dp
->
player_id
>
1
||
!
pduel
)
if
(
dp
->
type
>
1
||
!
pduel
)
return
;
return
;
unsigned
char
wbuf
[
3
];
unsigned
char
wbuf
[
3
];
uint32
player
=
dp
->
type
;
uint32
player
=
dp
->
type
;
...
@@ -553,9 +562,13 @@ void SingleDuel::Surrender(DuelPlayer* dp) {
...
@@ -553,9 +562,13 @@ void SingleDuel::Surrender(DuelPlayer* dp) {
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
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
match_result
[
duel_count
]
=
1
-
dp
->
player_id
;
if
(
players
[
player
]
==
pplayer
[
player
])
{
++
duel_count
;
match_result
[
duel_count
++
]
=
1
-
player
;
tp_player
=
player
;
tp_player
=
player
;
}
else
{
match_result
[
duel_count
++
]
=
player
;
tp_player
=
1
-
player
;
}
EndDuel
();
EndDuel
();
DuelEndProc
();
DuelEndProc
();
event_del
(
etimer
);
event_del
(
etimer
);
...
@@ -614,14 +627,15 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
...
@@ -614,14 +627,15 @@ int SingleDuel::Analyze(unsigned char* msgbuffer, unsigned int len) {
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
if
(
player
>
1
)
{
if
(
player
>
1
)
{
match_result
[
duel_count
]
=
2
;
match_result
[
duel_count
++
]
=
2
;
tp_player
=
1
-
tp_player
;
tp_player
=
1
-
tp_player
;
}
}
else
if
(
players
[
player
]
==
pplayer
[
player
])
{
else
{
match_result
[
duel_count
++
]
=
player
;
match_result
[
duel_count
]
=
players
[
player
]
->
player_id
;
tp_player
=
1
-
player
;
tp_player
=
1
-
player
;
}
else
{
match_result
[
duel_count
++
]
=
1
-
player
;
tp_player
=
player
;
}
}
++
duel_count
;
EndDuel
();
EndDuel
();
return
2
;
return
2
;
}
}
...
@@ -1580,9 +1594,13 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
...
@@ -1580,9 +1594,13 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
NetServer
::
ReSendToPlayer
(
sd
->
players
[
1
]);
NetServer
::
ReSendToPlayer
(
sd
->
players
[
1
]);
for
(
auto
oit
=
sd
->
observers
.
begin
();
oit
!=
sd
->
observers
.
end
();
++
oit
)
for
(
auto
oit
=
sd
->
observers
.
begin
();
oit
!=
sd
->
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
NetServer
::
ReSendToPlayer
(
*
oit
);
sd
->
match_result
[
sd
->
duel_count
]
=
sd
->
players
[
1
-
player
]
->
player_id
;
if
(
sd
->
players
[
player
]
==
sd
->
pplayer
[
player
])
{
++
sd
->
duel_count
;
sd
->
match_result
[
sd
->
duel_count
++
]
=
1
-
player
;
sd
->
tp_player
=
player
;
sd
->
tp_player
=
player
;
}
else
{
sd
->
match_result
[
sd
->
duel_count
++
]
=
player
;
sd
->
tp_player
=
1
-
player
;
}
sd
->
EndDuel
();
sd
->
EndDuel
();
sd
->
DuelEndProc
();
sd
->
DuelEndProc
();
event_del
(
sd
->
etimer
);
event_del
(
sd
->
etimer
);
...
...
gframe/single_duel.h
View file @
771bd5d3
...
@@ -46,6 +46,7 @@ private:
...
@@ -46,6 +46,7 @@ private:
protected:
protected:
DuelPlayer
*
players
[
2
]{
nullptr
};
DuelPlayer
*
players
[
2
]{
nullptr
};
DuelPlayer
*
pplayer
[
2
]{
nullptr
};
bool
ready
[
2
]{
false
};
bool
ready
[
2
]{
false
};
Deck
pdeck
[
2
];
Deck
pdeck
[
2
];
int
deck_error
[
2
]{
0
};
int
deck_error
[
2
]{
0
};
...
...
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