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
Commits
4297cb3e
Commit
4297cb3e
authored
Jan 10, 2024
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataManager: change _datas to private
parent
c8fd6335
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
16 deletions
+32
-16
gframe/client_field.cpp
gframe/client_field.cpp
+3
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-0
gframe/data_manager.h
gframe/data_manager.h
+5
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+8
-6
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+2
-2
gframe/game.cpp
gframe/game.cpp
+2
-2
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+10
-4
No files found.
gframe/client_field.cpp
View file @
4297cb3e
...
...
@@ -1557,7 +1557,9 @@ void ClientField::UpdateDeclarableList() {
ancard
.
clear
();
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
();
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
if
(
cp
==
dataManager
.
datas_end
)
continue
;
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
declare_opcodes
))
{
if
(
pname
==
cit
->
second
.
name
||
trycode
==
cit
->
first
)
{
//exact match or last used
...
...
gframe/data_manager.cpp
View file @
4297cb3e
...
...
@@ -83,6 +83,8 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
sqlite3_finalize
(
pStmt
);
spmemvfs_close_db
(
&
db
);
spmemvfs_env_fini
();
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
return
true
;
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
...
...
gframe/data_manager.h
View file @
4297cb3e
...
...
@@ -36,12 +36,13 @@ public:
const
wchar_t
*
FormatSetName
(
unsigned
long
long
setcode
);
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
);
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
code_pointer
datas_begin
;
code_pointer
datas_end
;
wchar_t
numStrings
[
301
][
4
];
wchar_t
numBuffer
[
6
];
...
...
@@ -57,6 +58,9 @@ public:
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
};
extern
DataManager
dataManager
;
...
...
gframe/deck_con.cpp
View file @
4297cb3e
...
...
@@ -43,8 +43,8 @@ static int parse_filter(const wchar_t* pstr, unsigned int* type) {
static
bool
check_set_code
(
const
CardDataC
&
data
,
int
set_code
)
{
unsigned
long
long
sc
=
data
.
setcode
;
if
(
data
.
alias
)
{
auto
aptr
=
dataManager
.
_datas
.
find
(
data
.
alias
);
if
(
aptr
!=
dataManager
.
_datas
.
end
()
)
auto
aptr
=
dataManager
.
GetCodePointer
(
data
.
alias
);
if
(
aptr
!=
dataManager
.
datas_end
)
sc
=
aptr
->
second
.
setcode
;
}
bool
res
=
false
;
...
...
@@ -1030,7 +1030,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
dragx
=
event
.
MouseInput
.
X
;
dragy
=
event
.
MouseInput
.
Y
;
draging_pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
draging_pointer
==
dataManager
.
_datas
.
end
()
)
if
(
draging_pointer
==
dataManager
.
datas_end
)
break
;
if
(
hovered_pos
==
4
)
{
if
(
!
check_limit
(
draging_pointer
))
...
...
@@ -1084,7 +1084,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
_datas
.
end
()
)
if
(
pointer
==
dataManager
.
datas_end
)
break
;
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
if
(
hovered_pos
==
1
)
{
...
...
@@ -1119,7 +1119,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
pop_side
(
hovered_seq
);
}
else
{
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
_datas
.
end
()
)
if
(
pointer
==
dataManager
.
datas_end
)
break
;
if
(
!
check_limit
(
pointer
))
break
;
...
...
@@ -1154,6 +1154,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
is_draging
)
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
datas_end
)
break
;
if
(
!
check_limit
(
pointer
))
break
;
soundManager
.
PlaySoundEffect
(
SOUND_CARD_PICK
);
...
...
@@ -1422,7 +1424,7 @@ void DeckBuilder::FilterCards() {
}
}
auto
strpointer
=
dataManager
.
_strings
.
begin
();
for
(
code_pointer
ptr
=
dataManager
.
_datas
.
begin
();
ptr
!=
dataManager
.
_datas
.
end
()
;
++
ptr
,
++
strpointer
)
{
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
;
ptr
!=
dataManager
.
datas_end
;
++
ptr
,
++
strpointer
)
{
const
CardDataC
&
data
=
ptr
->
second
;
const
CardString
&
text
=
strpointer
->
second
;
if
(
data
.
type
&
TYPE_TOKEN
)
...
...
gframe/deck_manager.cpp
View file @
4297cb3e
...
...
@@ -161,7 +161,7 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
else
if
(
cd
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_LINK
))
{
if
(
deck
.
extra
.
size
()
>=
15
)
continue
;
deck
.
extra
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
//verified by GetData()
deck
.
extra
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
}
else
if
(
deck
.
main
.
size
()
<
60
)
{
deck
.
main
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
}
...
...
@@ -175,7 +175,7 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
if
(
cd
.
type
&
TYPE_TOKEN
)
continue
;
if
(
deck
.
side
.
size
()
<
15
)
deck
.
side
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
//verified by GetData()
deck
.
side
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
}
return
errorcode
;
}
...
...
gframe/game.cpp
View file @
4297cb3e
...
...
@@ -1530,8 +1530,8 @@ void Game::ShowCardInfo(int code, bool resize) {
if
(
!
gameConf
.
hide_setname
)
{
unsigned
long
long
sc
=
cd
.
setcode
;
if
(
cd
.
alias
)
{
auto
aptr
=
dataManager
.
_datas
.
find
(
cd
.
alias
);
if
(
aptr
!=
dataManager
.
_datas
.
end
()
)
auto
aptr
=
dataManager
.
GetCodePointer
(
cd
.
alias
);
if
(
aptr
!=
dataManager
.
datas_end
)
sc
=
aptr
->
second
.
setcode
;
}
if
(
sc
)
{
...
...
gframe/menu_handler.cpp
View file @
4297cb3e
...
...
@@ -314,11 +314,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
for
(
int
i
=
0
;
i
<
max
;
++
i
)
{
int
main
=
replay
.
ReadInt32
();
Deck
tmp_deck
;
for
(
int
j
=
0
;
j
<
main
;
++
j
)
tmp_deck
.
main
.
push_back
(
dataManager
.
GetCodePointer
(
replay
.
ReadInt32
()));
for
(
int
j
=
0
;
j
<
main
;
++
j
)
{
auto
card
=
dataManager
.
GetCodePointer
(
replay
.
ReadInt32
());
if
(
card
!=
dataManager
.
datas_end
)
tmp_deck
.
main
.
push_back
(
card
);
}
int
extra
=
replay
.
ReadInt32
();
for
(
int
j
=
0
;
j
<
extra
;
++
j
)
tmp_deck
.
extra
.
push_back
(
dataManager
.
GetCodePointer
(
replay
.
ReadInt32
()));
for
(
int
j
=
0
;
j
<
extra
;
++
j
)
{
auto
card
=
dataManager
.
GetCodePointer
(
replay
.
ReadInt32
());
if
(
card
!=
dataManager
.
datas_end
)
tmp_deck
.
extra
.
push_back
(
card
);
}
FileSystem
::
SafeFileName
(
namebuf
[
i
]);
myswprintf
(
filename
,
L"deck/%ls-%d %ls.ydk"
,
ex_filename
,
i
+
1
,
namebuf
[
i
]);
deckManager
.
SaveDeck
(
tmp_deck
,
filename
);
...
...
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