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
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
MyCard
ygopro
Commits
68d1ff85
Commit
68d1ff85
authored
Jul 21, 2025
by
Chen Bill
Committed by
GitHub
Jul 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve loop condition in ReadDB (#2881)
parent
fb6814a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
44 deletions
+40
-44
gframe/data_manager.cpp
gframe/data_manager.cpp
+40
-44
No files found.
gframe/data_manager.cpp
View file @
68d1ff85
...
@@ -18,53 +18,49 @@ bool DataManager::ReadDB(sqlite3* pDB) {
...
@@ -18,53 +18,49 @@ bool DataManager::ReadDB(sqlite3* pDB) {
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
nullptr
)
!=
SQLITE_OK
)
if
(
sqlite3_prepare_v2
(
pDB
,
sql
,
-
1
,
&
pStmt
,
nullptr
)
!=
SQLITE_OK
)
return
Error
(
pDB
,
pStmt
);
return
Error
(
pDB
,
pStmt
);
wchar_t
strBuffer
[
4096
];
wchar_t
strBuffer
[
4096
];
int
step
=
0
;
for
(
int
step
=
sqlite3_step
(
pStmt
);
step
!=
SQLITE_DONE
;
step
=
sqlite3_step
(
pStmt
))
{
do
{
if
(
step
!=
SQLITE_ROW
)
step
=
sqlite3_step
(
pStmt
);
return
Error
(
pDB
,
pStmt
);
if
(
step
==
SQLITE_ROW
)
{
uint32_t
code
=
static_cast
<
uint32_t
>
(
sqlite3_column_int64
(
pStmt
,
0
));
uint32_t
code
=
static_cast
<
uint32_t
>
(
sqlite3_column_int64
(
pStmt
,
0
));
auto
&
cd
=
_datas
[
code
];
auto
&
cd
=
_datas
[
code
];
cd
.
code
=
code
;
cd
.
code
=
code
;
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
cd
.
ot
=
sqlite3_column_int
(
pStmt
,
1
);
cd
.
alias
=
sqlite3_column_int
(
pStmt
,
2
);
cd
.
alias
=
sqlite3_column_int
(
pStmt
,
2
);
uint64_t
setcode
=
static_cast
<
uint64_t
>
(
sqlite3_column_int64
(
pStmt
,
3
));
uint64_t
setcode
=
static_cast
<
uint64_t
>
(
sqlite3_column_int64
(
pStmt
,
3
));
write_setcode
(
cd
.
setcode
,
setcode
);
write_setcode
(
cd
.
setcode
,
setcode
);
cd
.
type
=
static_cast
<
decltype
(
cd
.
type
)
>
(
sqlite3_column_int64
(
pStmt
,
4
));
cd
.
type
=
static_cast
<
decltype
(
cd
.
type
)
>
(
sqlite3_column_int64
(
pStmt
,
4
));
cd
.
attack
=
sqlite3_column_int
(
pStmt
,
5
);
cd
.
attack
=
sqlite3_column_int
(
pStmt
,
5
);
cd
.
defense
=
sqlite3_column_int
(
pStmt
,
6
);
cd
.
defense
=
sqlite3_column_int
(
pStmt
,
6
);
if
(
cd
.
type
&
TYPE_LINK
)
{
if
(
cd
.
type
&
TYPE_LINK
)
{
cd
.
link_marker
=
cd
.
defense
;
cd
.
link_marker
=
cd
.
defense
;
cd
.
defense
=
0
;
cd
.
defense
=
0
;
}
}
else
else
cd
.
link_marker
=
0
;
cd
.
link_marker
=
0
;
uint32_t
level
=
static_cast
<
uint32_t
>
(
sqlite3_column_int64
(
pStmt
,
7
));
uint32_t
level
=
static_cast
<
uint32_t
>
(
sqlite3_column_int64
(
pStmt
,
7
));
cd
.
level
=
level
&
0xff
;
cd
.
level
=
level
&
0xff
;
cd
.
lscale
=
(
level
>>
24
)
&
0xff
;
cd
.
lscale
=
(
level
>>
24
)
&
0xff
;
cd
.
rscale
=
(
level
>>
16
)
&
0xff
;
cd
.
rscale
=
(
level
>>
16
)
&
0xff
;
cd
.
race
=
static_cast
<
decltype
(
cd
.
race
)
>
(
sqlite3_column_int64
(
pStmt
,
8
));
cd
.
race
=
static_cast
<
decltype
(
cd
.
race
)
>
(
sqlite3_column_int64
(
pStmt
,
8
));
cd
.
attribute
=
static_cast
<
decltype
(
cd
.
attribute
)
>
(
sqlite3_column_int64
(
pStmt
,
9
));
cd
.
attribute
=
static_cast
<
decltype
(
cd
.
attribute
)
>
(
sqlite3_column_int64
(
pStmt
,
9
));
cd
.
category
=
static_cast
<
decltype
(
cd
.
category
)
>
(
sqlite3_column_int64
(
pStmt
,
10
));
cd
.
category
=
static_cast
<
decltype
(
cd
.
category
)
>
(
sqlite3_column_int64
(
pStmt
,
10
));
auto
&
cs
=
_strings
[
code
];
auto
&
cs
=
_strings
[
code
];
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
12
))
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
12
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
name
=
strBuffer
;
cs
.
name
=
strBuffer
;
}
}
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
13
))
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
13
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
text
=
strBuffer
;
}
constexpr
int
desc_count
=
sizeof
cs
.
desc
/
sizeof
cs
.
desc
[
0
];
for
(
int
i
=
0
;
i
<
desc_count
;
++
i
)
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
i
+
14
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
text
=
strBuffer
;
cs
.
desc
[
i
]
=
strBuffer
;
}
constexpr
int
desc_count
=
sizeof
cs
.
desc
/
sizeof
cs
.
desc
[
0
];
for
(
int
i
=
0
;
i
<
desc_count
;
++
i
)
{
if
(
const
char
*
text
=
(
const
char
*
)
sqlite3_column_text
(
pStmt
,
i
+
14
))
{
BufferIO
::
DecodeUTF8
(
text
,
strBuffer
);
cs
.
desc
[
i
]
=
strBuffer
;
}
}
}
}
}
else
if
(
step
!=
SQLITE_DONE
)
}
return
Error
(
pDB
,
pStmt
);
}
while
(
step
==
SQLITE_ROW
);
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
for
(
const
auto
&
entry
:
extra_setcode
)
{
for
(
const
auto
&
entry
:
extra_setcode
)
{
const
auto
&
code
=
entry
.
first
;
const
auto
&
code
=
entry
.
first
;
...
...
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