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
wind2009
ygopro
Commits
c18a17fd
Commit
c18a17fd
authored
May 21, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-utf8' of github.com:salix5/ygopro into develop
parents
9c19a2dc
5eab7420
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
119 additions
and
99 deletions
+119
-99
gframe/bufferio.h
gframe/bufferio.h
+72
-46
gframe/data_manager.cpp
gframe/data_manager.cpp
+2
-2
gframe/deck_con.cpp
gframe/deck_con.cpp
+4
-2
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/image_manager.cpp
gframe/image_manager.cpp
+33
-33
gframe/irrUString.h
gframe/irrUString.h
+2
-6
gframe/lzma/Types.h
gframe/lzma/Types.h
+0
-6
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+2
-2
gframe/myfilesystem.h
gframe/myfilesystem.h
+1
-1
gframe/network.h
gframe/network.h
+2
-0
No files found.
gframe/bufferio.h
View file @
c18a17fd
...
...
@@ -59,67 +59,93 @@ public:
return
l
;
}
// UTF-16/UTF-32 to UTF-8
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
*
str
)
{
template
<
size_t
N
>
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
(
&
str
)[
N
])
{
char
*
pstr
=
str
;
while
(
*
wsrc
!=
0
)
{
if
(
*
wsrc
<
0x80
)
{
*
str
=
(
char
)
*
wsrc
;
++
str
;
}
else
if
(
*
wsrc
<
0x800
)
{
str
[
0
]
=
((
*
wsrc
>>
6
)
&
0x1f
)
|
0xc0
;
str
[
1
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
str
+=
2
;
}
else
if
(
*
wsrc
<
0x10000
&&
(
*
wsrc
<
0xd800
||
*
wsrc
>
0xdfff
))
{
str
[
0
]
=
((
*
wsrc
>>
12
)
&
0xf
)
|
0xe0
;
str
[
1
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
str
+=
3
;
}
else
{
#ifdef _WIN32
unsigned
unicode
=
0
;
unicode
|=
(
*
wsrc
++
&
0x3ff
)
<<
10
;
unicode
|=
*
wsrc
&
0x3ff
;
unicode
+=
0x10000
;
str
[
0
]
=
((
unicode
>>
18
)
&
0x7
)
|
0xf0
;
str
[
1
]
=
((
unicode
>>
12
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
unicode
>>
6
)
&
0x3f
)
|
0x80
;
str
[
3
]
=
((
unicode
)
&
0x3f
)
|
0x80
;
#else
str
[
0
]
=
((
*
wsrc
>>
18
)
&
0x7
)
|
0xf0
;
str
[
1
]
=
((
*
wsrc
>>
12
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
str
[
3
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
#endif // _WIN32
str
+=
4
;
while
(
*
wsrc
!=
0
)
{
unsigned
cur
=
*
wsrc
;
int
codepoint_size
=
0
;
if
(
cur
<
0x80U
)
codepoint_size
=
1
;
else
if
(
cur
<
0x800U
)
codepoint_size
=
2
;
else
if
(
cur
<
0x10000U
&&
(
cur
<
0xd800U
||
cur
>
0xdfffU
))
codepoint_size
=
3
;
else
codepoint_size
=
4
;
if
(
pstr
-
str
+
codepoint_size
>
N
-
1
)
break
;
switch
(
codepoint_size
)
{
case
1
:
*
pstr
=
(
char
)
cur
;
break
;
case
2
:
pstr
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
pstr
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
3
:
pstr
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
pstr
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
case
4
:
if
(
sizeof
(
wchar_t
)
==
2
)
{
cur
=
0
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
}
pstr
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
pstr
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
pstr
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
pstr
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
break
;
default:
break
;
}
pstr
+=
codepoint_size
;
wsrc
++
;
}
*
str
=
0
;
return
str
-
p
str
;
*
p
str
=
0
;
return
pstr
-
str
;
}
// UTF-8 to UTF-16/UTF-32
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
*
wstr
)
{
template
<
size_t
N
>
static
int
DecodeUTF8
(
const
char
*
src
,
wchar_t
(
&
wstr
)[
N
])
{
const
char
*
p
=
src
;
wchar_t
*
wp
=
wstr
;
while
(
*
p
!=
0
)
{
if
((
*
p
&
0x80
)
==
0
)
{
const
unsigned
cur
=
(
unsigned
)
*
p
&
0xff
;
int
codepoint_size
=
0
;
if
((
cur
&
0xf8
)
==
0xf0
)
{
if
(
sizeof
(
wchar_t
)
==
2
)
codepoint_size
=
2
;
else
codepoint_size
=
1
;
}
else
codepoint_size
=
1
;
if
(
wp
-
wstr
+
codepoint_size
>
N
-
1
)
break
;
if
((
cur
&
0x80
)
==
0
)
{
*
wp
=
*
p
;
p
++
;
}
else
if
((
*
p
&
0xe0
)
==
0xc0
)
{
}
else
if
((
cur
&
0xe0
)
==
0xc0
)
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x1f
)
<<
6
)
|
((
unsigned
)
p
[
1
]
&
0x3f
);
p
+=
2
;
}
else
if
((
*
p
&
0xf0
)
==
0xe0
)
{
}
else
if
((
cur
&
0xf0
)
==
0xe0
)
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0xf
)
<<
12
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
2
]
&
0x3f
);
p
+=
3
;
}
else
if
((
*
p
&
0xf8
)
==
0xf0
)
{
#ifdef _WIN32
unsigned
unicode
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
unicode
-=
0x10000
;
*
wp
++
=
(
unicode
>>
10
)
|
0xd800
;
*
wp
=
(
unicode
&
0x3ff
)
|
0xdc00
;
#else
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
#endif // _WIN32
}
else
if
((
cur
&
0xf8
)
==
0xf0
)
{
if
(
sizeof
(
wchar_t
)
==
2
)
{
unsigned
unicode
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
unicode
-=
0x10000
;
*
wp
++
=
(
unicode
>>
10
)
|
0xd800
;
*
wp
=
(
unicode
&
0x3ff
)
|
0xdc00
;
}
else
{
*
wp
=
(((
unsigned
)
p
[
0
]
&
0x7
)
<<
18
)
|
(((
unsigned
)
p
[
1
]
&
0x3f
)
<<
12
)
|
(((
unsigned
)
p
[
2
]
&
0x3f
)
<<
6
)
|
((
unsigned
)
p
[
3
]
&
0x3f
);
}
p
+=
4
;
}
else
p
++
;
...
...
gframe/data_manager.cpp
View file @
c18a17fd
...
...
@@ -415,12 +415,12 @@ byte* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
}
byte
*
DataManager
::
ScriptReaderExSingle
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
)
{
char
sname
[
256
];
s
printf
(
sname
,
"%s%s"
,
path
,
script_name
+
pre_len
);
//default script name: ./script/c%d.lua
s
nprintf
(
sname
,
sizeof
sname
,
"%s%s"
,
path
,
script_name
+
pre_len
);
//default script name: ./script/c%d.lua
return
ScriptReader
(
sname
,
slen
);
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
#ifdef _WIN32
wchar_t
fname
[
256
];
wchar_t
fname
[
256
]
{}
;
BufferIO
::
DecodeUTF8
(
script_name
,
fname
);
IReadFile
*
reader
=
FileSystem
->
createAndOpenFile
(
fname
);
#else
...
...
gframe/deck_con.cpp
View file @
c18a17fd
...
...
@@ -233,9 +233,11 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wDeckCode
);
if
(
prev_operation
==
BUTTON_DECK_CODE
)
{
Deck
new_deck
;
char
pcode
[
1024
];
BufferIO
::
EncodeUTF8
(
mainGame
->
ebDeckCode
->
getText
(),
pcode
);
unsigned
char
deck_code
[
1024
];
BufferIO
::
EncodeUTF8
(
mainGame
->
ebDeckCode
->
getText
(),
(
char
*
)
deck_code
);
if
(
deckManager
.
LoadDeckFromCode
(
new_deck
,
deck_code
,
strlen
(
(
char
*
)
deck_
code
)))
memcpy
(
deck_code
,
pcode
,
1024
);
if
(
deckManager
.
LoadDeckFromCode
(
new_deck
,
deck_code
,
strlen
(
p
code
)))
deckManager
.
current_deck
=
new_deck
;
else
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1389
));
...
...
gframe/game.cpp
View file @
c18a17fd
...
...
@@ -1973,7 +1973,7 @@ void Game::AddDebugMsg(const char* msg) {
}
if
(
enable_log
&
0x2
)
{
char
msgbuf
[
1040
];
s
printf
(
msgbuf
,
"[Script Error]: %s"
,
msg
);
s
nprintf
(
msgbuf
,
sizeof
msgbuf
,
"[Script Error]: %s"
,
msg
);
ErrorLog
(
msgbuf
);
}
}
...
...
gframe/image_manager.cpp
View file @
c18a17fd
...
...
@@ -323,26 +323,26 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
auto
tit
=
tMap
[
fit
?
1
:
0
].
find
(
code
);
if
(
tit
==
tMap
[
fit
?
1
:
0
].
end
())
{
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
==
NULL
)
{
s
printf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
NULL
&&
!
mainGame
->
gameConf
.
use_image_scale
)
{
...
...
@@ -366,10 +366,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
}
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
if
(
srcimg
==
NULL
)
{
s
printf
(
file
,
"pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
if
(
srcimg
==
NULL
)
{
...
...
@@ -395,49 +395,49 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/thumbnail/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.png"
,
code
);
irr
::
video
::
IImage
*
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
if
(
img
==
NULL
)
{
s
printf
(
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.jpg"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.jpg"
),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/thumbnail/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.png"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
&&
mainGame
->
gameConf
.
use_image_scale
)
{
s
printf
(
file
,
"expansions/pics/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
if
(
img
==
NULL
)
{
s
printf
(
file
,
"expansions/pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.jpg"
),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.png"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
...
...
@@ -483,7 +483,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if
(
lit
!=
tThumbLoading
.
end
())
{
if
(
lit
->
second
!=
NULL
)
{
char
file
[
256
];
s
printf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
texture
=
driver
->
addTexture
(
file
,
lit
->
second
);
// textures must be added in the main thread due to OpenGL
lit
->
second
->
drop
();
tThumb
[
code
]
=
texture
;
...
...
@@ -513,26 +513,26 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/field/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
NULL
)
{
s
printf
(
file
,
"expansions/pics/field/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.jpg"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/field/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/field/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
NULL
)
{
tFields
[
code
]
=
NULL
;
...
...
@@ -557,26 +557,26 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
s
printf
(
file
,
"expansions/pics/field/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
NULL
)
{
s
printf
(
file
,
"expansions/pics/field/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.jpg"
),
code
);
s
nprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.jpg"
),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/field/%d.png"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.png"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
NULL
)
{
s
printf
(
file
,
"pics/field/%d.jpg"
,
code
);
s
nprintf
(
file
,
sizeof
file
,
"pics/field/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
if
(
img
==
NULL
)
{
tFields
[
code
]
=
NULL
;
...
...
gframe/irrUString.h
View file @
c18a17fd
...
...
@@ -31,12 +31,8 @@
#ifndef __IRR_USTRING_H_INCLUDED__
#define __IRR_USTRING_H_INCLUDED__
#if (__cplusplus > 199711L) || (_MSC_VER >= 1600) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define USTRING_CPP0X
# if defined(__GXX_EXPERIMENTAL_CXX0X__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)))
# define USTRING_CPP0X_NEWLITERALS
# endif
#endif
#define USTRING_CPP0X
#define USTRING_CPP0X_NEWLITERALS
#include <stdio.h>
#include <string.h>
...
...
gframe/lzma/Types.h
View file @
c18a17fd
...
...
@@ -74,15 +74,9 @@ typedef unsigned long UInt64;
#else
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef
__int64
Int64
;
typedef
unsigned
__int64
UInt64
;
#define UINT64_CONST(n) n
#else
typedef
long
long
int
Int64
;
typedef
unsigned
long
long
int
UInt64
;
#define UINT64_CONST(n) n ## ULL
#endif
#endif
...
...
gframe/menu_handler.cpp
View file @
c18a17fd
...
...
@@ -372,9 +372,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
char
arg2
[
8
];
s
printf
(
arg2
,
"%d"
,
flag
);
s
nprintf
(
arg2
,
sizeof
arg2
,
"%d"
,
flag
);
char
arg3
[
8
];
s
printf
(
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
s
nprintf
(
arg3
,
sizeof
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
NULL
);
exit
(
0
);
}
else
{
...
...
gframe/myfilesystem.h
View file @
c18a17fd
...
...
@@ -176,7 +176,7 @@ public:
bool
success
=
true
;
TraversalDir
(
dir
,
[
dir
,
&
success
](
const
char
*
name
,
bool
isdir
)
{
char
full_path
[
256
];
s
printf
(
full_path
,
"%s/%s"
,
dir
,
name
);
s
nprintf
(
full_path
,
sizeof
full_path
,
"%s/%s"
,
dir
,
name
);
if
(
isdir
)
{
if
(
!
DeleteDir
(
full_path
))
...
...
gframe/network.h
View file @
c18a17fd
...
...
@@ -54,6 +54,8 @@ struct CTOS_JoinGame {
unsigned
short
version
;
unsigned
int
gameid
;
unsigned
short
pass
[
20
];
unsigned
short
client_type
[
20
];
unsigned
short
hostname
[
253
];
};
struct
CTOS_Kick
{
unsigned
char
pos
;
...
...
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