Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
9a880bc8
Commit
9a880bc8
authored
Nov 06, 2015
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sscanf fix
max len of text = 240 UTF8 char
parent
6e4bb1b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
gframe/data_manager.cpp
gframe/data_manager.cpp
+3
-3
gframe/game.cpp
gframe/game.cpp
+11
-17
No files found.
gframe/data_manager.cpp
View file @
9a880bc8
...
@@ -85,19 +85,19 @@ bool DataManager::LoadStrings(const char* file) {
...
@@ -85,19 +85,19 @@ bool DataManager::LoadStrings(const char* file) {
continue
;
continue
;
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
!
strcmp
(
strbuf
,
"system"
))
{
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %
99
[^
\n
]"
,
&
value
,
strbuf
);
sscanf
(
&
linebuf
[
7
],
"%d %
240
[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
wcscpy
(
pbuf
,
strBuffer
);
_sysStrings
[
value
]
=
pbuf
;
_sysStrings
[
value
]
=
pbuf
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %
99
[^
\n
]"
,
&
value
,
strbuf
);
sscanf
(
&
linebuf
[
8
],
"%x %
240
[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
wcscpy
(
pbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
pbuf
;
_victoryStrings
[
value
]
=
pbuf
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %
99
[^
\n
]"
,
&
value
,
strbuf
);
sscanf
(
&
linebuf
[
8
],
"%x %
240
[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
wcscpy
(
pbuf
,
strBuffer
);
...
...
gframe/game.cpp
View file @
9a880bc8
...
@@ -802,14 +802,23 @@ void Game::LoadConfig() {
...
@@ -802,14 +802,23 @@ void Game::LoadConfig() {
int
fsize
=
ftell
(
fp
);
int
fsize
=
ftell
(
fp
);
fseek
(
fp
,
0
,
SEEK_SET
);
fseek
(
fp
,
0
,
SEEK_SET
);
while
(
ftell
(
fp
)
<
fsize
)
{
while
(
ftell
(
fp
)
<
fsize
)
{
fgets
(
linebuf
,
25
0
,
fp
);
fgets
(
linebuf
,
25
6
,
fp
);
sscanf
(
linebuf
,
"%s = %
s
"
,
strbuf
,
valbuf
);
sscanf
(
linebuf
,
"%s = %
240[^
\n
]
"
,
strbuf
,
valbuf
);
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
gameConf
.
antialias
=
atoi
(
valbuf
);
gameConf
.
antialias
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"use_d3d"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"use_d3d"
))
{
gameConf
.
use_d3d
=
atoi
(
valbuf
)
>
0
;
gameConf
.
use_d3d
=
atoi
(
valbuf
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"errorlog"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"errorlog"
))
{
enable_log
=
atoi
(
valbuf
);
enable_log
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"nickname"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
nickname
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"gamename"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
gamename
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastdeck"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastdeck
,
64
);
}
else
if
(
!
strcmp
(
strbuf
,
"textfont"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"textfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
int
textfontsize
;
int
textfontsize
;
...
@@ -830,21 +839,6 @@ void Game::LoadConfig() {
...
@@ -830,21 +839,6 @@ void Game::LoadConfig() {
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
}
else
{
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %99[^
\n
]"
,
strbuf
,
valbuf
);
if
(
!
strcmp
(
strbuf
,
"nickname"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
nickname
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"gamename"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
gamename
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastdeck"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lastdeck
,
64
);
}
}
}
}
}
fclose
(
fp
);
fclose
(
fp
);
...
...
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