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
b180e1c9
Commit
b180e1c9
authored
Dec 12, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tab
parent
bc4422f3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
58 deletions
+57
-58
gframe/client_card.h
gframe/client_card.h
+2
-2
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-2
gframe/game.cpp
gframe/game.cpp
+8
-8
gframe/game.h
gframe/game.h
+6
-6
gframe/gframe.cpp
gframe/gframe.cpp
+4
-4
gframe/netserver.cpp
gframe/netserver.cpp
+5
-5
gframe/replay.cpp
gframe/replay.cpp
+10
-11
gframe/single_duel.cpp
gframe/single_duel.cpp
+10
-10
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+10
-10
No files found.
gframe/client_card.h
View file @
b180e1c9
...
@@ -45,7 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::const_iterator code_pointer
...
@@ -45,7 +45,7 @@ typedef std::unordered_map<unsigned int, CardDataC>::const_iterator code_pointer
class
ClientCard
{
class
ClientCard
{
public:
public:
/*
/*
irr::video::ITexture* curTexture;
irr::video::ITexture* curTexture;
irr::core::matrix4 mTransform;
irr::core::matrix4 mTransform;
irr::core::vector3df curPos;
irr::core::vector3df curPos;
...
@@ -115,7 +115,7 @@ public:
...
@@ -115,7 +115,7 @@ public:
static bool deck_sort_atk(code_pointer l1, code_pointer l2);
static bool deck_sort_atk(code_pointer l1, code_pointer l2);
static bool deck_sort_def(code_pointer l1, code_pointer l2);
static bool deck_sort_def(code_pointer l1, code_pointer l2);
static bool deck_sort_name(code_pointer l1, code_pointer l2);
static bool deck_sort_name(code_pointer l1, code_pointer l2);
*/
*/
};
};
}
}
...
...
gframe/data_manager.cpp
View file @
b180e1c9
...
@@ -40,7 +40,7 @@ bool DataManager::LoadDB(const char* file) {
...
@@ -40,7 +40,7 @@ bool DataManager::LoadDB(const char* file) {
cd
.
category
=
sqlite3_column_int
(
pStmt
,
10
);
cd
.
category
=
sqlite3_column_int
(
pStmt
,
10
);
_datas
.
insert
(
std
::
make_pair
(
cd
.
code
,
cd
));
_datas
.
insert
(
std
::
make_pair
(
cd
.
code
,
cd
));
/*
/*
len = BufferIO::DecodeUTF8((const char*)sqlite3_column_text(pStmt, 12), strBuffer);
len = BufferIO::DecodeUTF8((const char*)sqlite3_column_text(pStmt, 12), strBuffer);
if(len) {
if(len) {
cs.name = new wchar_t[len + 1];
cs.name = new wchar_t[len + 1];
memcpy(cs.name, strBuffer, (len + 1)*sizeof(wchar_t));
memcpy(cs.name, strBuffer, (len + 1)*sizeof(wchar_t));
...
@@ -61,7 +61,7 @@ bool DataManager::LoadDB(const char* file) {
...
@@ -61,7 +61,7 @@ bool DataManager::LoadDB(const char* file) {
} else cs.desc[i - 14] = 0;
} else cs.desc[i - 14] = 0;
}
}
_strings.insert(std::make_pair(cd.code, cs));
_strings.insert(std::make_pair(cd.code, cs));
*/
*/
}
}
}
while
(
step
!=
SQLITE_DONE
);
}
while
(
step
!=
SQLITE_DONE
);
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
...
...
gframe/game.cpp
View file @
b180e1c9
...
@@ -41,7 +41,7 @@ unsigned char draw_count;
...
@@ -41,7 +41,7 @@ unsigned char draw_count;
void
Game
::
MainServerLoop
(
int
bDuel_mode
,
int
lflist
)
{
void
Game
::
MainServerLoop
(
int
bDuel_mode
,
int
lflist
)
{
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
dataManager
.
LoadDB
(
"cards.cdb"
);
dataManager
.
LoadDB
(
"cards.cdb"
);
//load expansions
//load expansions
DIR
*
dir
;
DIR
*
dir
;
...
@@ -61,17 +61,17 @@ void Game::MainServerLoop(int bDuel_mode, int lflist) {
...
@@ -61,17 +61,17 @@ void Game::MainServerLoop(int bDuel_mode, int lflist) {
closedir
(
dir
);
closedir
(
dir
);
}
}
aServerPort
=
NetServer
::
StartServer
(
aServerPort
);
aServerPort
=
NetServer
::
StartServer
(
aServerPort
);
NetServer
::
Initduel
(
bDuel_mode
,
lflist
);
NetServer
::
Initduel
(
bDuel_mode
,
lflist
);
printf
(
"%u
\n
"
,
aServerPort
);
printf
(
"%u
\n
"
,
aServerPort
);
fflush
(
stdout
);
fflush
(
stdout
);
while
(
NetServer
::
net_evbase
)
{
while
(
NetServer
::
net_evbase
)
{
#ifdef WIN32
#ifdef WIN32
Sleep
(
200
);
Sleep
(
200
);
#else
#else
usleep
(
200000
);
usleep
(
200000
);
#endif
#endif
}
}
}
}
/*
/*
bool Game::Initialize() {
bool Game::Initialize() {
...
...
gframe/game.h
View file @
b180e1c9
...
@@ -80,7 +80,7 @@ public:
...
@@ -80,7 +80,7 @@ public:
bool
Initialize
();
bool
Initialize
();
//void MainLoop();
//void MainLoop();
void
MainServerLoop
(
int
bDuel_mode
,
int
lflist
);
void
MainServerLoop
(
int
bDuel_mode
,
int
lflist
);
/*
/*
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
void BuildProjectionMatrix(irr::core::matrix4& mProjection, f32 left, f32 right, f32 bottom, f32 top, f32 znear, f32 zfar);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cHeight, irr::gui::CGUITTFont* font, const wchar_t* text);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
void SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gui::CGUITTFont* font, const wchar_t* text, u32 pos = 0);
...
@@ -107,12 +107,12 @@ public:
...
@@ -107,12 +107,12 @@ public:
void AddChatMsg(wchar_t* msg, int player);
void AddChatMsg(wchar_t* msg, int player);
void ClearTextures();
void ClearTextures();
void CloseDuelWindow();
void CloseDuelWindow();
*/
*/
int
LocalPlayer
(
int
player
);
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
const
wchar_t
*
LocalName
(
int
local_player
);
/*
/*
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
//irr::gui::IGUIElement* focus = env->getFocus();
//irr::gui::IGUIElement* focus = env->getFocus();
return focus && focus->hasType(type);
return focus && focus->hasType(type);
}
}
...
@@ -165,9 +165,9 @@ public:
...
@@ -165,9 +165,9 @@ public:
bool is_building;
bool is_building;
bool is_siding;
bool is_siding;
*/
*/
/*
/*
ClientField dField;
ClientField dField;
DeckBuilder deckBuilder;
DeckBuilder deckBuilder;
MenuHandler menuHandler;
MenuHandler menuHandler;
irr::IrrlichtDevice* device;
irr::IrrlichtDevice* device;
...
@@ -410,7 +410,7 @@ public:
...
@@ -410,7 +410,7 @@ public:
irr::gui::IGUIButton* btnChainWhenAvail;
irr::gui::IGUIButton* btnChainWhenAvail;
//cancel or finish
//cancel or finish
irr::gui::IGUIButton* btnCancelOrFinish;
irr::gui::IGUIButton* btnCancelOrFinish;
*/
*/
};
};
extern
Game
*
mainGame
;
extern
Game
*
mainGame
;
...
...
gframe/gframe.cpp
View file @
b180e1c9
...
@@ -19,7 +19,7 @@ int main(int argc, char* argv[]) {
...
@@ -19,7 +19,7 @@ int main(int argc, char* argv[]) {
#endif //_WIN32
#endif //_WIN32
ygo
::
Game
_game
;
ygo
::
Game
_game
;
if
(
runasserver
){
if
(
runasserver
){
ygo
::
aServerPort
=
7911
;
ygo
::
aServerPort
=
7911
;
ygo
::
aServerPort
=
atoi
(
argv
[
1
]);
ygo
::
aServerPort
=
atoi
(
argv
[
1
]);
ygo
::
lflist
=
atoi
(
argv
[
2
]);
ygo
::
lflist
=
atoi
(
argv
[
2
]);
ygo
::
start_hand
=
0
;
ygo
::
start_hand
=
0
;
...
@@ -51,7 +51,7 @@ int main(int argc, char* argv[]) {
...
@@ -51,7 +51,7 @@ int main(int argc, char* argv[]) {
return
0
;
return
0
;
}
}
/*
/*
ygo::mainGame = &_game;
ygo::mainGame = &_game;
if(!ygo::mainGame->Initialize())
if(!ygo::mainGame->Initialize())
return 0;
return 0;
...
@@ -99,8 +99,8 @@ int main(int argc, char* argv[]) {
...
@@ -99,8 +99,8 @@ int main(int argc, char* argv[]) {
#ifdef _WIN32
#ifdef _WIN32
WSACleanup();
WSACleanup();
#else
#else
#endif //_WIN32
#endif //_WIN32
*/
*/
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
gframe/netserver.cpp
View file @
b180e1c9
...
@@ -16,8 +16,8 @@ unsigned short NetServer::last_sent = 0;
...
@@ -16,8 +16,8 @@ unsigned short NetServer::last_sent = 0;
void
NetServer
::
Initduel
(
int
bDuel_mode
,
int
lflist
)
void
NetServer
::
Initduel
(
int
bDuel_mode
,
int
lflist
)
{
{
CTOS_CreateGame
*
pkt
=
new
CTOS_CreateGame
;
CTOS_CreateGame
*
pkt
=
new
CTOS_CreateGame
;
pkt
->
info
.
mode
=
MODE_SINGLE
;
pkt
->
info
.
mode
=
MODE_SINGLE
;
if
(
bDuel_mode
==
MODE_SINGLE
)
{
if
(
bDuel_mode
==
MODE_SINGLE
)
{
duel_mode
=
new
SingleDuel
(
false
);
duel_mode
=
new
SingleDuel
(
false
);
...
@@ -79,9 +79,9 @@ unsigned short NetServer::StartServer(unsigned short port) {
...
@@ -79,9 +79,9 @@ unsigned short NetServer::StartServer(unsigned short port) {
return
false
;
return
false
;
}
}
evutil_socket_t
fd
=
evconnlistener_get_fd
(
listener
);
evutil_socket_t
fd
=
evconnlistener_get_fd
(
listener
);
socklen_t
addrlen
=
sizeof
(
struct
sockaddr
);
socklen_t
addrlen
=
sizeof
(
struct
sockaddr
);
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
getsockname
(
fd
,(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
getsockname
(
fd
,(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
evconnlistener_set_error_cb
(
listener
,
ServerAcceptError
);
evconnlistener_set_error_cb
(
listener
,
ServerAcceptError
);
Thread
::
NewThread
(
ServerThread
,
net_evbase
);
Thread
::
NewThread
(
ServerThread
,
net_evbase
);
return
ntohs
(
addr
.
sin_port
);
return
ntohs
(
addr
.
sin_port
);
...
...
gframe/replay.cpp
View file @
b180e1c9
...
@@ -24,20 +24,19 @@ Replay::~Replay() {
...
@@ -24,20 +24,19 @@ Replay::~Replay() {
std
::
wstring
SA2W
(
std
::
string
&
strA
)
std
::
wstring
SA2W
(
std
::
string
&
strA
)
{
{
setlocale
(
LC_ALL
,
"chs"
);
setlocale
(
LC_ALL
,
"chs"
);
const
char
*
_Source
=
strA
.
c_str
();
const
char
*
_Source
=
strA
.
c_str
();
size_t
_Dsize
=
strA
.
size
()
+
1
;
size_t
_Dsize
=
strA
.
size
()
+
1
;
wchar_t
*
_Dest
=
new
wchar_t
[
_Dsize
];
wchar_t
*
_Dest
=
new
wchar_t
[
_Dsize
];
wmemset
(
_Dest
,
0
,
_Dsize
);
wmemset
(
_Dest
,
0
,
_Dsize
);
mbstowcs
(
_Dest
,
_Source
,
_Dsize
);
mbstowcs
(
_Dest
,
_Source
,
_Dsize
);
std
::
wstring
result
=
_Dest
;
std
::
wstring
result
=
_Dest
;
delete
[]
_Dest
;
delete
[]
_Dest
;
setlocale
(
LC_ALL
,
"C"
);
setlocale
(
LC_ALL
,
"C"
);
return
result
;
return
result
;
}
}
...
...
gframe/single_duel.cpp
View file @
b180e1c9
...
@@ -90,16 +90,16 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
...
@@ -90,16 +90,16 @@ void SingleDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
host_info
.
replay_mode
=
0
;
host_info
.
replay_mode
=
0
;
if
(
ygo
::
start_hand
!=
0
){
if
(
ygo
::
start_hand
!=
0
){
host_info
.
start_hand
=
ygo
::
start_hand
;
host_info
.
start_hand
=
ygo
::
start_hand
;
host_info
.
start_lp
=
ygo
::
start_lp
;
host_info
.
start_lp
=
ygo
::
start_lp
;
host_info
.
draw_count
=
ygo
::
draw_count
;
host_info
.
draw_count
=
ygo
::
draw_count
;
host_info
.
mode
=
ygo
::
mode
;
host_info
.
mode
=
ygo
::
mode
;
host_info
.
no_check_deck
=
ygo
::
no_check_deck
;
host_info
.
no_check_deck
=
ygo
::
no_check_deck
;
host_info
.
no_shuffle_deck
=
ygo
::
no_shuffle_deck
;
host_info
.
no_shuffle_deck
=
ygo
::
no_shuffle_deck
;
host_info
.
enable_priority
=
ygo
::
enable_priority
;
host_info
.
enable_priority
=
ygo
::
enable_priority
;
host_info
.
rule
=
ygo
::
rule
;
host_info
.
rule
=
ygo
::
rule
;
host_info
.
time_limit
=
ygo
::
time_limit
;
host_info
.
time_limit
=
ygo
::
time_limit
;
host_info
.
replay_mode
=
ygo
::
replay_mode
;
host_info
.
replay_mode
=
ygo
::
replay_mode
;
}
}
}
else
}
else
{
{
...
...
gframe/tag_duel.cpp
View file @
b180e1c9
...
@@ -71,16 +71,16 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
...
@@ -71,16 +71,16 @@ void TagDuel::JoinGame(DuelPlayer* dp, void* pdata, bool is_creater) {
host_info
.
replay_mode
=
0
;
host_info
.
replay_mode
=
0
;
if
(
ygo
::
start_hand
!=
0
){
if
(
ygo
::
start_hand
!=
0
){
host_info
.
start_hand
=
ygo
::
start_hand
;
host_info
.
start_hand
=
ygo
::
start_hand
;
host_info
.
start_lp
=
ygo
::
start_lp
;
host_info
.
start_lp
=
ygo
::
start_lp
;
host_info
.
draw_count
=
ygo
::
draw_count
;
host_info
.
draw_count
=
ygo
::
draw_count
;
host_info
.
mode
=
ygo
::
mode
;
host_info
.
mode
=
ygo
::
mode
;
host_info
.
no_check_deck
=
ygo
::
no_check_deck
;
host_info
.
no_check_deck
=
ygo
::
no_check_deck
;
host_info
.
no_shuffle_deck
=
ygo
::
no_shuffle_deck
;
host_info
.
no_shuffle_deck
=
ygo
::
no_shuffle_deck
;
host_info
.
enable_priority
=
ygo
::
enable_priority
;
host_info
.
enable_priority
=
ygo
::
enable_priority
;
host_info
.
rule
=
ygo
::
rule
;
host_info
.
rule
=
ygo
::
rule
;
host_info
.
time_limit
=
ygo
::
time_limit
;
host_info
.
time_limit
=
ygo
::
time_limit
;
host_info
.
replay_mode
=
ygo
::
replay_mode
;
host_info
.
replay_mode
=
ygo
::
replay_mode
;
}
}
}
else
}
else
{
{
...
...
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