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
44070585
Commit
44070585
authored
May 24, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix time_compensator
parent
50e2fa1a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
8 deletions
+18
-8
gframe/single_duel.cpp
gframe/single_duel.cpp
+8
-3
gframe/single_duel.h
gframe/single_duel.h
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+8
-3
gframe/tag_duel.h
gframe/tag_duel.h
+1
-1
No files found.
gframe/single_duel.cpp
View file @
44070585
...
...
@@ -629,7 +629,8 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
if
(
host_info
.
time_limit
)
{
time_elapsed
=
0
;
#ifdef YGOPRO_SERVER_MODE
time_compensator
=
host_info
.
time_limit
;
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
#endif
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
...
...
@@ -1143,6 +1144,10 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
#endif
time_limit
[
0
]
=
host_info
.
time_limit
;
time_limit
[
1
]
=
host_info
.
time_limit
;
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
#endif
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
...
...
@@ -1880,8 +1885,8 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
return
;
players
[
last_response
]
->
state
=
CTOS_RESPONSE
;
#ifdef YGOPRO_SERVER_MODE
if
(
time_elapsed
<
10
&&
time_elapsed
<=
time_compensator
){
time_compensator
-=
time_elapsed
;
if
(
time_elapsed
<
10
&&
time_elapsed
<=
time_compensator
[
dp
->
type
]
){
time_compensator
[
dp
->
type
]
-=
time_elapsed
;
time_elapsed
=
0
;
}
#else
...
...
gframe/single_duel.h
View file @
44070585
...
...
@@ -77,7 +77,7 @@ protected:
unsigned
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
#ifdef YGOPRO_SERVER_MODE
unsigned
short
time_compensator
;
unsigned
short
time_compensator
[
2
]
;
#endif
};
...
...
gframe/tag_duel.cpp
View file @
44070585
...
...
@@ -634,7 +634,8 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
if
(
host_info
.
time_limit
)
{
time_elapsed
=
0
;
#ifdef YGOPRO_SERVER_MODE
time_compensator
=
host_info
.
time_limit
;
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
#endif
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
...
...
@@ -1087,6 +1088,10 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
#endif
time_limit
[
0
]
=
host_info
.
time_limit
;
time_limit
[
1
]
=
host_info
.
time_limit
;
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
#endif
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
...
...
@@ -1959,8 +1964,8 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
return
;
cur_player
[
last_response
]
->
state
=
CTOS_RESPONSE
;
#ifdef YGOPRO_SERVER_MODE
if
(
time_elapsed
<
10
&&
time_elapsed
<=
time_compensator
){
time_compensator
-=
time_elapsed
;
if
(
time_elapsed
<
10
&&
time_elapsed
<=
time_compensator
[
dp
->
type
]
){
time_compensator
[
dp
->
type
]
-=
time_elapsed
;
time_elapsed
=
0
;
}
#else
...
...
gframe/tag_duel.h
View file @
44070585
...
...
@@ -74,7 +74,7 @@ protected:
unsigned
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
#ifdef YGOPRO_SERVER_MODE
unsigned
short
time_compensator
;
unsigned
short
time_compensator
[
2
]
;
#endif
};
...
...
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