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
nanahira
ygopro
Commits
b0e0ca3c
Commit
b0e0ca3c
authored
Oct 16, 2024
by
Chen Bill
Committed by
GitHub
Oct 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add datas_begin(), strings_begin() (#2607)
* reorder * DataManager: add datas_begin(), strings_begin() * replace
parent
cf135ac0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
29 deletions
+33
-29
gframe/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/data_manager.cpp
gframe/data_manager.cpp
+18
-14
gframe/data_manager.h
gframe/data_manager.h
+5
-5
gframe/deck_con.cpp
gframe/deck_con.cpp
+6
-6
gframe/game.cpp
gframe/game.cpp
+2
-2
No files found.
gframe/client_field.cpp
View file @
b0e0ca3c
...
...
@@ -1548,10 +1548,10 @@ void ClientField::UpdateDeclarableList() {
}
mainGame
->
lstANCard
->
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
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
if
(
cp
==
dataManager
.
datas_end
)
if
(
cp
==
dataManager
.
datas_end
()
)
continue
;
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
declare_opcodes
))
{
...
...
gframe/data_manager.cpp
View file @
b0e0ca3c
...
...
@@ -10,10 +10,6 @@ IFileSystem* DataManager::FileSystem;
DataManager
dataManager
;
DataManager
::
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
extra_setcode
=
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
}
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
...
...
@@ -80,10 +76,6 @@ bool DataManager::ReadDB(sqlite3* pDB) {
_strings
[
cd
.
code
]
=
cs
;
}
}
while
(
step
!=
SQLITE_DONE
);
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
sqlite3_finalize
(
pStmt
);
return
true
;
}
...
...
@@ -180,6 +172,24 @@ bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
sqlite3_finalize
(
pStmt
);
return
false
;
}
code_pointer
DataManager
::
GetCodePointer
(
unsigned
int
code
)
const
{
return
_datas
.
find
(
code
);
}
string_pointer
DataManager
::
GetStringPointer
(
unsigned
int
code
)
const
{
return
_strings
.
find
(
code
);
}
code_pointer
DataManager
::
datas_begin
()
{
return
_datas
.
cbegin
();
}
code_pointer
DataManager
::
datas_end
()
{
return
_datas
.
cend
();
}
string_pointer
DataManager
::
strings_begin
()
{
return
_strings
.
cbegin
();
}
string_pointer
DataManager
::
strings_end
()
{
return
_strings
.
cend
();
}
bool
DataManager
::
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
{
auto
cdit
=
_datas
.
find
(
code
);
if
(
cdit
==
_datas
.
end
())
...
...
@@ -189,12 +199,6 @@ bool DataManager::GetData(unsigned int code, CardData* pData) const {
}
return
true
;
}
code_pointer
DataManager
::
GetCodePointer
(
unsigned
int
code
)
const
{
return
_datas
.
find
(
code
);
}
string_pointer
DataManager
::
GetStringPointer
(
unsigned
int
code
)
const
{
return
_strings
.
find
(
code
);
}
bool
DataManager
::
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
{
auto
csit
=
_strings
.
find
(
code
);
if
(
csit
==
_strings
.
end
())
{
...
...
gframe/data_manager.h
View file @
b0e0ca3c
...
...
@@ -21,9 +21,13 @@ public:
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
;
code_pointer
GetCodePointer
(
unsigned
int
code
)
const
;
string_pointer
GetStringPointer
(
unsigned
int
code
)
const
;
code_pointer
datas_begin
();
code_pointer
datas_end
();
string_pointer
strings_begin
();
string_pointer
strings_end
();
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
;
bool
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
;
const
wchar_t
*
GetName
(
unsigned
int
code
)
const
;
const
wchar_t
*
GetText
(
unsigned
int
code
)
const
;
...
...
@@ -45,10 +49,6 @@ public:
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
;
string_pointer
strings_begin
;
string_pointer
strings_end
;
char
errmsg
[
512
]{};
wchar_t
numStrings
[
301
][
4
]{};
...
...
gframe/deck_con.cpp
View file @
b0e0ca3c
...
...
@@ -1015,7 +1015,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
))
...
...
@@ -1069,7 +1069,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
)
{
...
...
@@ -1104,7 +1104,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
;
...
...
@@ -1139,7 +1139,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
is_draging
)
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
datas_end
)
if
(
pointer
==
dataManager
.
datas_end
()
)
break
;
if
(
!
check_limit
(
pointer
))
break
;
...
...
@@ -1409,10 +1409,10 @@ void DeckBuilder::FilterCards() {
query_elements
.
push_back
(
element
);
}
}
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
;
ptr
!=
dataManager
.
datas_end
;
++
ptr
)
{
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
();
ptr
!=
dataManager
.
datas_end
()
;
++
ptr
)
{
const
CardDataC
&
data
=
ptr
->
second
;
auto
strpointer
=
dataManager
.
GetStringPointer
(
ptr
->
first
);
if
(
strpointer
==
dataManager
.
strings_end
)
if
(
strpointer
==
dataManager
.
strings_end
()
)
continue
;
const
CardString
&
text
=
strpointer
->
second
;
if
(
data
.
type
&
TYPE_TOKEN
)
...
...
gframe/game.cpp
View file @
b0e0ca3c
...
...
@@ -1541,7 +1541,7 @@ void Game::ShowCardInfo(int code, bool resize) {
return
;
wchar_t
formatBuffer
[
256
];
auto
cit
=
dataManager
.
GetCodePointer
(
code
);
bool
is_valid
=
(
cit
!=
dataManager
.
datas_end
);
bool
is_valid
=
(
cit
!=
dataManager
.
datas_end
()
);
imgCard
->
setImage
(
imageManager
.
GetTexture
(
code
,
true
));
if
(
is_valid
)
{
auto
&
cd
=
cit
->
second
;
...
...
@@ -1558,7 +1558,7 @@ void Game::ShowCardInfo(int code, bool resize) {
if
(
is_valid
&&
!
gameConf
.
hide_setname
)
{
auto
&
cd
=
cit
->
second
;
auto
target
=
cit
;
if
(
cd
.
alias
&&
dataManager
.
GetCodePointer
(
cd
.
alias
)
!=
dataManager
.
datas_end
)
{
if
(
cd
.
alias
&&
dataManager
.
GetCodePointer
(
cd
.
alias
)
!=
dataManager
.
datas_end
()
)
{
target
=
dataManager
.
GetCodePointer
(
cd
.
alias
);
}
if
(
target
->
second
.
setcode
[
0
])
{
...
...
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