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
Commits
1b59f4c6
Commit
1b59f4c6
authored
May 21, 2024
by
mercury233
Committed by
GitHub
May 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support search part of setname (#2546)
parent
07614071
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
11 deletions
+28
-11
gframe/client_card.h
gframe/client_card.h
+8
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+13
-4
gframe/data_manager.h
gframe/data_manager.h
+1
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+6
-6
No files found.
gframe/client_card.h
View file @
1b59f4c6
...
...
@@ -14,6 +14,14 @@ using CardData = card_data;
struct
CardDataC
:
card_data
{
unsigned
int
ot
{};
unsigned
int
category
{};
bool
is_setcodes
(
std
::
vector
<
uint32
>
values
)
const
{
for
(
auto
&
value
:
values
)
{
if
(
is_setcode
(
value
))
return
true
;
}
return
false
;
}
};
struct
CardString
{
std
::
wstring
name
;
...
...
gframe/data_manager.cpp
View file @
1b59f4c6
...
...
@@ -267,13 +267,22 @@ const wchar_t* DataManager::GetSetName(int code) {
return
NULL
;
return
csit
->
second
.
c_str
();
}
unsigned
int
DataManager
::
GetSetCode
(
const
wchar_t
*
setname
)
{
std
::
vector
<
unsigned
int
>
DataManager
::
GetSetCodes
(
std
::
wstring
setname
)
{
std
::
vector
<
unsigned
int
>
matchingCodes
;
for
(
auto
csit
=
_setnameStrings
.
begin
();
csit
!=
_setnameStrings
.
end
();
++
csit
)
{
auto
xpos
=
csit
->
second
.
find_first_of
(
L'|'
);
//setname|another setname or extra info
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
||
csit
->
second
.
compare
(
xpos
+
1
,
csit
->
second
.
length
(),
setname
)
==
0
)
return
csit
->
first
;
if
(
setname
.
size
()
<
2
)
{
if
(
csit
->
second
.
compare
(
0
,
xpos
,
setname
)
==
0
||
csit
->
second
.
compare
(
xpos
+
1
,
csit
->
second
.
length
(),
setname
)
==
0
)
matchingCodes
.
push_back
(
csit
->
first
);
}
else
{
if
(
csit
->
second
.
substr
(
0
,
xpos
).
find
(
setname
)
!=
std
::
wstring
::
npos
||
csit
->
second
.
substr
(
xpos
+
1
).
find
(
setname
)
!=
std
::
wstring
::
npos
)
{
matchingCodes
.
push_back
(
csit
->
first
);
}
}
}
return
0
;
return
matchingCodes
;
}
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
if
(
!
bracket
)
...
...
gframe/data_manager.h
View file @
1b59f4c6
...
...
@@ -30,7 +30,7 @@ public:
const
wchar_t
*
GetVictoryString
(
int
code
);
const
wchar_t
*
GetCounterName
(
int
code
);
const
wchar_t
*
GetSetName
(
int
code
);
unsigned
int
GetSetCode
(
const
wchar_t
*
setname
);
std
::
vector
<
unsigned
int
>
GetSetCodes
(
std
::
wstring
setname
);
const
wchar_t
*
GetNumString
(
int
num
,
bool
bracket
=
false
);
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
);
const
wchar_t
*
FormatAttribute
(
int
attribute
);
...
...
gframe/deck_con.cpp
View file @
1b59f4c6
...
...
@@ -1337,14 +1337,14 @@ void DeckBuilder::FilterCards() {
results
.
clear
();
struct
element_t
{
std
::
wstring
keyword
;
unsigned
int
setcode
;
std
::
vector
<
unsigned
int
>
setcodes
;
enum
class
type_t
{
all
,
name
,
setcode
}
type
;
bool
exclude
;
element_t
()
:
setcode
(
0
),
type
(
type_t
::
all
),
exclude
(
false
)
{}
element_t
()
:
type
(
type_t
::
all
),
exclude
(
false
)
{}
};
const
wchar_t
*
pstr
=
mainGame
->
ebCardName
->
getText
();
std
::
wstring
str
=
std
::
wstring
(
pstr
);
...
...
@@ -1385,7 +1385,7 @@ void DeckBuilder::FilterCards() {
element
.
keyword
=
str
.
substr
(
element_start
,
length
);
}
else
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
()
);
element
.
setcode
s
=
dataManager
.
GetSetCodes
(
element
.
keyword
);
query_elements
.
push_back
(
element
);
if
(
element_end
==
std
::
wstring
::
npos
)
break
;
...
...
@@ -1403,7 +1403,7 @@ void DeckBuilder::FilterCards() {
}
if
(
element_start
<
str
.
size
())
{
element
.
keyword
=
str
.
substr
(
element_start
);
element
.
setcode
=
dataManager
.
GetSetCode
(
element
.
keyword
.
c_str
()
);
element
.
setcode
s
=
dataManager
.
GetSetCodes
(
element
.
keyword
);
query_elements
.
push_back
(
element
);
}
}
...
...
@@ -1490,14 +1490,14 @@ void DeckBuilder::FilterCards() {
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
name
)
{
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
());
}
else
if
(
elements_iterator
->
type
==
element_t
::
type_t
::
setcode
)
{
match
=
elements_iterator
->
setcode
&&
data
.
is_setcode
(
elements_iterator
->
setcode
);
match
=
data
.
is_setcodes
(
elements_iterator
->
setcodes
);
}
else
{
int
trycode
=
BufferIO
::
GetVal
(
elements_iterator
->
keyword
.
c_str
());
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
if
(
!
tryresult
)
{
match
=
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
keyword
.
c_str
())
||
text
.
text
.
find
(
elements_iterator
->
keyword
)
!=
std
::
wstring
::
npos
||
(
elements_iterator
->
setcode
&&
data
.
is_setcode
(
elements_iterator
->
setcode
)
);
||
data
.
is_setcodes
(
elements_iterator
->
setcodes
);
}
else
{
match
=
data
.
code
==
trycode
||
data
.
alias
==
trycode
;
}
...
...
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