Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-core
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-core
Commits
8657c2f2
Commit
8657c2f2
authored
Dec 15, 2023
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add LEN_FAIL, LEN_HEADER
LEN_FAIL: wrong player id or wrong location
parent
04aa9301
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
ocgapi.cpp
ocgapi.cpp
+14
-12
ocgapi.h
ocgapi.h
+3
-1
No files found.
ocgapi.cpp
View file @
8657c2f2
...
@@ -177,26 +177,28 @@ extern "C" DECL_DLLEXPORT void new_tag_card(intptr_t pduel, uint32 code, uint8 o
...
@@ -177,26 +177,28 @@ extern "C" DECL_DLLEXPORT void new_tag_card(intptr_t pduel, uint32 code, uint8 o
}
}
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint8
sequence
,
int32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
LEN_FAIL
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
card
*
pcard
=
0
;
card
*
pcard
=
nullptr
;
location
&=
0x7f
;
location
&=
0x7f
;
if
(
location
&
LOCATION_ONFIELD
)
if
(
location
&
LOCATION_ONFIELD
)
pcard
=
ptduel
->
game_field
->
get_field_card
(
playerid
,
location
,
sequence
);
pcard
=
ptduel
->
game_field
->
get_field_card
(
playerid
,
location
,
sequence
);
else
{
else
{
field
::
card_vector
*
lst
=
0
;
field
::
card_vector
*
lst
=
nullptr
;
if
(
location
==
LOCATION_HAND
)
if
(
location
==
LOCATION_HAND
)
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_hand
;
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_hand
;
else
if
(
location
==
LOCATION_GRAVE
)
else
if
(
location
==
LOCATION_GRAVE
)
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_grave
;
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_grave
;
else
if
(
location
==
LOCATION_REMOVED
)
else
if
(
location
==
LOCATION_REMOVED
)
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_remove
;
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_remove
;
else
if
(
location
==
LOCATION_EXTRA
)
else
if
(
location
==
LOCATION_EXTRA
)
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_extra
;
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_extra
;
else
if
(
location
==
LOCATION_DECK
)
else
if
(
location
==
LOCATION_DECK
)
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_main
;
lst
=
&
ptduel
->
game_field
->
player
[
playerid
].
list_main
;
if
(
!
lst
||
sequence
>=
lst
->
size
())
else
pcard
=
0
;
return
LEN_FAIL
;
if
(
sequence
>=
(
int32
)
lst
->
size
())
pcard
=
nullptr
;
else
else
pcard
=
(
*
lst
)[
sequence
];
pcard
=
(
*
lst
)[
sequence
];
}
}
...
@@ -241,7 +243,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(intptr_t pduel, uint8 playerid
...
@@ -241,7 +243,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_count(intptr_t pduel, uint8 playerid
}
}
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
extern
"C"
DECL_DLLEXPORT
int32
query_field_card
(
intptr_t
pduel
,
uint8
playerid
,
uint8
location
,
uint32
query_flag
,
byte
*
buf
,
int32
use_cache
)
{
if
(
playerid
!=
0
&&
playerid
!=
1
)
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
return
LEN_FAIL
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
duel
*
ptduel
=
(
duel
*
)
pduel
;
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
auto
&
player
=
ptduel
->
game_field
->
player
[
playerid
];
byte
*
p
=
buf
;
byte
*
p
=
buf
;
...
@@ -280,7 +282,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(intptr_t pduel, uint8 playerid,
...
@@ -280,7 +282,7 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(intptr_t pduel, uint8 playerid,
else
if
(
location
==
LOCATION_DECK
)
else
if
(
location
==
LOCATION_DECK
)
lst
=
&
player
.
list_main
;
lst
=
&
player
.
list_main
;
else
else
return
0
;
return
LEN_FAIL
;
for
(
auto
&
pcard
:
*
lst
)
{
for
(
auto
&
pcard
:
*
lst
)
{
int32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
int32
clen
=
pcard
->
get_infos
(
p
,
query_flag
,
use_cache
);
p
+=
clen
;
p
+=
clen
;
...
...
ocgapi.h
View file @
8657c2f2
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
#define DECL_DLLEXPORT
#define DECL_DLLEXPORT
#endif
#endif
#define LEN_EMPTY 4
#define LEN_FAIL 0
#define LEN_EMPTY 4
#define LEN_HEADER 8
class
card
;
class
card
;
struct
card_data
;
struct
card_data
;
...
...
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