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
nanahira
ygopro
Commits
3cea5c89
Commit
3cea5c89
authored
Jan 12, 2025
by
Chen Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move deck sort functions to DataManager
parent
b02c18a8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
81 deletions
+82
-81
gframe/client_card.cpp
gframe/client_card.cpp
+0
-68
gframe/client_card.h
gframe/client_card.h
+0
-5
gframe/data_manager.cpp
gframe/data_manager.cpp
+68
-0
gframe/data_manager.h
gframe/data_manager.h
+5
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+7
-7
gframe/deck_con.h
gframe/deck_con.h
+1
-1
gframe/drawing.cpp
gframe/drawing.cpp
+1
-0
No files found.
gframe/client_card.cpp
View file @
3cea5c89
...
...
@@ -243,72 +243,4 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
return
c1
->
sequence
<
c2
->
sequence
;
}
}
bool
ClientCard
::
deck_sort_lv
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
ClientCard
::
deck_sort_atk
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
ClientCard
::
deck_sort_def
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
ClientCard
::
deck_sort_name
(
code_pointer
p1
,
code_pointer
p2
)
{
const
wchar_t
*
name1
=
dataManager
.
GetName
(
p1
->
first
);
const
wchar_t
*
name2
=
dataManager
.
GetName
(
p2
->
first
);
int
res
=
wcscmp
(
name1
,
name2
);
if
(
res
!=
0
)
return
res
<
0
;
return
p1
->
first
<
p2
->
first
;
}
}
gframe/client_card.h
View file @
3cea5c89
...
...
@@ -2,7 +2,6 @@
#define CLIENT_CARD_H
#include "config.h"
#include "data_manager.h"
#include <vector>
#include <set>
#include <map>
...
...
@@ -81,10 +80,6 @@ public:
void
ClearTarget
();
void
ClearData
();
static
bool
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
);
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_atk
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_def
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_name
(
code_pointer
l1
,
code_pointer
l2
);
};
}
...
...
gframe/data_manager.cpp
View file @
3cea5c89
...
...
@@ -444,5 +444,73 @@ unsigned char* DataManager::DefaultScriptReader(const char* script_name, int* sl
*
slen
=
(
int
)
len
;
return
scriptBuffer
;
}
bool
DataManager
::
deck_sort_lv
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
DataManager
::
deck_sort_atk
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
DataManager
::
deck_sort_def
(
code_pointer
p1
,
code_pointer
p2
)
{
if
((
p1
->
second
.
type
&
0x7
)
!=
(
p2
->
second
.
type
&
0x7
))
return
(
p1
->
second
.
type
&
0x7
)
<
(
p2
->
second
.
type
&
0x7
);
if
((
p1
->
second
.
type
&
0x7
)
==
1
)
{
if
(
p1
->
second
.
defense
!=
p2
->
second
.
defense
)
return
p1
->
second
.
defense
>
p2
->
second
.
defense
;
if
(
p1
->
second
.
attack
!=
p2
->
second
.
attack
)
return
p1
->
second
.
attack
>
p2
->
second
.
attack
;
if
(
p1
->
second
.
level
!=
p2
->
second
.
level
)
return
p1
->
second
.
level
>
p2
->
second
.
level
;
int
type1
=
(
p1
->
second
.
type
&
0x48020c0
)
?
(
p1
->
second
.
type
&
0x48020c1
)
:
(
p1
->
second
.
type
&
0x31
);
int
type2
=
(
p2
->
second
.
type
&
0x48020c0
)
?
(
p2
->
second
.
type
&
0x48020c1
)
:
(
p2
->
second
.
type
&
0x31
);
if
(
type1
!=
type2
)
return
type1
<
type2
;
return
p1
->
first
<
p2
->
first
;
}
if
((
p1
->
second
.
type
&
0xfffffff8
)
!=
(
p2
->
second
.
type
&
0xfffffff8
))
return
(
p1
->
second
.
type
&
0xfffffff8
)
<
(
p2
->
second
.
type
&
0xfffffff8
);
return
p1
->
first
<
p2
->
first
;
}
bool
DataManager
::
deck_sort_name
(
code_pointer
p1
,
code_pointer
p2
)
{
const
wchar_t
*
name1
=
dataManager
.
GetName
(
p1
->
first
);
const
wchar_t
*
name2
=
dataManager
.
GetName
(
p2
->
first
);
int
res
=
wcscmp
(
name1
,
name2
);
if
(
res
!=
0
)
return
res
<
0
;
return
p1
->
first
<
p2
->
first
;
}
}
gframe/data_manager.h
View file @
3cea5c89
...
...
@@ -91,6 +91,11 @@ public:
static
irr
::
io
::
IFileSystem
*
FileSystem
;
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_atk
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_def
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_name
(
code_pointer
l1
,
code_pointer
l2
);
private:
std
::
unordered_map
<
unsigned
int
,
CardDataC
>
_datas
;
std
::
unordered_map
<
unsigned
int
,
CardString
>
_strings
;
...
...
gframe/deck_con.cpp
View file @
3cea5c89
...
...
@@ -150,9 +150,9 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_SORT_DECK
:
{
std
::
sort
(
deckManager
.
current_deck
.
main
.
begin
(),
deckManager
.
current_deck
.
main
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
extra
.
begin
(),
deckManager
.
current_deck
.
extra
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
side
.
begin
(),
deckManager
.
current_deck
.
side
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
main
.
begin
(),
deckManager
.
current_deck
.
main
.
end
(),
DataManager
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
extra
.
begin
(),
deckManager
.
current_deck
.
extra
.
end
(),
DataManager
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
side
.
begin
(),
deckManager
.
current_deck
.
side
.
end
(),
DataManager
::
deck_sort_lv
);
break
;
}
case
BUTTON_SHUFFLE_DECK
:
{
...
...
@@ -1572,16 +1572,16 @@ void DeckBuilder::SortList() {
}
switch
(
mainGame
->
cbSortType
->
getSelected
())
{
case
0
:
std
::
sort
(
left
,
results
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
left
,
results
.
end
(),
DataManager
::
deck_sort_lv
);
break
;
case
1
:
std
::
sort
(
left
,
results
.
end
(),
ClientCard
::
deck_sort_atk
);
std
::
sort
(
left
,
results
.
end
(),
DataManager
::
deck_sort_atk
);
break
;
case
2
:
std
::
sort
(
left
,
results
.
end
(),
ClientCard
::
deck_sort_def
);
std
::
sort
(
left
,
results
.
end
(),
DataManager
::
deck_sort_def
);
break
;
case
3
:
std
::
sort
(
left
,
results
.
end
(),
ClientCard
::
deck_sort_name
);
std
::
sort
(
left
,
results
.
end
(),
DataManager
::
deck_sort_name
);
break
;
}
}
...
...
gframe/deck_con.h
View file @
3cea5c89
...
...
@@ -4,7 +4,7 @@
#include "config.h"
#include <unordered_map>
#include <vector>
#include "
client_card
.h"
#include "
data_manager
.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
...
...
gframe/drawing.cpp
View file @
3cea5c89
#include "game.h"
#include "client_card.h"
#include "materials.h"
#include "image_manager.h"
#include "deck_manager.h"
...
...
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