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
baichixing
ygopro
Commits
c5297715
Commit
c5297715
authored
Jan 10, 2024
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataManager: change _strings to private
parent
4297cb3e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
7 deletions
+23
-7
gframe/client_card.h
gframe/client_card.h
+1
-0
gframe/client_field.cpp
gframe/client_field.cpp
+1
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+6
-1
gframe/data_manager.h
gframe/data_manager.h
+11
-3
gframe/deck_con.cpp
gframe/deck_con.cpp
+4
-2
No files found.
gframe/client_card.h
View file @
c5297715
...
@@ -33,6 +33,7 @@ struct CardString {
...
@@ -33,6 +33,7 @@ struct CardString {
std
::
wstring
desc
[
16
];
std
::
wstring
desc
[
16
];
};
};
typedef
std
::
unordered_map
<
unsigned
int
,
CardDataC
>::
const_iterator
code_pointer
;
typedef
std
::
unordered_map
<
unsigned
int
,
CardDataC
>::
const_iterator
code_pointer
;
typedef
std
::
unordered_map
<
unsigned
int
,
CardString
>::
const_iterator
string_pointer
;
class
ClientCard
{
class
ClientCard
{
public:
public:
...
...
gframe/client_field.cpp
View file @
c5297715
...
@@ -1555,7 +1555,7 @@ void ClientField::UpdateDeclarableList() {
...
@@ -1555,7 +1555,7 @@ void ClientField::UpdateDeclarableList() {
}
}
mainGame
->
lstANCard
->
clear
();
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
ancard
.
clear
();
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
()
;
++
cit
)
{
for
(
auto
cit
=
dataManager
.
strings_begin
;
cit
!=
dataManager
.
strings_end
;
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
if
(
cp
==
dataManager
.
datas_end
)
if
(
cp
==
dataManager
.
datas_end
)
...
...
gframe/data_manager.cpp
View file @
c5297715
...
@@ -85,6 +85,8 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
...
@@ -85,6 +85,8 @@ bool DataManager::LoadDB(const wchar_t* wfile) {
spmemvfs_env_fini
();
spmemvfs_env_fini
();
datas_begin
=
_datas
.
begin
();
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
return
true
;
return
true
;
}
}
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
bool
DataManager
::
LoadStrings
(
const
char
*
file
)
{
...
@@ -170,9 +172,12 @@ bool DataManager::GetData(unsigned int code, CardData* pData) {
...
@@ -170,9 +172,12 @@ bool DataManager::GetData(unsigned int code, CardData* pData) {
}
}
return
true
;
return
true
;
}
}
code_pointer
DataManager
::
GetCodePointer
(
int
code
)
{
code_pointer
DataManager
::
GetCodePointer
(
unsigned
int
code
)
{
return
_datas
.
find
(
code
);
return
_datas
.
find
(
code
);
}
}
string_pointer
DataManager
::
GetStringPointer
(
unsigned
int
code
)
{
return
_strings
.
find
(
code
);
}
bool
DataManager
::
GetString
(
int
code
,
CardString
*
pStr
)
{
bool
DataManager
::
GetString
(
int
code
,
CardString
*
pStr
)
{
auto
csit
=
_strings
.
find
(
code
);
auto
csit
=
_strings
.
find
(
code
);
if
(
csit
==
_strings
.
end
())
{
if
(
csit
==
_strings
.
end
())
{
...
...
gframe/data_manager.h
View file @
c5297715
...
@@ -11,14 +11,20 @@ namespace ygo {
...
@@ -11,14 +11,20 @@ namespace ygo {
class
DataManager
{
class
DataManager
{
public:
public:
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{}
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
}
bool
LoadDB
(
const
wchar_t
*
wfile
);
bool
LoadDB
(
const
wchar_t
*
wfile
);
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
IReadFile
*
reader
);
bool
LoadStrings
(
IReadFile
*
reader
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
);
bool
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
);
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
);
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
);
code_pointer
GetCodePointer
(
int
code
);
code_pointer
GetCodePointer
(
unsigned
int
code
);
string_pointer
GetStringPointer
(
unsigned
int
code
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
const
wchar_t
*
GetName
(
int
code
);
const
wchar_t
*
GetName
(
int
code
);
const
wchar_t
*
GetText
(
int
code
);
const
wchar_t
*
GetText
(
int
code
);
...
@@ -36,13 +42,14 @@ public:
...
@@ -36,13 +42,14 @@ public:
const
wchar_t
*
FormatSetName
(
unsigned
long
long
setcode
);
const
wchar_t
*
FormatSetName
(
unsigned
long
long
setcode
);
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
);
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
);
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
code_pointer
datas_begin
;
code_pointer
datas_begin
;
code_pointer
datas_end
;
code_pointer
datas_end
;
string_pointer
strings_begin
;
string_pointer
strings_end
;
wchar_t
numStrings
[
301
][
4
];
wchar_t
numStrings
[
301
][
4
];
wchar_t
numBuffer
[
6
];
wchar_t
numBuffer
[
6
];
...
@@ -61,6 +68,7 @@ public:
...
@@ -61,6 +68,7 @@ public:
private:
private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
};
};
extern
DataManager
dataManager
;
extern
DataManager
dataManager
;
...
...
gframe/deck_con.cpp
View file @
c5297715
...
@@ -1423,9 +1423,11 @@ void DeckBuilder::FilterCards() {
...
@@ -1423,9 +1423,11 @@ void DeckBuilder::FilterCards() {
query_elements
.
push_back
(
element
);
query_elements
.
push_back
(
element
);
}
}
}
}
auto
strpointer
=
dataManager
.
_strings
.
begin
();
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
;
ptr
!=
dataManager
.
datas_end
;
++
ptr
)
{
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
;
ptr
!=
dataManager
.
datas_end
;
++
ptr
,
++
strpointer
)
{
const
CardDataC
&
data
=
ptr
->
second
;
const
CardDataC
&
data
=
ptr
->
second
;
auto
strpointer
=
dataManager
.
GetStringPointer
(
ptr
->
first
);
if
(
strpointer
==
dataManager
.
strings_end
)
continue
;
const
CardString
&
text
=
strpointer
->
second
;
const
CardString
&
text
=
strpointer
->
second
;
if
(
data
.
type
&
TYPE_TOKEN
)
if
(
data
.
type
&
TYPE_TOKEN
)
continue
;
continue
;
...
...
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