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
39475480
Commit
39475480
authored
Jan 28, 2026
by
salix5
Committed by
GitHub
Jan 28, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor class DataManager (#2956)
parent
aa9652ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
40 deletions
+38
-40
gframe/client_field.cpp
gframe/client_field.cpp
+11
-16
gframe/data_manager.cpp
gframe/data_manager.cpp
+13
-10
gframe/data_manager.h
gframe/data_manager.h
+4
-0
gframe/event_handler.cpp
gframe/event_handler.cpp
+10
-14
No files found.
gframe/client_field.cpp
View file @
39475480
...
...
@@ -456,17 +456,15 @@ void ClientField::ShowSelectCard(bool buttonok, bool is_continuous) {
if
(
mainGame
->
dInfo
.
curMsg
!=
MSG_SORT_CARD
)
{
// text
wchar_t
formatBuffer
[
2048
];
if
(
select_continuous
)
if
(
select_continuous
)
myswprintf
(
formatBuffer
,
L"%ls"
,
dataManager
.
unknown_string
);
else
if
(
cant_check_grave
&&
selectable_cards
[
i
]
->
location
==
LOCATION_GRAVE
)
else
if
(
cant_check_grave
&&
selectable_cards
[
i
]
->
location
==
LOCATION_GRAVE
)
myswprintf
(
formatBuffer
,
L"%ls"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
location
,
0
));
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
overlayTarget
->
location
,
selectable_cards
[
i
]
->
overlayTarget
->
sequence
),
selectable_cards
[
i
]
->
overlayTarget
->
sequence
+
1
,
selectable_cards
[
i
]
->
sequence
+
1
);
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
overlayTarget
),
selectable_cards
[
i
]
->
overlayTarget
->
sequence
+
1
,
selectable_cards
[
i
]
->
sequence
+
1
);
else
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
location
,
selectable_cards
[
i
]
->
sequence
),
selectable_cards
[
i
]
->
sequence
+
1
);
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]),
selectable_cards
[
i
]
->
sequence
+
1
);
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
// color
if
(
selectable_cards
[
i
]
->
is_selected
)
...
...
@@ -542,8 +540,7 @@ void ClientField::ShowChainCard() {
mainGame
->
btnCardSelect
[
i
]
->
setPressed
(
false
);
mainGame
->
btnCardSelect
[
i
]
->
setVisible
(
true
);
wchar_t
formatBuffer
[
2048
];
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
location
,
selectable_cards
[
i
]
->
sequence
),
selectable_cards
[
i
]
->
sequence
+
1
);
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]),
selectable_cards
[
i
]
->
sequence
+
1
);
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
if
(
selectable_cards
[
i
]
->
owner
!=
selectable_cards
[
i
]
->
overlayTarget
->
controler
)
...
...
@@ -597,13 +594,11 @@ void ClientField::ShowLocationCard() {
mainGame
->
btnCardDisplay
[
i
]
->
setPressed
(
false
);
mainGame
->
btnCardDisplay
[
i
]
->
setVisible
(
true
);
wchar_t
formatBuffer
[
2048
];
if
(
display_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
display_cards
[
i
]
->
overlayTarget
->
location
,
display_cards
[
i
]
->
overlayTarget
->
sequence
),
display_cards
[
i
]
->
overlayTarget
->
sequence
+
1
,
display_cards
[
i
]
->
sequence
+
1
);
if
(
display_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
display_cards
[
i
]
->
overlayTarget
),
display_cards
[
i
]
->
overlayTarget
->
sequence
+
1
,
display_cards
[
i
]
->
sequence
+
1
);
else
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
display_cards
[
i
]
->
location
,
display_cards
[
i
]
->
sequence
),
display_cards
[
i
]
->
sequence
+
1
);
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
display_cards
[
i
]),
display_cards
[
i
]
->
sequence
+
1
);
mainGame
->
stDisplayPos
[
i
]
->
setText
(
formatBuffer
);
if
(
display_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
if
(
display_cards
[
i
]
->
owner
!=
display_cards
[
i
]
->
overlayTarget
->
controler
)
...
...
gframe/data_manager.cpp
View file @
39475480
#include "data_manager.h"
#include "game.h"
#include "client_card.h"
#include "spmemvfs/spmemvfs.h"
namespace
ygo
{
...
...
@@ -221,8 +222,6 @@ const wchar_t* DataManager::GetDesc(uint32_t strCode) const {
return
unknown_string
;
}
const
wchar_t
*
DataManager
::
GetSysString
(
int
code
)
const
{
if
(
code
<
0
||
code
>
MAX_STRING_ID
)
return
unknown_string
;
auto
csit
=
_sysStrings
.
find
(
code
);
if
(
csit
==
_sysStrings
.
end
())
return
unknown_string
;
...
...
@@ -280,11 +279,10 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
else
return
GetSysString
(
1009
);
}
int
i
=
1000
;
int
string_id
=
0
;
for
(
unsigned
filter
=
LOCATION_DECK
;
filter
<=
LOCATION_PZONE
;
filter
<<=
1
,
++
i
)
{
if
(
filter
==
location
)
{
string_id
=
i
;
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
if
(
(
0x1U
<<
i
)
==
location
)
{
string_id
=
STRING_ID_LOCATION
+
i
;
break
;
}
}
...
...
@@ -293,6 +291,11 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
else
return
unknown_string
;
}
const
wchar_t
*
DataManager
::
FormatLocation
(
ClientCard
*
card
)
const
{
if
(
!
card
)
return
unknown_string
;
return
FormatLocation
(
card
->
location
,
card
->
sequence
);
}
std
::
wstring
DataManager
::
FormatAttribute
(
unsigned
int
attribute
)
const
{
std
::
wstring
buffer
;
for
(
int
i
=
0
;
i
<
ATTRIBUTES_COUNT
;
++
i
)
{
...
...
@@ -303,7 +306,7 @@ std::wstring DataManager::FormatAttribute(unsigned int attribute) const {
}
}
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
)
;
buffer
=
unknown_string
;
return
buffer
;
}
std
::
wstring
DataManager
::
FormatRace
(
unsigned
int
race
)
const
{
...
...
@@ -316,7 +319,7 @@ std::wstring DataManager::FormatRace(unsigned int race) const {
}
}
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
)
;
buffer
=
unknown_string
;
return
buffer
;
}
std
::
wstring
DataManager
::
FormatType
(
unsigned
int
type
)
const
{
...
...
@@ -329,7 +332,7 @@ std::wstring DataManager::FormatType(unsigned int type) const {
}
}
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
)
;
buffer
=
unknown_string
;
return
buffer
;
}
std
::
wstring
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[])
const
{
...
...
@@ -343,7 +346,7 @@ std::wstring DataManager::FormatSetName(const uint16_t setcode[]) const {
buffer
.
append
(
setname
);
}
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
)
;
buffer
=
unknown_string
;
return
buffer
;
}
std
::
wstring
DataManager
::
FormatLinkMarker
(
unsigned
int
link_marker
)
const
{
...
...
gframe/data_manager.h
View file @
39475480
...
...
@@ -58,6 +58,8 @@ struct CardString {
using
code_pointer
=
std
::
unordered_map
<
uint32_t
,
CardDataC
>::
const_iterator
;
using
string_pointer
=
std
::
unordered_map
<
uint32_t
,
CardString
>::
const_iterator
;
class
ClientCard
;
class
DataManager
{
public:
DataManager
();
...
...
@@ -88,6 +90,7 @@ public:
std
::
vector
<
unsigned
int
>
GetSetCodes
(
std
::
wstring
setname
)
const
;
std
::
wstring
GetNumString
(
int
num
,
bool
bracket
=
false
)
const
;
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
)
const
;
const
wchar_t
*
FormatLocation
(
ClientCard
*
card
)
const
;
std
::
wstring
FormatAttribute
(
unsigned
int
attribute
)
const
;
std
::
wstring
FormatRace
(
unsigned
int
race
)
const
;
std
::
wstring
FormatType
(
unsigned
int
type
)
const
;
...
...
@@ -102,6 +105,7 @@ public:
const
wchar_t
*
unknown_string
{
L"???"
};
irr
::
io
::
IFileSystem
*
FileSystem
{};
static
constexpr
int
STRING_ID_LOCATION
=
1000
;
static
constexpr
int
STRING_ID_ATTRIBUTE
=
1010
;
static
constexpr
int
STRING_ID_RACE
=
1020
;
static
constexpr
int
STRING_ID_TYPE
=
1050
;
...
...
gframe/event_handler.cpp
View file @
39475480
...
...
@@ -905,17 +905,15 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else
myswprintf
(
formatBuffer
,
L""
);
}
else
{
if
(
select_continuous
)
if
(
select_continuous
)
myswprintf
(
formatBuffer
,
L"%ls"
,
dataManager
.
unknown_string
);
else
if
(
cant_check_grave
&&
selectable_cards
[
i
]
->
location
==
LOCATION_GRAVE
)
else
if
(
cant_check_grave
&&
selectable_cards
[
i
]
->
location
==
LOCATION_GRAVE
)
myswprintf
(
formatBuffer
,
L"%ls"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
]
->
location
,
0
));
else
if
(
selectable_cards
[
i
+
pos
]
->
location
==
LOCATION_OVERLAY
)
else
if
(
selectable_cards
[
i
+
pos
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
+
pos
]
->
overlayTarget
->
location
,
selectable_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
),
selectable_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
+
1
,
selectable_cards
[
i
+
pos
]
->
sequence
+
1
);
dataManager
.
FormatLocation
(
selectable_cards
[
i
+
pos
]
->
overlayTarget
),
selectable_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
+
1
,
selectable_cards
[
i
+
pos
]
->
sequence
+
1
);
else
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
+
pos
]
->
location
,
selectable_cards
[
i
+
pos
]
->
sequence
),
selectable_cards
[
i
+
pos
]
->
sequence
+
1
);
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
selectable_cards
[
i
+
pos
]),
selectable_cards
[
i
+
pos
]
->
sequence
+
1
);
}
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
// color
...
...
@@ -961,13 +959,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
btnCardDisplay
[
i
]
->
setImage
(
imageManager
.
tCover
[
display_cards
[
i
+
pos
]
->
controler
+
2
]);
mainGame
->
btnCardDisplay
[
i
]
->
setRelativePosition
(
irr
::
core
::
rect
<
irr
::
s32
>
(
30
+
i
*
125
,
55
,
30
+
120
+
i
*
125
,
225
));
wchar_t
formatBuffer
[
2048
];
if
(
display_cards
[
i
+
pos
]
->
location
==
LOCATION_OVERLAY
)
{
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
display_cards
[
i
+
pos
]
->
overlayTarget
->
location
,
display_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
),
display_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
+
1
,
display_cards
[
i
+
pos
]
->
sequence
+
1
);
}
else
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
display_cards
[
i
+
pos
]
->
location
,
display_cards
[
i
+
pos
]
->
sequence
),
display_cards
[
i
+
pos
]
->
sequence
+
1
);
if
(
display_cards
[
i
+
pos
]
->
location
==
LOCATION_OVERLAY
)
myswprintf
(
formatBuffer
,
L"%ls[%d](%d)"
,
dataManager
.
FormatLocation
(
display_cards
[
i
+
pos
]
->
overlayTarget
),
display_cards
[
i
+
pos
]
->
overlayTarget
->
sequence
+
1
,
display_cards
[
i
+
pos
]
->
sequence
+
1
);
else
myswprintf
(
formatBuffer
,
L"%ls[%d]"
,
dataManager
.
FormatLocation
(
display_cards
[
i
+
pos
]),
display_cards
[
i
+
pos
]
->
sequence
+
1
);
mainGame
->
stDisplayPos
[
i
]
->
setText
(
formatBuffer
);
if
(
display_cards
[
i
+
pos
]
->
location
==
LOCATION_OVERLAY
)
{
if
(
display_cards
[
i
+
pos
]
->
owner
!=
display_cards
[
i
+
pos
]
->
overlayTarget
->
controler
)
...
...
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