Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
0e71945b
Commit
0e71945b
authored
Nov 18, 2017
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load_beta
parent
2ad74955
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
4 deletions
+41
-4
gframe/game.cpp
gframe/game.cpp
+33
-1
gframe/game.h
gframe/game.h
+1
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+7
-3
No files found.
gframe/game.cpp
View file @
0e71945b
...
@@ -34,8 +34,8 @@ HostInfo game_info;
...
@@ -34,8 +34,8 @@ HostInfo game_info;
void
Game
::
MainServerLoop
()
{
void
Game
::
MainServerLoop
()
{
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
LoadExpansionDB
();
LoadExpansionDB
();
LoadBetaDB
();
dataManager
.
LoadDB
(
"cards.cdb"
);
dataManager
.
LoadDB
(
"cards.cdb"
);
aServerPort
=
NetServer
::
StartServer
(
aServerPort
);
aServerPort
=
NetServer
::
StartServer
(
aServerPort
);
NetServer
::
InitDuel
();
NetServer
::
InitDuel
();
printf
(
"%u
\n
"
,
aServerPort
);
printf
(
"%u
\n
"
,
aServerPort
);
...
@@ -49,6 +49,38 @@ void Game::MainServerLoop() {
...
@@ -49,6 +49,38 @@ void Game::MainServerLoop() {
#endif
#endif
}
}
}
}
void
Game
::
LoadBetaDB
()
{
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./beta/*.cdb"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./beta/%s"
,
fname
);
dataManager
.
LoadDB
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./beta/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".cdb"
)
!=
0
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./beta/%s"
,
dirp
->
d_name
);
dataManager
.
LoadDB
(
filepath
);
}
closedir
(
dir
);
}
#endif
}
#else //YGOPRO_SERVER_MODE
#else //YGOPRO_SERVER_MODE
bool
Game
::
Initialize
()
{
bool
Game
::
Initialize
()
{
srand
(
time
(
0
));
srand
(
time
(
0
));
...
...
gframe/game.h
View file @
0e71945b
...
@@ -92,6 +92,7 @@ public:
...
@@ -92,6 +92,7 @@ public:
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
void
MainServerLoop
();
void
MainServerLoop
();
void
LoadExpansionDB
();
void
LoadExpansionDB
();
void
LoadBetaDB
();
void
AddDebugMsg
(
char
*
msgbuf
);
void
AddDebugMsg
(
char
*
msgbuf
);
#else
#else
void
MainLoop
();
void
MainLoop
();
...
...
ocgcore/interpreter.cpp
View file @
0e71945b
...
@@ -748,11 +748,15 @@ int32 interpreter::load_card_script(uint32 code) {
...
@@ -748,11 +748,15 @@ int32 interpreter::load_card_script(uint32 code) {
lua_pushvalue
(
current_state
,
-
2
);
lua_pushvalue
(
current_state
,
-
2
);
lua_rawset
(
current_state
,
-
3
);
lua_rawset
(
current_state
,
-
3
);
//load extra scripts
//load extra scripts
sprintf
(
script_name
,
"./expansions/script/c%d.lua"
,
code
);
sprintf
(
script_name
,
"./beta/script/c%d.lua"
,
code
);
if
(
!
load_script
(
script_name
))
{
if
(
!
load_script
(
script_name
))
{
sprintf
(
script_name
,
"./script/c%d.lua"
,
code
);
sprintf
(
script_name
,
"./
expansions/
script/c%d.lua"
,
code
);
if
(
!
load_script
(
script_name
))
{
if
(
!
load_script
(
script_name
))
{
return
OPERATION_FAIL
;
sprintf
(
script_name
,
"./script/c%d.lua"
,
code
);
if
(
!
load_script
(
script_name
))
{
return
OPERATION_FAIL
;
}
}
}
}
}
}
}
...
...
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