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
YGOPRO-520DIY
ygopro
Commits
551e62e6
Commit
551e62e6
authored
Mar 12, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'salix/patch2' into server-develop
parents
2b937193
898b4687
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
125 additions
and
113 deletions
+125
-113
gframe/config.h
gframe/config.h
+1
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+14
-14
gframe/deck_con.cpp
gframe/deck_con.cpp
+15
-4
gframe/deck_con.h
gframe/deck_con.h
+2
-1
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+17
-19
gframe/deck_manager.h
gframe/deck_manager.h
+3
-3
gframe/drawing.cpp
gframe/drawing.cpp
+5
-4
gframe/duelclient.cpp
gframe/duelclient.cpp
+2
-2
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+2
-2
gframe/game.cpp
gframe/game.cpp
+41
-41
gframe/game.h
gframe/game.h
+1
-1
gframe/gframe.cpp
gframe/gframe.cpp
+19
-18
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+1
-1
gframe/netserver.h
gframe/netserver.h
+1
-1
No files found.
gframe/config.h
View file @
551e62e6
...
...
@@ -46,7 +46,7 @@
#endif
#include <cstdio>
#include <
stdlib.h
>
#include <
cstdlib
>
#include <iostream>
#include <algorithm>
#include <string>
...
...
gframe/data_manager.cpp
View file @
551e62e6
...
...
@@ -17,14 +17,14 @@ DataManager::DataManager() : _datas(32768), _strings(32768) {
extra_setcode
=
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
}
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
sqlite3_stmt
*
pStmt
{}
;
sqlite3_stmt
*
pStmt
=
nullptr
;
#ifdef YGOPRO_SERVER_MODE
const
char
*
sql
=
"select * from datas"
;
#else
const
char
*
sql
=
"select * from datas,texts where datas.id=texts.id"
;
#endif
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
0
)
!=
SQLITE_OK
)
return
Error
(
pDB
);
return
Error
(
pDB
,
pStmt
);
#ifndef YGOPRO_SERVER_MODE
wchar_t
strBuffer
[
4096
];
#endif
...
...
@@ -33,13 +33,11 @@ bool DataManager::ReadDB(sqlite3* pDB) {
CardDataC
cd
;
CardString
cs
;
step
=
sqlite3_step
(
pStmt
);
if
(
step
==
SQLITE_BUSY
||
step
==
SQLITE_ERROR
||
step
==
SQLITE_MISUSE
)
return
Error
(
pDB
,
pStmt
);
else
if
(
step
==
SQLITE_ROW
)
{
if
(
step
==
SQLITE_ROW
)
{
cd
.
code
=
sqlite3_column_int
(
pStmt
,
0
);
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
cd
.
alias
=
sqlite3_column_int
(
pStmt
,
2
);
auto
setcode
=
sqlite3_column_int64
(
pStmt
,
3
);
uint64_t
setcode
=
static_cast
<
uint64_t
>
(
sqlite3_column_int64
(
pStmt
,
3
)
);
if
(
setcode
)
{
auto
it
=
extra_setcode
.
find
(
cd
.
code
);
if
(
it
!=
extra_setcode
.
end
())
{
...
...
@@ -52,7 +50,7 @@ bool DataManager::ReadDB(sqlite3* pDB) {
else
cd
.
set_setcode
(
setcode
);
}
cd
.
type
=
s
qlite3_column_int
(
pStmt
,
4
);
cd
.
type
=
s
tatic_cast
<
decltype
(
cd
.
type
)
>
(
sqlite3_column_int64
(
pStmt
,
4
)
);
cd
.
attack
=
sqlite3_column_int
(
pStmt
,
5
);
cd
.
defense
=
sqlite3_column_int
(
pStmt
,
6
);
if
(
cd
.
type
&
TYPE_LINK
)
{
...
...
@@ -61,13 +59,13 @@ bool DataManager::ReadDB(sqlite3* pDB) {
}
else
cd
.
link_marker
=
0
;
u
nsigned
int
level
=
sqlite3_column_int
(
pStmt
,
7
);
u
int32_t
level
=
static_cast
<
uint32_t
>
(
sqlite3_column_int
(
pStmt
,
7
)
);
cd
.
level
=
level
&
0xff
;
cd
.
lscale
=
(
level
>>
24
)
&
0xff
;
cd
.
rscale
=
(
level
>>
16
)
&
0xff
;
cd
.
race
=
s
qlite3_column_int
(
pStmt
,
8
);
cd
.
attribute
=
s
qlite3_column_int
(
pStmt
,
9
);
cd
.
category
=
s
qlite3_column_int
(
pStmt
,
10
);
cd
.
race
=
s
tatic_cast
<
decltype
(
cd
.
race
)
>
(
sqlite3_column_int64
(
pStmt
,
8
)
);
cd
.
attribute
=
s
tatic_cast
<
decltype
(
cd
.
attribute
)
>
(
sqlite3_column_int64
(
pStmt
,
9
)
);
cd
.
category
=
s
tatic_cast
<
decltype
(
cd
.
category
)
>
(
sqlite3_column_int64
(
pStmt
,
10
)
);
_datas
[
cd
.
code
]
=
cd
;
#ifndef YGOPRO_SERVER_MODE
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
12
))
{
...
...
@@ -88,7 +86,9 @@ bool DataManager::ReadDB(sqlite3* pDB) {
_strings
[
cd
.
code
]
=
cs
;
#endif //YGOPRO_SERVER_MODE
}
}
while
(
step
!=
SQLITE_DONE
);
else
if
(
step
!=
SQLITE_DONE
)
return
Error
(
pDB
,
pStmt
);
}
while
(
step
==
SQLITE_ROW
);
sqlite3_finalize
(
pStmt
);
return
true
;
}
...
...
@@ -112,10 +112,10 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
if
(
reader
==
nullptr
)
return
false
;
spmemvfs_db_t
db
;
spmembuffer_t
*
mem
=
(
spmembuffer_t
*
)
calloc
(
sizeof
(
spmembuffer_t
),
1
);
spmembuffer_t
*
mem
=
(
spmembuffer_t
*
)
std
::
calloc
(
sizeof
(
spmembuffer_t
),
1
);
spmemvfs_env_init
();
mem
->
total
=
mem
->
used
=
reader
->
getSize
();
mem
->
data
=
(
char
*
)
malloc
(
mem
->
total
+
1
);
mem
->
data
=
(
char
*
)
std
::
malloc
(
mem
->
total
+
1
);
reader
->
read
(
mem
->
data
,
mem
->
total
);
reader
->
drop
();
(
mem
->
data
)[
mem
->
total
]
=
'\0'
;
...
...
gframe/deck_con.cpp
View file @
551e62e6
...
...
@@ -69,7 +69,18 @@ void DeckBuilder::Initialize() {
mainGame
->
btnSideShuffle
->
setVisible
(
false
);
mainGame
->
btnSideSort
->
setVisible
(
false
);
mainGame
->
btnSideReload
->
setVisible
(
false
);
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
gameConf
.
use_lflist
?
mainGame
->
gameConf
.
default_lflist
:
deckManager
.
_lfList
.
size
()
-
1
].
content
;
if
(
mainGame
->
gameConf
.
use_lflist
)
{
if
(
mainGame
->
gameConf
.
default_lflist
>=
0
&&
mainGame
->
gameConf
.
default_lflist
<
(
int
)
deckManager
.
_lfList
.
size
())
{
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
gameConf
.
default_lflist
];
}
else
{
mainGame
->
gameConf
.
default_lflist
=
0
;
filterList
=
&
deckManager
.
_lfList
.
front
();
}
}
else
{
filterList
=
&
deckManager
.
_lfList
.
back
();
}
ClearSearch
();
rnd
.
reset
((
uint_fast32_t
)
std
::
time
(
nullptr
));
mouse_pos
.
set
(
0
,
0
);
...
...
@@ -1480,7 +1491,7 @@ void DeckBuilder::FilterCards() {
if
(
filter_marks
&&
(
data
.
link_marker
&
filter_marks
)
!=
filter_marks
)
continue
;
if
(
filter_lm
)
{
if
(
filter_lm
<=
3
&&
(
!
filterList
->
co
unt
(
ptr
->
first
)
||
(
*
filterList
)
.
at
(
ptr
->
first
)
!=
filter_lm
-
1
))
if
(
filter_lm
<=
3
&&
(
!
filterList
->
co
ntent
.
count
(
ptr
->
first
)
||
filterList
->
content
.
at
(
ptr
->
first
)
!=
filter_lm
-
1
))
continue
;
if
(
filter_lm
==
4
&&
!
(
data
.
ot
&
AVAIL_OCG
))
continue
;
...
...
@@ -1822,8 +1833,8 @@ void DeckBuilder::pop_side(int seq) {
bool
DeckBuilder
::
check_limit
(
code_pointer
pointer
)
{
unsigned
int
limitcode
=
pointer
->
second
.
alias
?
pointer
->
second
.
alias
:
pointer
->
first
;
int
limit
=
3
;
auto
flit
=
filterList
->
find
(
limitcode
);
if
(
flit
!=
filterList
->
end
())
auto
flit
=
filterList
->
content
.
find
(
limitcode
);
if
(
flit
!=
filterList
->
content
.
end
())
limit
=
flit
->
second
;
for
(
auto
it
=
deckManager
.
current_deck
.
main
.
begin
();
it
!=
deckManager
.
current_deck
.
main
.
end
();
++
it
)
{
if
((
*
it
)
->
first
==
limitcode
||
(
*
it
)
->
second
.
alias
==
limitcode
)
...
...
gframe/deck_con.h
View file @
551e62e6
...
...
@@ -5,6 +5,7 @@
#include <vector>
#include <irrlicht.h>
#include "data_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
...
...
@@ -81,7 +82,7 @@ public:
bool
showing_pack
{};
mt19937
rnd
;
const
std
::
unordered_map
<
int
,
int
>*
filterList
;
const
LFList
*
filterList
{}
;
std
::
vector
<
code_pointer
>
results
;
wchar_t
result_string
[
8
]{};
std
::
vector
<
std
::
wstring
>
expansionPacks
;
...
...
gframe/deck_manager.cpp
View file @
551e62e6
...
...
@@ -32,17 +32,14 @@ void DeckManager::LoadLFListSingle(const char* path) {
}
if
(
cur
==
_lfList
.
rend
())
continue
;
int
code
=
0
;
unsigned
int
code
=
0
;
int
count
=
-
1
;
if
(
std
::
sscanf
(
linebuf
,
"%9d%*[ ]%9d"
,
&
code
,
&
count
)
!=
2
)
continue
;
if
(
code
<=
0
||
code
>
MAX_CARD_ID
)
if
(
std
::
sscanf
(
linebuf
,
"%9u%*[ ]%9d"
,
&
code
,
&
count
)
!=
2
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
unsigned
int
hcode
=
code
;
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
hcode
<<
18
)
|
(
hcode
>>
14
))
^
((
hcode
<<
(
27
+
count
))
|
(
h
code
>>
(
5
-
count
)));
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
std
::
fclose
(
fp
);
}
...
...
@@ -58,7 +55,7 @@ void DeckManager::LoadLFList() {
nolimit
.
hash
=
0
;
_lfList
.
push_back
(
nolimit
);
}
const
wchar_t
*
DeckManager
::
GetLFListName
(
int
lfhash
)
{
const
wchar_t
*
DeckManager
::
GetLFListName
(
unsigned
int
lfhash
)
{
auto
lit
=
std
::
find_if
(
_lfList
.
begin
(),
_lfList
.
end
(),
[
lfhash
](
const
ygo
::
LFList
&
list
)
{
return
list
.
hash
==
lfhash
;
});
...
...
@@ -66,12 +63,12 @@ const wchar_t* DeckManager::GetLFListName(int lfhash) {
return
lit
->
listName
.
c_str
();
return
dataManager
.
unknown_string
;
}
const
std
::
unordered_map
<
int
,
int
>*
DeckManager
::
GetLFListContent
(
int
lfhash
)
{
const
LFList
*
DeckManager
::
GetLFList
(
unsigned
int
lfhash
)
{
auto
lit
=
std
::
find_if
(
_lfList
.
begin
(),
_lfList
.
end
(),
[
lfhash
](
const
ygo
::
LFList
&
list
)
{
return
list
.
hash
==
lfhash
;
});
if
(
lit
!=
_lfList
.
end
())
return
&
lit
->
content
;
if
(
lit
!=
_lfList
.
end
())
return
&
(
*
lit
)
;
return
nullptr
;
}
static
unsigned
int
checkAvail
(
unsigned
int
ot
,
unsigned
int
avail
)
{
...
...
@@ -92,9 +89,10 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
return
(
DECKERROR_EXTRACOUNT
<<
28
)
|
(
unsigned
)
deck
.
extra
.
size
();
if
(
deck
.
side
.
size
()
>
SIDE_MAX_SIZE
)
return
(
DECKERROR_SIDECOUNT
<<
28
)
|
(
unsigned
)
deck
.
side
.
size
();
auto
l
ist
=
GetLFListConten
t
(
lfhash
);
if
(
!
list
)
auto
l
flist
=
GetLFLis
t
(
lfhash
);
if
(
!
l
fl
ist
)
return
0
;
auto
&
list
=
lflist
->
content
;
const
unsigned
int
rule_map
[
6
]
=
{
AVAIL_OCG
,
AVAIL_TCG
,
AVAIL_SC
,
AVAIL_CUSTOM
,
AVAIL_OCGTCG
,
0
};
unsigned
int
avail
=
0
;
if
(
rule
>=
0
&&
rule
<
(
int
)(
sizeof
rule_map
/
sizeof
rule_map
[
0
]))
...
...
@@ -110,8 +108,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int
dc
=
ccount
[
code
];
if
(
dc
>
3
)
return
(
DECKERROR_CARDCOUNT
<<
28
)
|
cit
->
first
;
auto
it
=
list
->
find
(
code
);
if
(
it
!=
list
->
end
()
&&
dc
>
it
->
second
)
auto
it
=
list
.
find
(
code
);
if
(
it
!=
list
.
end
()
&&
dc
>
it
->
second
)
return
(
DECKERROR_LFLIST
<<
28
)
|
cit
->
first
;
}
for
(
auto
&
cit
:
deck
.
extra
)
{
...
...
@@ -125,8 +123,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int
dc
=
ccount
[
code
];
if
(
dc
>
3
)
return
(
DECKERROR_CARDCOUNT
<<
28
)
|
cit
->
first
;
auto
it
=
list
->
find
(
code
);
if
(
it
!=
list
->
end
()
&&
dc
>
it
->
second
)
auto
it
=
list
.
find
(
code
);
if
(
it
!=
list
.
end
()
&&
dc
>
it
->
second
)
return
(
DECKERROR_LFLIST
<<
28
)
|
cit
->
first
;
}
for
(
auto
&
cit
:
deck
.
side
)
{
...
...
@@ -140,8 +138,8 @@ unsigned int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
int
dc
=
ccount
[
code
];
if
(
dc
>
3
)
return
(
DECKERROR_CARDCOUNT
<<
28
)
|
cit
->
first
;
auto
it
=
list
->
find
(
code
);
if
(
it
!=
list
->
end
()
&&
dc
>
it
->
second
)
auto
it
=
list
.
find
(
code
);
if
(
it
!=
list
.
end
()
&&
dc
>
it
->
second
)
return
(
DECKERROR_LFLIST
<<
28
)
|
cit
->
first
;
}
return
0
;
...
...
@@ -203,7 +201,7 @@ int DeckManager::LoadDeck(Deck& deck, std::istringstream& deckStream, bool is_pa
if
(
linebuf
[
0
]
<
'0'
||
linebuf
[
0
]
>
'9'
)
continue
;
errno
=
0
;
code
=
strtol
(
linebuf
.
c_str
(),
nullptr
,
10
);
code
=
st
d
::
st
rtol
(
linebuf
.
c_str
(),
nullptr
,
10
);
if
(
errno
==
ERANGE
)
continue
;
cardlist
[
ct
++
]
=
code
;
...
...
gframe/deck_manager.h
View file @
551e62e6
...
...
@@ -32,7 +32,7 @@ namespace ygo {
struct
LFList
{
unsigned
int
hash
{};
std
::
wstring
listName
;
std
::
unordered_map
<
int
,
int
>
content
;
std
::
unordered_map
<
unsigned
int
,
int
>
content
;
};
struct
Deck
{
std
::
vector
<
code_pointer
>
main
;
...
...
@@ -62,8 +62,8 @@ public:
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
const
wchar_t
*
GetLFListName
(
int
lfhash
);
const
std
::
unordered_map
<
int
,
int
>*
GetLFListContent
(
int
lfhash
);
const
wchar_t
*
GetLFListName
(
unsigned
int
lfhash
);
const
LFList
*
GetLFList
(
unsigned
int
lfhash
);
unsigned
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
int
rule
);
int
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
,
bool
is_packlist
=
false
);
int
LoadDeck
(
Deck
&
deck
,
std
::
istringstream
&
deckStream
,
bool
is_packlist
=
false
);
...
...
gframe/drawing.cpp
View file @
551e62e6
...
...
@@ -1126,9 +1126,9 @@ void Game::WaitFrameSignal(int frame) {
signalFrame
=
(
gameConf
.
quick_animation
&&
frame
>=
12
)
?
12
:
frame
;
frameSignal
.
Wait
();
}
void
Game
::
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector2di
pos
,
const
std
::
unordered_map
<
int
,
int
>
*
lflist
,
bool
drag
)
{
void
Game
::
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector2di
pos
,
const
LFList
*
lflist
,
bool
drag
)
{
int
code
=
cp
->
first
;
int
lcode
=
cp
->
second
.
alias
;
auto
lcode
=
cp
->
second
.
alias
;
if
(
lcode
==
0
)
lcode
=
code
;
irr
::
video
::
ITexture
*
img
=
imageManager
.
GetTextureThumb
(
code
);
...
...
@@ -1144,8 +1144,9 @@ void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const std::unord
otloc
=
recti
(
pos
.
X
+
7
,
pos
.
Y
+
50
*
mainGame
->
yScale
,
pos
.
X
+
37
*
mainGame
->
xScale
,
pos
.
Y
+
65
*
mainGame
->
yScale
);
}
driver
->
draw2DImage
(
img
,
dragloc
,
rect
<
s32
>
(
0
,
0
,
size
.
Width
,
size
.
Height
));
if
(
lflist
->
count
(
lcode
))
{
switch
((
*
lflist
).
at
(
lcode
))
{
auto
lfit
=
lflist
->
content
.
find
(
lcode
);
if
(
lfit
!=
lflist
->
content
.
end
())
{
switch
(
lfit
->
second
)
{
case
0
:
driver
->
draw2DImage
(
imageManager
.
tLim
,
limitloc
,
recti
(
0
,
0
,
64
,
64
),
0
,
0
,
true
);
break
;
...
...
gframe/duelclient.cpp
View file @
551e62e6
...
...
@@ -500,9 +500,9 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
mainGame
->
dInfo
.
time_limit
=
pkt
->
info
.
time_limit
;
mainGame
->
dInfo
.
time_left
[
0
]
=
0
;
mainGame
->
dInfo
.
time_left
[
1
]
=
0
;
mainGame
->
deckBuilder
.
filterList
=
deckManager
.
GetLFList
Content
(
pkt
->
info
.
lflist
);
mainGame
->
deckBuilder
.
filterList
=
deckManager
.
GetLFList
(
pkt
->
info
.
lflist
);
if
(
mainGame
->
deckBuilder
.
filterList
==
nullptr
)
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
0
]
.
content
;
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
0
];
mainGame
->
stHostPrepOB
->
setText
(
L""
);
mainGame
->
SetStaticText
(
mainGame
->
stHostPrepRule
,
180
,
mainGame
->
guiFont
,
str
.
c_str
());
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
);
...
...
gframe/duelclient.h
View file @
551e62e6
...
...
@@ -53,7 +53,7 @@ public:
bufferevent_write
(
client_bev
,
duel_client_write
,
3
);
}
template
<
typename
ST
>
static
void
SendPacketToServer
(
unsigned
char
proto
,
ST
&
st
)
{
static
void
SendPacketToServer
(
unsigned
char
proto
,
const
ST
&
st
)
{
auto
p
=
duel_client_write
;
if
(
sizeof
(
ST
)
>
MAX_DATA_SIZE
)
return
;
...
...
gframe/event_handler.cpp
View file @
551e62e6
...
...
@@ -1939,7 +1939,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
mainGame
->
cbLFlist
->
setEnabled
(
mainGame
->
gameConf
.
use_lflist
);
mainGame
->
cbLFlist
->
setSelected
(
mainGame
->
gameConf
.
use_lflist
?
mainGame
->
gameConf
.
default_lflist
:
mainGame
->
cbLFlist
->
getItemCount
()
-
1
);
mainGame
->
cbHostLFlist
->
setSelected
(
mainGame
->
gameConf
.
use_lflist
?
mainGame
->
gameConf
.
default_lflist
:
mainGame
->
cbHostLFlist
->
getItemCount
()
-
1
);
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
cbLFlist
->
getSelected
()]
.
content
;
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
cbLFlist
->
getSelected
()];
return
true
;
break
;
}
...
...
@@ -1951,7 +1951,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case
COMBOBOX_LFLIST
:
{
mainGame
->
gameConf
.
default_lflist
=
mainGame
->
cbLFlist
->
getSelected
();
mainGame
->
cbHostLFlist
->
setSelected
(
mainGame
->
gameConf
.
default_lflist
);
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
gameConf
.
default_lflist
]
.
content
;
mainGame
->
deckBuilder
.
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
gameConf
.
default_lflist
];
return
true
;
break
;
}
...
...
gframe/game.cpp
View file @
551e62e6
...
...
@@ -113,7 +113,7 @@ void Game::MainServerLoop() {
#else //YGOPRO_SERVER_MODE
bool
Game
::
Initialize
()
{
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
()
;
irr
::
SIrrlichtCreationParameters
params
{}
;
params
.
AntiAlias
=
gameConf
.
antialias
;
if
(
gameConf
.
use_d3d
)
params
.
DriverType
=
irr
::
video
::
EDT_DIRECT3D9
;
...
...
@@ -1432,13 +1432,13 @@ void Game::LoadConfig() {
if
(
std
::
sscanf
(
linebuf
,
"%63s = %959s"
,
strbuf
,
valbuf
)
!=
2
)
continue
;
if
(
!
std
::
strcmp
(
strbuf
,
"antialias"
))
{
gameConf
.
antialias
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
antialias
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_d3d"
))
{
gameConf
.
use_d3d
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
use_d3d
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_image_scale"
))
{
gameConf
.
use_image_scale
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
use_image_scale
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"errorlog"
))
{
unsigned
int
val
=
strtol
(
valbuf
,
nullptr
,
10
);
unsigned
int
val
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
enable_log
=
val
&
0xff
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"textfont"
))
{
int
textfontsize
=
0
;
...
...
@@ -1449,94 +1449,94 @@ void Game::LoadConfig() {
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"numfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
numfont
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"serverport"
))
{
gameConf
.
serverport
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
serverport
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lasthost"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
lasthost
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"lastport"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
gameConf
.
lastport
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"automonsterpos"
))
{
gameConf
.
chkMAutoPos
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkMAutoPos
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"autospellpos"
))
{
gameConf
.
chkSTAutoPos
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkSTAutoPos
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"randompos"
))
{
gameConf
.
chkRandomPos
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkRandomPos
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"autochain"
))
{
gameConf
.
chkAutoChain
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkAutoChain
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"waitchain"
))
{
gameConf
.
chkWaitChain
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkWaitChain
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"showchain"
))
{
gameConf
.
chkDefaultShowChain
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkDefaultShowChain
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"mute_opponent"
))
{
gameConf
.
chkIgnore1
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkIgnore1
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"mute_spectators"
))
{
gameConf
.
chkIgnore2
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkIgnore2
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"use_lflist"
))
{
gameConf
.
use_lflist
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
use_lflist
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"default_lflist"
))
{
gameConf
.
default_lflist
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
default_lflist
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"default_rule"
))
{
gameConf
.
default_rule
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
default_rule
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
if
(
gameConf
.
default_rule
<=
0
)
gameConf
.
default_rule
=
DEFAULT_DUEL_RULE
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"hide_setname"
))
{
gameConf
.
hide_setname
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
hide_setname
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"hide_hint_button"
))
{
gameConf
.
hide_hint_button
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
hide_hint_button
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"control_mode"
))
{
gameConf
.
control_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
control_mode
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"draw_field_spell"
))
{
gameConf
.
draw_field_spell
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
draw_field_spell
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"separate_clear_button"
))
{
gameConf
.
separate_clear_button
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
separate_clear_button
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"auto_search_limit"
))
{
gameConf
.
auto_search_limit
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
auto_search_limit
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"search_multiple_keywords"
))
{
gameConf
.
search_multiple_keywords
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
search_multiple_keywords
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
gameConf
.
chkIgnoreDeckChanges
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
chkIgnoreDeckChanges
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"default_ot"
))
{
gameConf
.
defaultOT
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
defaultOT
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"enable_bot_mode"
))
{
gameConf
.
enable_bot_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
enable_bot_mode
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"quick_animation"
))
{
gameConf
.
quick_animation
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
quick_animation
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"auto_save_replay"
))
{
gameConf
.
auto_save_replay
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
auto_save_replay
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"draw_single_chain"
))
{
gameConf
.
draw_single_chain
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
draw_single_chain
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"hide_player_name"
))
{
gameConf
.
hide_player_name
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
hide_player_name
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"prefer_expansion_script"
))
{
gameConf
.
prefer_expansion_script
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
prefer_expansion_script
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"window_maximized"
))
{
gameConf
.
window_maximized
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
window_maximized
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"window_width"
))
{
gameConf
.
window_width
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
window_width
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"window_height"
))
{
gameConf
.
window_height
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
window_height
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"resize_popup_menu"
))
{
gameConf
.
resize_popup_menu
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
resize_popup_menu
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
#ifdef YGOPRO_USE_IRRKLANG
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"enable_sound"
))
{
gameConf
.
enable_sound
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
enable_sound
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"sound_volume"
))
{
int
vol
=
strtol
(
valbuf
,
nullptr
,
10
);
int
vol
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
gameConf
.
sound_volume
=
(
double
)
vol
/
100
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"enable_music"
))
{
gameConf
.
enable_music
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
gameConf
.
enable_music
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"music_volume"
))
{
int
vol
=
strtol
(
valbuf
,
nullptr
,
10
);
int
vol
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
gameConf
.
music_volume
=
(
double
)
vol
/
100
;
}
else
if
(
!
std
::
strcmp
(
strbuf
,
"music_mode"
))
{
gameConf
.
music_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
gameConf
.
music_mode
=
st
d
::
st
rtol
(
valbuf
,
nullptr
,
10
);
#endif
}
else
{
// options allowing multiple words
...
...
gframe/game.h
View file @
551e62e6
...
...
@@ -185,7 +185,7 @@ public:
void
HideElement
(
irr
::
gui
::
IGUIElement
*
element
,
bool
set_action
=
false
);
void
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
=
0
);
void
WaitFrameSignal
(
int
frame
);
void
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector2di
pos
,
const
std
::
unordered_map
<
int
,
int
>
*
lflist
,
bool
drag
=
false
);
void
DrawThumb
(
code_pointer
cp
,
irr
::
core
::
vector2di
pos
,
const
LFList
*
lflist
,
bool
drag
=
false
);
void
DrawDeckBd
();
void
LoadConfig
();
void
SaveConfig
();
...
...
gframe/gframe.cpp
View file @
551e62e6
...
...
@@ -123,7 +123,7 @@ int main(int argc, char* argv[]) {
return
0
;
#ifdef _WIN32
int
wargc
;
int
wargc
=
0
;
std
::
unique_ptr
<
wchar_t
*
[],
void
(
*
)(
wchar_t
**
)
>
wargv
(
CommandLineToArgvW
(
GetCommandLineW
(),
&
wargc
),
[](
wchar_t
**
wargv
)
{
LocalFree
(
wargv
);
});
...
...
@@ -138,6 +138,24 @@ int main(int argc, char* argv[]) {
bool
keep_on_return
=
false
;
bool
deckCategorySpecified
=
false
;
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
1
],
open_file_name
);
exit_on_return
=
true
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
1
],
open_file_name
);
exit_on_return
=
true
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
break
;
}
}
if
(
wargv
[
i
][
0
]
==
L'-'
&&
wargv
[
i
][
1
]
==
L'e'
&&
wargv
[
i
][
2
]
!=
L'\0'
)
{
ygo
::
dataManager
.
LoadDB
(
&
wargv
[
i
][
2
]);
continue
;
...
...
@@ -233,23 +251,6 @@ int main(int argc, char* argv[]) {
if
(
open_file
)
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
break
;
}
else
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
break
;
}
}
}
ygo
::
mainGame
->
MainLoop
();
...
...
gframe/menu_handler.cpp
View file @
551e62e6
...
...
@@ -400,7 +400,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
char
arg3
[
8
];
std
::
snprintf
(
arg3
,
sizeof
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
nullptr
);
exit
(
0
);
std
::
exit
(
0
);
}
else
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
...
...
gframe/netserver.h
View file @
551e62e6
...
...
@@ -50,7 +50,7 @@ public:
bufferevent_write
(
dp
->
bev
,
net_server_write
,
3
);
}
template
<
typename
ST
>
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
ST
&
st
)
{
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
const
ST
&
st
)
{
auto
p
=
net_server_write
;
if
(
sizeof
(
ST
)
>
MAX_DATA_SIZE
)
return
;
...
...
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