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
b7541e82
Commit
b7541e82
authored
Nov 21, 2024
by
Chen Bill
Committed by
GitHub
Nov 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DataManage: fix LoadStrings(IReadFile* reader) (#2619)
parent
edcd0805
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
gframe/data_manager.cpp
gframe/data_manager.cpp
+11
-11
gframe/game.h
gframe/game.h
+1
-0
No files found.
gframe/data_manager.cpp
View file @
b7541e82
...
...
@@ -111,23 +111,23 @@ bool DataManager::LoadStrings(const char* file) {
FILE
*
fp
=
fopen
(
file
,
"r"
);
if
(
!
fp
)
return
false
;
char
linebuf
[
256
]
;
while
(
fgets
(
linebuf
,
256
,
fp
))
{
char
linebuf
[
TEXT_LINE_SIZE
]{}
;
while
(
fgets
(
linebuf
,
sizeof
linebuf
,
fp
))
{
ReadStringConfLine
(
linebuf
);
}
fclose
(
fp
);
return
true
;
}
bool
DataManager
::
LoadStrings
(
IReadFile
*
reader
)
{
char
ch
[
2
]
=
" "
;
char
linebuf
[
256
]
=
""
;
while
(
reader
->
read
(
&
ch
[
0
]
,
1
))
{
if
(
ch
[
0
]
==
'\0'
)
char
ch
{}
;
std
::
string
linebuf
;
while
(
reader
->
read
(
&
ch
,
1
))
{
if
(
ch
==
'\0'
)
break
;
std
::
strcat
(
linebuf
,
ch
);
if
(
ch
[
0
]
==
'\n'
)
{
ReadStringConfLine
(
linebuf
);
linebuf
[
0
]
=
'\0'
;
linebuf
.
push_back
(
ch
);
if
(
ch
==
'\n'
||
linebuf
.
size
()
>=
TEXT_LINE_SIZE
-
1
)
{
ReadStringConfLine
(
linebuf
.
data
()
);
linebuf
.
clear
()
;
}
}
reader
->
drop
();
...
...
@@ -136,7 +136,7 @@ bool DataManager::LoadStrings(IReadFile* reader) {
void
DataManager
::
ReadStringConfLine
(
const
char
*
linebuf
)
{
if
(
linebuf
[
0
]
!=
'!'
)
return
;
char
strbuf
[
256
]{};
char
strbuf
[
TEXT_LINE_SIZE
]{};
int
value
{};
wchar_t
strBuffer
[
4096
]{};
if
(
sscanf
(
linebuf
,
"!%63s"
,
strbuf
)
!=
1
)
...
...
gframe/game.h
View file @
b7541e82
...
...
@@ -24,6 +24,7 @@
constexpr
int
DEFAULT_DUEL_RULE
=
5
;
constexpr
int
CONFIG_LINE_SIZE
=
1024
;
constexpr
int
TEXT_LINE_SIZE
=
256
;
namespace
ygo
{
...
...
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