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
cca64468
Commit
cca64468
authored
Jan 13, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'salix5/patch-dm' into server-develop
parents
d57ed8da
639eb65e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
123 additions
and
115 deletions
+123
-115
gframe/client_card.cpp
gframe/client_card.cpp
+0
-69
gframe/client_card.h
gframe/client_card.h
+0
-27
gframe/data_manager.cpp
gframe/data_manager.cpp
+70
-2
gframe/data_manager.h
gframe/data_manager.h
+40
-6
gframe/deck_con.cpp
gframe/deck_con.cpp
+7
-7
gframe/deck_con.h
gframe/deck_con.h
+2
-2
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+0
-1
gframe/deck_manager.h
gframe/deck_manager.h
+1
-1
gframe/drawing.cpp
gframe/drawing.cpp
+1
-0
gframe/single_duel.h
gframe/single_duel.h
+1
-0
gframe/tag_duel.h
gframe/tag_duel.h
+1
-0
No files found.
gframe/client_card.cpp
View file @
cca64468
#include "client_card.h"
#include "client_field.h"
#include "data_manager.h"
#include "game.h"
namespace
ygo
{
...
...
@@ -244,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 @
cca64468
...
...
@@ -2,35 +2,12 @@
#define CLIENT_CARD_H
#include "config.h"
#include "../ocgcore/card_data.h"
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
namespace
ygo
{
using
CardData
=
card_data
;
struct
CardDataC
:
card_data
{
unsigned
int
ot
{};
unsigned
int
category
{};
bool
is_setcodes
(
std
::
vector
<
uint32_t
>
values
)
const
{
for
(
auto
&
value
:
values
)
{
if
(
is_setcode
(
value
))
return
true
;
}
return
false
;
}
};
struct
CardString
{
std
::
wstring
name
;
std
::
wstring
text
;
std
::
wstring
desc
[
16
];
};
typedef
std
::
unordered_map
<
unsigned
int
,
CardDataC
>::
const_iterator
code_pointer
;
typedef
std
::
unordered_map
<
unsigned
int
,
CardString
>::
const_iterator
string_pointer
;
class
ClientCard
{
public:
#ifndef YGOPRO_SERVER_MODE
...
...
@@ -104,10 +81,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
);
#endif //YGOPRO_SERVER_MODE
};
...
...
gframe/data_manager.cpp
View file @
cca64468
...
...
@@ -10,7 +10,7 @@ namespace ygo {
const
wchar_t
*
DataManager
::
unknown_string
=
L"???"
;
unsigned
char
DataManager
::
scriptBuffer
[
0x100000
]
=
{};
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
IFileSystem
*
DataManager
::
FileSystem
=
nullptr
;
irr
::
io
::
IFileSystem
*
DataManager
::
FileSystem
=
nullptr
;
#endif
DataManager
dataManager
;
...
...
@@ -142,7 +142,7 @@ bool DataManager::LoadStrings(const char* file) {
return
true
;
}
#ifndef YGOPRO_SERVER_MODE
bool
DataManager
::
LoadStrings
(
IReadFile
*
reader
)
{
bool
DataManager
::
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
)
{
char
ch
{};
std
::
string
linebuf
;
while
(
reader
->
read
(
&
ch
,
1
))
{
...
...
@@ -488,5 +488,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 @
cca64468
#ifndef DATAMANAGER_H
#define DATAMANAGER_H
#include "config.h"
#include <unordered_map>
#include <vector>
#include <string>
#include <sqlite3.h>
#include "client_card.h"
#include "../ocgcore/card_data.h"
namespace
irr
{
namespace
io
{
class
IReadFile
;
class
IFileSystem
;
}
}
namespace
ygo
{
constexpr
int
MAX_STRING_ID
=
0x7ff
;
constexpr
unsigned
int
MIN_CARD_ID
=
(
unsigned
int
)(
MAX_STRING_ID
+
1
)
>>
4
;
constexpr
int
MAX_STRING_ID
=
0x7ff
;
constexpr
unsigned
int
MIN_CARD_ID
=
(
unsigned
int
)(
MAX_STRING_ID
+
1
)
>>
4
;
using
CardData
=
card_data
;
struct
CardDataC
:
card_data
{
uint32_t
ot
{};
uint32_t
category
{};
bool
is_setcodes
(
std
::
vector
<
uint32_t
>
values
)
const
{
for
(
auto
&
value
:
values
)
{
if
(
is_setcode
(
value
))
return
true
;
}
return
false
;
}
};
struct
CardString
{
std
::
wstring
name
;
std
::
wstring
text
;
std
::
wstring
desc
[
16
];
};
using
code_pointer
=
std
::
unordered_map
<
unsigned
int
,
CardDataC
>::
const_iterator
;
using
string_pointer
=
std
::
unordered_map
<
unsigned
int
,
CardString
>::
const_iterator
;
class
DataManager
{
public:
...
...
@@ -17,7 +46,7 @@ public:
bool
LoadDB
(
const
wchar_t
*
wfile
);
bool
LoadStrings
(
const
char
*
file
);
#ifndef YGOPRO_SERVER_MODE
bool
LoadStrings
(
IReadFile
*
reader
);
bool
LoadStrings
(
irr
::
io
::
IReadFile
*
reader
);
#endif
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
...
...
@@ -63,9 +92,14 @@ public:
//read by fread
static
unsigned
char
*
DefaultScriptReader
(
const
char
*
script_name
,
int
*
slen
);
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
static
IFileSystem
*
FileSystem
;
static
irr
::
io
::
IFileSystem
*
FileSystem
;
#endif
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 @
cca64468
...
...
@@ -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 @
cca64468
...
...
@@ -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
{
...
...
@@ -41,7 +41,7 @@ public:
void
pop_side
(
int
seq
);
bool
check_limit
(
code_pointer
pointer
);
long
long
filter_effect
{};
unsigned
long
long
filter_effect
{};
unsigned
int
filter_type
{};
unsigned
int
filter_type2
{};
unsigned
int
filter_attrib
{};
...
...
gframe/deck_manager.cpp
View file @
cca64468
#include "deck_manager.h"
#include "myfilesystem.h"
#include "data_manager.h"
#include "network.h"
#include "game.h"
...
...
gframe/deck_manager.h
View file @
cca64468
...
...
@@ -2,7 +2,7 @@
#define DECKMANAGER_H
#include "config.h"
#include "
client_card
.h"
#include "
data_manager
.h"
#include <unordered_map>
#include <vector>
#include <sstream>
...
...
gframe/drawing.cpp
View file @
cca64468
#include "game.h"
#include "client_card.h"
#include "materials.h"
#include "image_manager.h"
#include "deck_manager.h"
...
...
gframe/single_duel.h
View file @
cca64468
#ifndef SINGLE_DUEL_H
#define SINGLE_DUEL_H
#include <set>
#include "network.h"
#include "deck_manager.h"
#include "replay.h"
...
...
gframe/tag_duel.h
View file @
cca64468
#ifndef TAG_DUEL_H
#define TAG_DUEL_H
#include <set>
#include "network.h"
#include "deck_manager.h"
#include "replay.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