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
REIKAI
ygopro
Commits
f67834ea
Commit
f67834ea
authored
Aug 09, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
77cea9dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
17 deletions
+26
-17
gframe/data_manager.cpp
gframe/data_manager.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/game.h
gframe/game.h
+1
-1
gframe/gframe.cpp
gframe/gframe.cpp
+1
-1
gframe/netserver.h
gframe/netserver.h
+1
-1
gframe/replay.cpp
gframe/replay.cpp
+19
-10
gframe/single_duel.cpp
gframe/single_duel.cpp
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+1
-1
No files found.
gframe/data_manager.cpp
View file @
f67834ea
...
@@ -16,7 +16,7 @@ bool DataManager::LoadDB(const char* file) {
...
@@ -16,7 +16,7 @@ bool DataManager::LoadDB(const char* file) {
const
char
*
sql
=
"select * from datas"
;
const
char
*
sql
=
"select * from datas"
;
#else
#else
const
char
*
sql
=
"select * from datas,texts where datas.id=texts.id"
;
const
char
*
sql
=
"select * from datas,texts where datas.id=texts.id"
;
#endif
//YGOPRO_SERVER_MODE
#endif
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
0
)
!=
SQLITE_OK
)
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
0
)
!=
SQLITE_OK
)
return
Error
(
pDB
);
return
Error
(
pDB
);
CardDataC
cd
;
CardDataC
cd
;
...
...
gframe/game.cpp
View file @
f67834ea
...
@@ -49,7 +49,7 @@ void Game::MainServerLoop() {
...
@@ -49,7 +49,7 @@ void Game::MainServerLoop() {
#endif
#endif
}
}
}
}
#else
#else
//YGOPRO_SERVER_MODE
bool
Game
::
Initialize
()
{
bool
Game
::
Initialize
()
{
srand
(
time
(
0
));
srand
(
time
(
0
));
LoadConfig
();
LoadConfig
();
...
...
gframe/game.h
View file @
f67834ea
...
@@ -442,7 +442,7 @@ extern Game* mainGame;
...
@@ -442,7 +442,7 @@ extern Game* mainGame;
extern
unsigned
short
aServerPort
;
extern
unsigned
short
aServerPort
;
extern
unsigned
short
replay_mode
;
extern
unsigned
short
replay_mode
;
extern
HostInfo
game_info
;
extern
HostInfo
game_info
;
#endif
//YGOPRO_SERVER_MODE
#endif
}
}
...
...
gframe/gframe.cpp
View file @
f67834ea
...
@@ -99,7 +99,7 @@ int main(int argc, char* argv[]) {
...
@@ -99,7 +99,7 @@ int main(int argc, char* argv[]) {
ygo
::
mainGame
=
&
_game
;
ygo
::
mainGame
=
&
_game
;
ygo
::
mainGame
->
MainServerLoop
();
ygo
::
mainGame
->
MainServerLoop
();
return
0
;
return
0
;
#else
#else
//YGOPRO_SERVER_MODE
ygo
::
mainGame
=
&
_game
;
ygo
::
mainGame
=
&
_game
;
if
(
!
ygo
::
mainGame
->
Initialize
())
if
(
!
ygo
::
mainGame
->
Initialize
())
return
0
;
return
0
;
...
...
gframe/netserver.h
View file @
f67834ea
...
@@ -16,7 +16,7 @@ private:
...
@@ -16,7 +16,7 @@ private:
static
unsigned
short
server_port
;
static
unsigned
short
server_port
;
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
static
event_base
*
net_evbase
;
static
event_base
*
net_evbase
;
#endif
//YGOPRO_SERVER_MODE
#endif
static
event
*
broadcast_ev
;
static
event
*
broadcast_ev
;
static
evconnlistener
*
listener
;
static
evconnlistener
*
listener
;
static
DuelMode
*
duel_mode
;
static
DuelMode
*
duel_mode
;
...
...
gframe/replay.cpp
View file @
f67834ea
...
@@ -6,9 +6,10 @@
...
@@ -6,9 +6,10 @@
namespace
ygo
{
namespace
ygo
{
#ifdef YGOPRO_SERVER_MODE
extern
unsigned
short
aServerPort
;
extern
unsigned
short
aServerPort
;
extern
unsigned
short
replay_mode
;
extern
unsigned
short
replay_mode
;
#endif
Replay
::
Replay
()
{
Replay
::
Replay
()
{
is_recording
=
false
;
is_recording
=
false
;
is_replaying
=
false
;
is_replaying
=
false
;
...
@@ -22,10 +23,11 @@ Replay::~Replay() {
...
@@ -22,10 +23,11 @@ Replay::~Replay() {
void
Replay
::
BeginRecord
()
{
void
Replay
::
BeginRecord
()
{
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
>
0
)
{
if
(
ygo
::
replay_mode
>
0
)
{
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
if
(
is_recording
)
if
(
is_recording
)
CloseHandle
(
recording_fp
);
CloseHandle
(
recording_fp
);
#ifdef YGOPRO_SERVER_MODE
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
wchar_t
tmppath
[
80
];
wchar_t
tmppath
[
80
];
...
@@ -33,11 +35,15 @@ void Replay::BeginRecord() {
...
@@ -33,11 +35,15 @@ void Replay::BeginRecord() {
wchar_t
path
[
80
];
wchar_t
path
[
80
];
myswprintf
(
path
,
tmppath
,
ygo
::
aServerPort
);
myswprintf
(
path
,
tmppath
,
ygo
::
aServerPort
);
recording_fp
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
recording_fp
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
#else
recording_fp
=
CreateFileW
(
L"./replay/_LastReplay.yrp"
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_WRITE_THROUGH
,
NULL
);
#endif //YGOPRO_SERVER_MODE
if
(
recording_fp
==
INVALID_HANDLE_VALUE
)
if
(
recording_fp
==
INVALID_HANDLE_VALUE
)
return
;
return
;
#else
#else
if
(
is_recording
)
if
(
is_recording
)
fclose
(
fp
);
fclose
(
fp
);
#ifdef YGOPRO_SERVER_MODE
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
tmppath
[
40
];
char
tmppath
[
40
];
...
@@ -45,6 +51,9 @@ void Replay::BeginRecord() {
...
@@ -45,6 +51,9 @@ void Replay::BeginRecord() {
char
path
[
40
];
char
path
[
40
];
sprintf
(
path
,
tmppath
,
ygo
::
aServerPort
);
sprintf
(
path
,
tmppath
,
ygo
::
aServerPort
);
fp
=
fopen
(
path
,
"wb"
);
fp
=
fopen
(
path
,
"wb"
);
#else
fp
=
fopen
(
"./replay/_LastReplay.yrp"
,
"wb"
);
#endif //YGOPRO_SERVER_MODE
if
(
!
fp
)
if
(
!
fp
)
return
;
return
;
#endif
#endif
...
@@ -58,7 +67,7 @@ void Replay::WriteHeader(ReplayHeader& header) {
...
@@ -58,7 +67,7 @@ void Replay::WriteHeader(ReplayHeader& header) {
pheader
=
header
;
pheader
=
header
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
NULL
);
WriteFile
(
recording_fp
,
&
header
,
sizeof
(
header
),
&
size
,
NULL
);
...
@@ -74,7 +83,7 @@ void Replay::WriteData(const void* data, unsigned int length, bool flush) {
...
@@ -74,7 +83,7 @@ void Replay::WriteData(const void* data, unsigned int length, bool flush) {
pdata
+=
length
;
pdata
+=
length
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
NULL
);
WriteFile
(
recording_fp
,
data
,
length
,
&
size
,
NULL
);
...
@@ -91,7 +100,7 @@ void Replay::WriteInt32(int data, bool flush) {
...
@@ -91,7 +100,7 @@ void Replay::WriteInt32(int data, bool flush) {
pdata
+=
4
;
pdata
+=
4
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
int
),
&
size
,
NULL
);
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
int
),
&
size
,
NULL
);
...
@@ -108,7 +117,7 @@ void Replay::WriteInt16(short data, bool flush) {
...
@@ -108,7 +117,7 @@ void Replay::WriteInt16(short data, bool flush) {
pdata
+=
2
;
pdata
+=
2
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
short
),
&
size
,
NULL
);
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
short
),
&
size
,
NULL
);
...
@@ -125,7 +134,7 @@ void Replay::WriteInt8(char data, bool flush) {
...
@@ -125,7 +134,7 @@ void Replay::WriteInt8(char data, bool flush) {
pdata
++
;
pdata
++
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
DWORD
size
;
DWORD
size
;
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
char
),
&
size
,
NULL
);
WriteFile
(
recording_fp
,
&
data
,
sizeof
(
char
),
&
size
,
NULL
);
...
@@ -140,7 +149,7 @@ void Replay::Flush() {
...
@@ -140,7 +149,7 @@ void Replay::Flush() {
return
;
return
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
==
0
)
return
;
if
(
ygo
::
replay_mode
==
0
)
return
;
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
#else
#else
fflush
(
fp
);
fflush
(
fp
);
...
@@ -151,7 +160,7 @@ void Replay::EndRecord() {
...
@@ -151,7 +160,7 @@ void Replay::EndRecord() {
return
;
return
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
if
(
ygo
::
replay_mode
>
0
)
{
if
(
ygo
::
replay_mode
>
0
)
{
#endif
//YGOPRO_SERVER_MODE
#endif
#ifdef _WIN32
#ifdef _WIN32
CloseHandle
(
recording_fp
);
CloseHandle
(
recording_fp
);
#else
#else
...
@@ -159,7 +168,7 @@ void Replay::EndRecord() {
...
@@ -159,7 +168,7 @@ void Replay::EndRecord() {
#endif
#endif
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
}
}
#endif
//YGOPRO_SERVER_MODE
#endif
pheader
.
datasize
=
pdata
-
replay_data
;
pheader
.
datasize
=
pdata
-
replay_data
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
pheader
.
flag
|=
REPLAY_COMPRESSED
;
size_t
propsize
=
5
;
size_t
propsize
=
5
;
...
...
gframe/single_duel.cpp
View file @
f67834ea
...
@@ -110,7 +110,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
...
@@ -110,7 +110,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
sctc
.
type
=
NETPLAYER_TYPE_OBSERVER
;
sctc
.
type
=
NETPLAYER_TYPE_OBSERVER
;
}
}
else
else
#endif
//YGOPRO_SERVER_MODE
#endif
if
(
!
players
[
0
]
||
!
players
[
1
])
{
if
(
!
players
[
0
]
||
!
players
[
1
])
{
STOC_HS_PlayerEnter
scpe
;
STOC_HS_PlayerEnter
scpe
;
BufferIO
::
CopyWStr
(
dp
->
name
,
scpe
.
name
,
20
);
BufferIO
::
CopyWStr
(
dp
->
name
,
scpe
.
name
,
20
);
...
...
gframe/tag_duel.cpp
View file @
f67834ea
...
@@ -90,7 +90,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
...
@@ -90,7 +90,7 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
sctc
.
type
=
NETPLAYER_TYPE_OBSERVER
;
sctc
.
type
=
NETPLAYER_TYPE_OBSERVER
;
}
}
else
else
#endif
//YGOPRO_SERVER_MODE
#endif
if
(
!
players
[
0
]
||
!
players
[
1
]
||
!
players
[
2
]
||
!
players
[
3
])
{
if
(
!
players
[
0
]
||
!
players
[
1
]
||
!
players
[
2
]
||
!
players
[
3
])
{
STOC_HS_PlayerEnter
scpe
;
STOC_HS_PlayerEnter
scpe
;
BufferIO
::
CopyWStr
(
dp
->
name
,
scpe
.
name
,
20
);
BufferIO
::
CopyWStr
(
dp
->
name
,
scpe
.
name
,
20
);
...
...
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