Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
94c6544e
Commit
94c6544e
authored
Dec 15, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync ocgcore
parent
f4a2b27a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
18 deletions
+24
-18
Classes/ocgcore/interpreter.cpp
Classes/ocgcore/interpreter.cpp
+18
-11
Classes/ocgcore/interpreter.h
Classes/ocgcore/interpreter.h
+0
-1
Classes/ocgcore/libduel.cpp
Classes/ocgcore/libduel.cpp
+6
-6
No files found.
Classes/ocgcore/interpreter.cpp
View file @
94c6544e
...
...
@@ -17,9 +17,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_state
=
luaL_newstate
();
current_state
=
lua_state
;
pduel
=
pd
;
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
no_action
=
0
;
call_depth
=
0
;
set_duel_info
(
lua_state
,
pd
);
//Initial
luaL_openlibs
(
lua_state
);
lua_pushnil
(
lua_state
);
...
...
@@ -577,12 +577,25 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
}
}
push_param
(
rthread
,
true
);
lua_State
*
prev_state
=
current_state
;
current_state
=
rthread
;
#if (LUA_VERSION_NUM >= 504)
int32
nresults
;
int32
result
=
lua_resume
(
rthread
,
prev_state
,
param_count
,
&
nresults
);
#else
int32
result
=
lua_resume
(
rthread
,
0
,
param_count
);
int32
nresults
=
lua_gettop
(
rthread
);
#endif
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
if
(
yield_value
)
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
(
uint32
)
lua_tointeger
(
rthread
,
-
1
);
if
(
yield_value
)
{
if
(
nresults
==
0
)
*
yield_value
=
0
;
else
if
(
lua_isboolean
(
rthread
,
-
1
))
*
yield_value
=
lua_toboolean
(
rthread
,
-
1
);
else
*
yield_value
=
(
uint32
)
lua_tointeger
(
rthread
,
-
1
);
}
current_state
=
lua_state
;
call_depth
--
;
if
(
call_depth
==
0
)
{
...
...
@@ -656,14 +669,8 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
}
void
interpreter
::
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
)
{
lua_pushlightuserdata
(
L
,
pduel
);
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
luaL_checkstack
(
L
,
1
,
NULL
);
lua_rawgeti
(
L
,
LUA_REGISTRYINDEX
,
3
);
duel
*
pduel
=
(
duel
*
)
lua_topointer
(
L
,
-
1
);
lua_pop
(
L
,
1
);
duel
*
pduel
;
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
return
pduel
;
}
Classes/ocgcore/interpreter.h
View file @
94c6544e
...
...
@@ -67,7 +67,6 @@ public:
static
void
effect2value
(
lua_State
*
L
,
effect
*
peffect
);
static
void
function2value
(
lua_State
*
L
,
int32
pointer
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
void
set_duel_info
(
lua_State
*
L
,
duel
*
pduel
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
template
<
size_t
N
,
typename
...
TR
>
...
...
Classes/ocgcore/libduel.cpp
View file @
94c6544e
...
...
@@ -1170,13 +1170,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
int32
ret
=
0
,
fc
=
0
;
if
(
loc
&
(
LOCATION_FZONE
+
LOCATION_SZONE
))
{
card
*
pcard
=
pduel
->
game_field
->
player
[
0
].
list_szone
[
5
];
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
))
{
fc
=
1
;
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
0
||
playerid
==
PLAYER_ALL
))
ret
=
1
;
}
pcard
=
pduel
->
game_field
->
player
[
1
].
list_szone
[
5
];
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
))
{
fc
=
1
;
if
(
code
==
pcard
->
get_code
()
&&
(
playerid
==
1
||
playerid
==
PLAYER_ALL
))
ret
=
1
;
...
...
@@ -1185,13 +1185,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if
(
!
ret
&&
(
loc
&
LOCATION_SZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_szone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_szone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
}
}
...
...
@@ -1199,13 +1199,13 @@ int32 scriptlib::duel_is_environment(lua_State *L) {
if
(
!
ret
&&
(
loc
&
LOCATION_MZONE
))
{
if
(
playerid
==
0
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
0
].
list_mzone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
}
}
if
(
playerid
==
1
||
playerid
==
PLAYER_ALL
)
{
for
(
auto
&
pcard
:
pduel
->
game_field
->
player
[
1
].
list_mzone
)
{
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
pcard
->
get_status
(
STATUS_EFFECT_ENABLED
)
&&
code
==
pcard
->
get_code
())
if
(
pcard
&&
pcard
->
is_position
(
POS_FACEUP
)
&&
code
==
pcard
->
get_code
())
ret
=
1
;
}
}
...
...
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