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
MobiusMei
ygopro
Commits
842c7a08
Commit
842c7a08
authored
Jun 18, 2017
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use std::wstring
parent
85f83185
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
31 deletions
+23
-31
gframe/data_manager.cpp
gframe/data_manager.cpp
+18
-24
gframe/data_manager.h
gframe/data_manager.h
+5
-5
gframe/game.cpp
gframe/game.cpp
+0
-2
No files found.
gframe/data_manager.cpp
View file @
842c7a08
...
...
@@ -89,28 +89,20 @@ bool DataManager::LoadStrings(const char* file) {
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_sysStrings
[
value
]
=
pbuf
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
pbuf
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_counterStrings
[
value
]
=
pbuf
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
);
//using tab for comment
int
len
=
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
wchar_t
*
pbuf
=
new
wchar_t
[
len
+
1
];
wcscpy
(
pbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
pbuf
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
}
}
fclose
(
fp
);
...
...
@@ -175,33 +167,35 @@ const wchar_t* DataManager::GetDesc(int strCode) {
return
unknown_string
;
}
const
wchar_t
*
DataManager
::
GetSysString
(
int
code
)
{
if
(
code
<
0
||
code
>=
2048
||
_sysStrings
[
code
]
==
0
)
if
(
code
<
0
||
code
>=
2048
)
return
unknown_string
;
return
_sysStrings
[
code
];
auto
csit
=
_sysStrings
.
find
(
code
);
if
(
csit
==
_sysStrings
.
end
())
return
unknown_string
;
return
csit
->
second
.
c_str
();
}
const
wchar_t
*
DataManager
::
GetVictoryString
(
int
code
)
{
auto
csit
=
_victoryStrings
.
find
(
code
);
if
(
csit
==
_victoryStrings
.
end
())
return
unknown_string
;
return
csit
->
second
;
return
csit
->
second
.
c_str
()
;
}
const
wchar_t
*
DataManager
::
GetCounterName
(
int
code
)
{
auto
csit
=
_counterStrings
.
find
(
code
);
if
(
csit
==
_counterStrings
.
end
())
return
unknown_string
;
return
csit
->
second
;
return
csit
->
second
.
c_str
()
;
}
const
wchar_t
*
DataManager
::
GetSetName
(
int
code
)
{
auto
csit
=
_setnameStrings
.
find
(
code
);
if
(
csit
==
_setnameStrings
.
end
())
return
NULL
;
return
csit
->
second
;
return
csit
->
second
.
c_str
()
;
}
unsigned
int
DataManager
::
GetSetCode
(
const
wchar_t
*
setname
)
{
wchar_t
strbuff
[
256
];
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
++
csit
)
{
swscanf
(
csit
->
second
,
L"%[^|]"
,
strbuff
);
//setname|extra info
if
(
wcscmp
(
strbuff
,
setname
)
==
0
)
auto
xpos
=
csit
->
second
.
find_first_of
(
L'|'
);
//setname|extra info
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
)
return
csit
->
first
;
}
return
0
;
...
...
gframe/data_manager.h
View file @
842c7a08
...
...
@@ -35,11 +35,11 @@ public:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
wchar_t
*>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
wchar_t
*
_sysStrings
[
2048
];
wchar_t
numStrings
[
256
][
4
];
wchar_t
numBuffer
[
6
];
wchar_t
attBuffer
[
128
];
...
...
@@ -51,7 +51,7 @@ public:
static
wchar_t
strBuffer
[
4096
];
static
const
wchar_t
*
unknown_string
;
static
int
CardReader
(
int
,
void
*
);
};
extern
DataManager
dataManager
;
...
...
gframe/game.cpp
View file @
842c7a08
...
...
@@ -46,8 +46,6 @@ bool Game::Initialize() {
is_building
=
false
;
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
memset
(
chatTiming
,
0
,
sizeof
(
chatTiming
));
for
(
int
i
=
0
;
i
<
2048
;
++
i
)
dataManager
.
_sysStrings
[
i
]
=
0
;
deckManager
.
LoadLFList
();
driver
=
device
->
getVideoDriver
();
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
...
...
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