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
8568c8f3
Commit
8568c8f3
authored
Nov 09, 2024
by
Chen Bill
Committed by
GitHub
Nov 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add duel::buffer_size() (#653)
* add duel::buffer_size() * fix warning C4267 about size
parent
3d92ce96
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
105 additions
and
100 deletions
+105
-100
duel.cpp
duel.cpp
+4
-3
duel.h
duel.h
+4
-0
field.h
field.h
+1
-1
operations.cpp
operations.cpp
+2
-2
playerop.cpp
playerop.cpp
+2
-2
processor.cpp
processor.cpp
+92
-92
No files found.
duel.cpp
View file @
8568c8f3
...
@@ -98,9 +98,10 @@ void duel::delete_effect(effect* peffect) {
...
@@ -98,9 +98,10 @@ void duel::delete_effect(effect* peffect) {
delete
peffect
;
delete
peffect
;
}
}
int32
duel
::
read_buffer
(
byte
*
buf
)
{
int32
duel
::
read_buffer
(
byte
*
buf
)
{
if
(
message_buffer
.
size
())
auto
size
=
buffer_size
();
std
::
memcpy
(
buf
,
message_buffer
.
data
(),
message_buffer
.
size
());
if
(
size
)
return
(
int32
)
message_buffer
.
size
();
std
::
memcpy
(
buf
,
message_buffer
.
data
(),
size
);
return
(
int32
)
size
;
}
}
void
duel
::
release_script_group
()
{
void
duel
::
release_script_group
()
{
for
(
auto
&
pgroup
:
sgroups
)
{
for
(
auto
&
pgroup
:
sgroups
)
{
...
...
duel.h
View file @
8568c8f3
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include "mtrandom.h"
#include "mtrandom.h"
#include <set>
#include <set>
#include <unordered_set>
#include <unordered_set>
#include <vector>
class
card
;
class
card
;
class
group
;
class
group
;
...
@@ -40,6 +41,9 @@ public:
...
@@ -40,6 +41,9 @@ public:
~
duel
();
~
duel
();
void
clear
();
void
clear
();
uint32
buffer_size
()
const
{
return
(
uint32
)
message_buffer
.
size
()
&
PROCESSOR_BUFFER_LEN
;
}
card
*
new_card
(
uint32
code
);
card
*
new_card
(
uint32
code
);
group
*
new_group
();
group
*
new_group
();
group
*
new_group
(
card
*
pcard
);
group
*
new_group
(
card
*
pcard
);
...
...
field.h
View file @
8568c8f3
...
@@ -627,7 +627,7 @@ public:
...
@@ -627,7 +627,7 @@ public:
int32
toss_dice
(
uint16
step
,
effect
*
reason_effect
,
uint8
reason_player
,
uint8
playerid
,
uint8
count1
,
uint8
count2
);
int32
toss_dice
(
uint16
step
,
effect
*
reason_effect
,
uint8
reason_player
,
uint8
playerid
,
uint8
count1
,
uint8
count2
);
int32
rock_paper_scissors
(
uint16
step
,
uint8
repeat
);
int32
rock_paper_scissors
(
uint16
step
,
uint8
repeat
);
bool
check_response
(
int32
vector_size
,
int32
min_len
,
int32
max_len
)
const
;
bool
check_response
(
size_t
vector_size
,
int32
min_len
,
int32
max_len
)
const
;
int32
select_battle_command
(
uint16
step
,
uint8
playerid
);
int32
select_battle_command
(
uint16
step
,
uint8
playerid
);
int32
select_idle_command
(
uint16
step
,
uint8
playerid
);
int32
select_idle_command
(
uint16
step
,
uint8
playerid
);
int32
select_effect_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
,
card
*
pcard
);
int32
select_effect_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
,
card
*
pcard
);
...
...
operations.cpp
View file @
8568c8f3
...
@@ -4367,7 +4367,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
...
@@ -4367,7 +4367,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_single_event
(
pcard
,
0
,
EVENT_DESTROYED
,
pcard
->
current
.
reason_effect
,
pcard
->
current
.
reason
,
pcard
->
current
.
reason_player
,
0
,
0
);
raise_single_event
(
pcard
,
0
,
EVENT_DESTROYED
,
pcard
->
current
.
reason_effect
,
pcard
->
current
.
reason
,
pcard
->
current
.
reason_player
,
0
,
0
);
}
}
if
(
pcard
->
xyz_materials
.
size
())
{
if
(
pcard
->
xyz_materials
.
size
())
{
pcard->xyz_materials_previous_count_onfield = pcard->xyz_materials.size();
pcard
->
xyz_materials_previous_count_onfield
=
(
int32
)
pcard
->
xyz_materials
.
size
();
for
(
auto
&
mcard
:
pcard
->
xyz_materials
)
for
(
auto
&
mcard
:
pcard
->
xyz_materials
)
overlays
.
insert
(
mcard
);
overlays
.
insert
(
mcard
);
}
else
{
}
else
{
...
@@ -4711,7 +4711,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
...
@@ -4711,7 +4711,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
}
}
}
}
if
(
target
->
xyz_materials
.
size
())
{
if
(
target
->
xyz_materials
.
size
())
{
target->xyz_materials_previous_count_onfield = target->xyz_materials.size();
target
->
xyz_materials_previous_count_onfield
=
(
int32
)
target
->
xyz_materials
.
size
();
card_set
overlays
;
card_set
overlays
;
overlays
.
insert
(
target
->
xyz_materials
.
begin
(),
target
->
xyz_materials
.
end
());
overlays
.
insert
(
target
->
xyz_materials
.
begin
(),
target
->
xyz_materials
.
end
());
send_to
(
&
overlays
,
0
,
REASON_LOST_OVERLAY
+
REASON_RULE
,
PLAYER_NONE
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
send_to
(
&
overlays
,
0
,
REASON_LOST_OVERLAY
+
REASON_RULE
,
PLAYER_NONE
,
PLAYER_NONE
,
LOCATION_GRAVE
,
0
,
POS_FACEUP
);
...
...
playerop.cpp
View file @
8568c8f3
...
@@ -14,14 +14,14 @@
...
@@ -14,14 +14,14 @@
#include <algorithm>
#include <algorithm>
#include <stack>
#include <stack>
bool
field
::
check_response
(
int32
vector_size
,
int32
min_len
,
int32
max_len
)
const
{
bool
field
::
check_response
(
size_t
vector_size
,
int32
min_len
,
int32
max_len
)
const
{
const
int32
len
=
returns
.
bvalue
[
0
];
const
int32
len
=
returns
.
bvalue
[
0
];
if
(
len
<
min_len
||
len
>
max_len
)
if
(
len
<
min_len
||
len
>
max_len
)
return
false
;
return
false
;
std
::
set
<
uint8
>
index_set
;
std
::
set
<
uint8
>
index_set
;
for
(
int32
i
=
0
;
i
<
len
;
++
i
)
{
for
(
int32
i
=
0
;
i
<
len
;
++
i
)
{
uint8
index
=
returns
.
bvalue
[
1
+
i
];
uint8
index
=
returns
.
bvalue
[
1
+
i
];
if
(
index
>=
vector_size
||
index_set
.
count
(
index
))
{
if
(
index
>=
(
int32
)
vector_size
||
index_set
.
count
(
index
))
{
return
false
;
return
false
;
}
}
index_set
.
insert
(
index
);
index_set
.
insert
(
index
);
...
...
processor.cpp
View file @
8568c8f3
This diff is collapsed.
Click to expand it.
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