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
52f8de37
Commit
52f8de37
authored
Nov 02, 2025
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into develop
parents
8f6395a1
5d629691
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
interpreter.cpp
interpreter.cpp
+7
-2
interpreter.h
interpreter.h
+1
-0
libgroup.cpp
libgroup.cpp
+9
-8
No files found.
interpreter.cpp
View file @
52f8de37
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
#include "ocgapi.h"
#include "ocgapi.h"
#include "interpreter.h"
#include "interpreter.h"
interpreter
::
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
)
:
coroutines
(
256
),
pduel
(
pd
)
{
interpreter
::
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
)
:
coroutines
(
256
),
pduel
(
pd
),
enable_unsafe_feature
(
enable_unsafe_libraries
)
{
lua_state
=
luaL_newstate
();
lua_state
=
luaL_newstate
();
current_state
=
lua_state
;
current_state
=
lua_state
;
std
::
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
std
::
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
...
@@ -143,7 +144,11 @@ int32_t interpreter::load_script(const char* script_name) {
...
@@ -143,7 +144,11 @@ int32_t interpreter::load_script(const char* script_name) {
return
OPERATION_FAIL
;
return
OPERATION_FAIL
;
++
no_action
;
++
no_action
;
luaL_checkstack
(
current_state
,
2
,
nullptr
);
luaL_checkstack
(
current_state
,
2
,
nullptr
);
int32_t
error
=
luaL_loadbuffer
(
current_state
,
(
const
char
*
)
buffer
,
len
,
script_name
)
||
lua_pcall
(
current_state
,
0
,
0
,
0
);
int32_t
error
=
0
;
if
(
enable_unsafe_feature
)
error
=
luaL_loadbuffer
(
current_state
,
(
const
char
*
)
buffer
,
len
,
script_name
)
||
lua_pcall
(
current_state
,
0
,
0
,
0
);
else
error
=
luaL_loadbufferx
(
current_state
,
(
const
char
*
)
buffer
,
len
,
script_name
,
"t"
)
||
lua_pcall
(
current_state
,
0
,
0
,
0
);
if
(
error
)
{
if
(
error
)
{
interpreter
::
sprintf
(
pduel
->
strbuffer
,
"%s"
,
lua_tostring
(
current_state
,
-
1
));
interpreter
::
sprintf
(
pduel
->
strbuffer
,
"%s"
,
lua_tostring
(
current_state
,
-
1
));
handle_message
(
pduel
,
1
);
handle_message
(
pduel
,
1
);
...
...
interpreter.h
View file @
52f8de37
...
@@ -52,6 +52,7 @@ public:
...
@@ -52,6 +52,7 @@ public:
coroutine_map
coroutines
;
coroutine_map
coroutines
;
int32_t
no_action
{};
int32_t
no_action
{};
int32_t
call_depth
{};
int32_t
call_depth
{};
bool
enable_unsafe_feature
{};
explicit
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
);
explicit
interpreter
(
duel
*
pd
,
bool
enable_unsafe_libraries
);
~
interpreter
();
~
interpreter
();
...
...
libgroup.cpp
View file @
52f8de37
...
@@ -331,11 +331,11 @@ int32_t scriptlib::group_random_select(lua_State *L) {
...
@@ -331,11 +331,11 @@ int32_t scriptlib::group_random_select(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
int32_t
playerid
=
(
int32_t
)
lua_tointeger
(
L
,
2
);
int32_t
playerid
=
(
int32_t
)
lua_tointeger
(
L
,
2
);
uint32_t
count
=
(
u
int32_t
)
lua_tointeger
(
L
,
3
);
int32_t
count
=
(
int32_t
)
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
pgroup
->
pduel
;
duel
*
pduel
=
pgroup
->
pduel
;
group
*
newgroup
=
pduel
->
new_group
();
group
*
newgroup
=
pduel
->
new_group
();
if
(
count
>
pgroup
->
container
.
size
())
if
(
count
>
(
int32_t
)
pgroup
->
container
.
size
())
count
=
(
u
int32_t
)
pgroup
->
container
.
size
();
count
=
(
int32_t
)
pgroup
->
container
.
size
();
if
(
count
==
0
)
{
if
(
count
==
0
)
{
interpreter
::
group2value
(
L
,
newgroup
);
interpreter
::
group2value
(
L
,
newgroup
);
return
1
;
return
1
;
...
@@ -343,12 +343,13 @@ int32_t scriptlib::group_random_select(lua_State *L) {
...
@@ -343,12 +343,13 @@ int32_t scriptlib::group_random_select(lua_State *L) {
if
(
count
==
pgroup
->
container
.
size
())
if
(
count
==
pgroup
->
container
.
size
())
newgroup
->
container
=
pgroup
->
container
;
newgroup
->
container
=
pgroup
->
container
;
else
{
else
{
while
(
newgroup
->
container
.
size
()
<
count
)
{
card_vector
cv
(
pgroup
->
container
.
begin
(),
pgroup
->
container
.
end
());
int32_t
i
=
pduel
->
get_next_integer
(
0
,
(
int32_t
)
pgroup
->
container
.
size
()
-
1
)
;
int32_t
back
=
(
int32_t
)
cv
.
size
()
-
1
;
auto
cit
=
pgroup
->
container
.
begin
();
for
(
int32_t
i
=
0
;
i
<
count
;
++
i
)
{
std
::
advance
(
cit
,
i
);
int32_t
r
=
pduel
->
get_next_integer
(
i
,
back
);
newgroup
->
container
.
insert
(
*
cit
);
std
::
swap
(
cv
[
i
],
cv
[
r
]
);
}
}
newgroup
->
container
.
insert
(
cv
.
begin
(),
cv
.
begin
()
+
count
);
}
}
pduel
->
write_buffer8
(
MSG_RANDOM_SELECTED
);
pduel
->
write_buffer8
(
MSG_RANDOM_SELECTED
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
playerid
);
...
...
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