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
fd79494c
Commit
fd79494c
authored
Aug 30, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'time-incr' into time-incr-koishi
parents
02006f16
1b3cbe32
Pipeline
#16278
passed with stages
in 2 minutes and 59 seconds
Changes
8
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
9 deletions
+63
-9
gframe/netserver.cpp
gframe/netserver.cpp
+21
-0
gframe/netserver.h
gframe/netserver.h
+1
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+16
-1
gframe/single_duel.h
gframe/single_duel.h
+5
-3
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+13
-1
gframe/tag_duel.h
gframe/tag_duel.h
+5
-3
premake5.lua
premake5.lua
+1
-1
strings.conf
strings.conf
+1
-0
No files found.
gframe/netserver.cpp
View file @
fd79494c
...
...
@@ -59,6 +59,27 @@ void NetServer::InitTestCard(int code) {
test_duel
->
TestCard
(
code
);
}
bool
NetServer
::
IsCanIncreaseTime
(
unsigned
short
gameMsg
,
void
*
pdata
,
unsigned
int
len
)
{
int32
*
ivalue
=
(
int32
*
)
pdata
;
switch
(
gameMsg
)
{
case
MSG_RETRY
:
case
MSG_SELECT_UNSELECT_CARD
:
return
false
;
case
MSG_SELECT_CHAIN
:
return
ivalue
[
0
]
!=
-
1
;
case
MSG_SELECT_IDLECMD
:
{
int32
idleChoice
=
ivalue
[
0
]
&
0xffff
;
return
idleChoice
<=
5
;
// no shuffle hand, enter other phases
}
case
MSG_SELECT_BATTLECMD
:
{
int32
battleChoice
=
ivalue
[
0
]
&
0xffff
;
return
battleChoice
<=
1
;
// attack only
}
default:
return
true
;
}
}
unsigned
short
NetServer
::
StartServer
(
unsigned
short
port
)
{
#else
bool
NetServer
::
StartServer
(
unsigned
short
port
)
{
...
...
gframe/netserver.h
View file @
fd79494c
...
...
@@ -30,6 +30,7 @@ public:
static
void
InitDuel
();
static
void
InitTestCard
(
int
code
);
static
unsigned
short
StartServer
(
unsigned
short
port
);
static
bool
IsCanIncreaseTime
(
unsigned
short
gameMsg
,
void
*
pdata
,
unsigned
int
len
);
#else
static
bool
StartServer
(
unsigned
short
port
);
#endif //YGOPRO_SERVER_MODE
...
...
gframe/single_duel.cpp
View file @
fd79494c
...
...
@@ -628,6 +628,9 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
time_backed
[
0
]
=
host_info
.
time_limit
;
time_backed
[
1
]
=
host_info
.
time_limit
;
last_game_msg
=
0
;
#endif
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
...
...
@@ -742,6 +745,9 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
while
(
pbuf
-
msgbuffer
<
(
int
)
len
)
{
offset
=
pbuf
;
unsigned
char
engType
=
BufferIO
::
ReadUInt8
(
pbuf
);
#ifdef YGOPRO_SERVER_MODE
last_game_msg
=
engType
;
#endif
switch
(
engType
)
{
case
MSG_RESET_TIME
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -1159,6 +1165,8 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
time_backed
[
0
]
=
host_info
.
time_limit
;
time_backed
[
1
]
=
host_info
.
time_limit
;
#endif
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1785,6 +1793,13 @@ void SingleDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
time_limit
[
dp
->
type
]
-=
time_elapsed
;
else
time_limit
[
dp
->
type
]
=
0
;
time_elapsed
=
0
;
#ifdef YGOPRO_SERVER_MODE
if
(
time_backed
[
dp
->
type
]
>
0
&&
time_limit
[
dp
->
type
]
<
host_info
.
time_limit
&&
NetServer
::
IsCanIncreaseTime
(
last_game_msg
,
pdata
,
len
))
{
++
time_limit
[
dp
->
type
];
++
time_compensator
[
dp
->
type
];
--
time_backed
[
dp
->
type
];
}
#endif
}
Process
();
}
...
...
@@ -2195,7 +2210,7 @@ int SingleDuel::MessageHandler(intptr_t fduel, int type) {
void
SingleDuel
::
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
SingleDuel
*
sd
=
static_cast
<
SingleDuel
*>
(
arg
);
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
];
uint32
player
=
sd
->
last_response
;
wbuf
[
0
]
=
MSG_WIN
;
...
...
gframe/single_duel.h
View file @
fd79494c
...
...
@@ -77,10 +77,12 @@ protected:
unsigned
char
duel_count
;
unsigned
char
tp_player
;
unsigned
char
match_result
[
3
];
unsigned
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
short
time_limit
[
2
];
short
time_elapsed
;
#ifdef YGOPRO_SERVER_MODE
unsigned
short
time_compensator
[
2
];
short
time_compensator
[
2
];
short
time_backed
[
2
];
unsigned
char
last_game_msg
;
#endif
};
...
...
gframe/tag_duel.cpp
View file @
fd79494c
...
...
@@ -627,6 +627,9 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
time_backed
[
0
]
=
host_info
.
time_limit
;
time_backed
[
1
]
=
host_info
.
time_limit
;
last_game_msg
=
0
;
#endif
timeval
timeout
=
{
1
,
0
};
event_add
(
etimer
,
&
timeout
);
...
...
@@ -1117,6 +1120,8 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE
time_compensator
[
0
]
=
host_info
.
time_limit
;
time_compensator
[
1
]
=
host_info
.
time_limit
;
time_backed
[
0
]
=
host_info
.
time_limit
;
time_backed
[
1
]
=
host_info
.
time_limit
;
#endif
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
...
...
@@ -1874,6 +1879,13 @@ void TagDuel::GetResponse(DuelPlayer* dp, void* pdata, unsigned int len) {
time_limit
[
resp_type
]
-=
time_elapsed
;
else
time_limit
[
resp_type
]
=
0
;
time_elapsed
=
0
;
#ifdef YGOPRO_SERVER_MODE
if
(
time_backed
[
resp_type
]
>
0
&&
time_limit
[
resp_type
]
<
host_info
.
time_limit
&&
NetServer
::
IsCanIncreaseTime
(
last_game_msg
,
pdata
,
len
))
{
++
time_limit
[
resp_type
];
++
time_compensator
[
resp_type
];
--
time_backed
[
resp_type
];
}
#endif
}
Process
();
}
...
...
@@ -2346,7 +2358,7 @@ int TagDuel::MessageHandler(intptr_t fduel, int type) {
void
TagDuel
::
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
)
{
TagDuel
*
sd
=
static_cast
<
TagDuel
*>
(
arg
);
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
];
uint32
player
=
sd
->
last_response
;
wbuf
[
0
]
=
MSG_WIN
;
...
...
gframe/tag_duel.h
View file @
fd79494c
...
...
@@ -71,10 +71,12 @@ protected:
unsigned
char
last_response
;
Replay
last_replay
;
unsigned
char
turn_count
;
unsigned
short
time_limit
[
2
];
unsigned
short
time_elapsed
;
short
time_limit
[
2
];
short
time_elapsed
;
#ifdef YGOPRO_SERVER_MODE
unsigned
short
time_compensator
[
2
];
short
time_compensator
[
2
];
short
time_backed
[
2
];
unsigned
char
last_game_msg
;
#endif
};
...
...
premake5.lua
View file @
fd79494c
...
...
@@ -311,6 +311,6 @@ end
if
BUILD_SQLITE
then
include
"sqlite3"
end
if
BUILD_IKPMP3
then
if
BUILD_IKPMP3
and
not
SERVER_MODE
then
include
"ikpmp3"
end
strings.conf
View file @
fd79494c
...
...
@@ -1163,3 +1163,4 @@
!
setname
0
x187
桥梁 架け橋
!
setname
0
x188
深渊之兽 ビーステッド
!
setname
0
x189
俱舍怒威族 クシャトリラ
!
setname
0
x18a
魊影
Ghoti
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