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
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
MyCard
ygopro-core
Commits
a4e17256
Commit
a4e17256
authored
Mar 28, 2018
by
mercury233
Committed by
GitHub
Mar 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update to lua 5.3 (#138)
parent
6b7783b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
39 deletions
+37
-39
interpreter.cpp
interpreter.cpp
+4
-6
libcard.cpp
libcard.cpp
+4
-4
libduel.cpp
libduel.cpp
+3
-3
libeffect.cpp
libeffect.cpp
+25
-25
premake4.lua
premake4.lua
+1
-1
No files found.
interpreter.cpp
View file @
a4e17256
...
...
@@ -596,8 +596,6 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setglobal
(
lua_state
,
"io"
);
lua_pushnil
(
lua_state
);
lua_setglobal
(
lua_state
,
"os"
);
lua_getglobal
(
lua_state
,
"bit32"
);
lua_setglobal
(
lua_state
,
"bit"
);
//open all libs
luaL_newlib
(
lua_state
,
cardlib
);
lua_pushstring
(
lua_state
,
"__index"
);
...
...
@@ -1022,7 +1020,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
}
return
OPERATION_FAIL
;
}
result
=
lua_tointeger
(
current_state
,
-
1
);
result
=
round
(
lua_tonumber
(
current_state
,
-
1
)
);
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -1044,7 +1042,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
if
(
lua_isboolean
(
current_state
,
-
1
))
result
=
lua_toboolean
(
current_state
,
-
1
);
else
result
=
lua_tointeger
(
current_state
,
-
1
);
result
=
round
(
lua_tonumber
(
current_state
,
-
1
)
);
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -1078,7 +1076,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if
(
lua_isboolean
(
current_state
,
index
))
return_value
=
lua_toboolean
(
current_state
,
index
);
else
return_value
=
lua_tointeger
(
current_state
,
index
);
return_value
=
round
(
lua_tonumber
(
current_state
,
index
)
);
result
->
push_back
(
return_value
);
}
lua_settop
(
current_state
,
stack_top
);
...
...
@@ -1139,7 +1137,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
if
(
result
==
0
)
{
coroutines
.
erase
(
f
);
if
(
yield_value
)
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
lua_tointeger
(
rthread
,
-
1
);
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
round
(
lua_tonumber
(
rthread
,
-
1
)
);
current_state
=
lua_state
;
call_depth
--
;
if
(
call_depth
==
0
)
{
...
...
libcard.cpp
View file @
a4e17256
...
...
@@ -1011,7 +1011,7 @@ int32 scriptlib::card_is_status(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
tstatus
=
lua_to
unsigned
(
L
,
2
);
uint32
tstatus
=
lua_to
integer
(
L
,
2
);
if
(
pcard
->
status
&
tstatus
)
lua_pushboolean
(
L
,
1
);
else
...
...
@@ -1035,7 +1035,7 @@ int32 scriptlib::card_set_status(lua_State *L) {
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
if
(
pcard
->
status
&
STATUS_COPYING_EFFECT
)
return
0
;
uint32
tstatus
=
lua_to
unsigned
(
L
,
2
);
uint32
tstatus
=
lua_to
integer
(
L
,
2
);
int32
enable
=
lua_toboolean
(
L
,
3
);
pcard
->
set_status
(
tstatus
,
enable
);
return
0
;
...
...
@@ -1563,7 +1563,7 @@ int32 scriptlib::card_set_flag_effect_label(lua_State *L) {
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_to
unsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
lab
=
lua_tointeger
(
L
,
3
);
auto
eit
=
pcard
->
single_effect
.
find
(
code
);
if
(
eit
==
pcard
->
single_effect
.
end
())
...
...
@@ -1578,7 +1578,7 @@ int32 scriptlib::card_get_flag_effect_label(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_CARD
,
1
);
card
*
pcard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
uint32
code
=
(
lua_to
unsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
auto
rg
=
pcard
->
single_effect
.
equal_range
(
code
);
int32
count
=
0
;
for
(;
rg
.
first
!=
rg
.
second
;
++
rg
.
first
)
{
...
...
libduel.cpp
View file @
a4e17256
...
...
@@ -33,7 +33,7 @@ int32 scriptlib::duel_get_lp(lua_State *L) {
int32
scriptlib
::
duel_set_lp
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
int32
p
=
lua_tointeger
(
L
,
1
);
int32
lp
=
lua_tointeger
(
L
,
2
);
int32
lp
=
round
(
lua_tonumber
(
L
,
2
)
);
if
(
lp
<
0
)
lp
=
0
;
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
...
...
@@ -146,7 +146,7 @@ int32 scriptlib::duel_set_flag_effect_label(lua_State *L) {
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
code
=
(
lua_to
unsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
int32
lab
=
lua_tointeger
(
L
,
3
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
...
...
@@ -164,7 +164,7 @@ int32 scriptlib::duel_get_flag_effect_label(lua_State *L) {
int32
playerid
=
lua_tointeger
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
uint32
code
=
(
lua_to
unsigned
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
uint32
code
=
(
lua_to
integer
(
L
,
2
)
&
0xfffffff
)
|
0x10000000
;
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
effect_set
eset
;
pduel
->
game_field
->
filter_player_effect
(
playerid
,
code
,
&
eset
);
...
...
libeffect.cpp
View file @
a4e17256
...
...
@@ -61,7 +61,7 @@ int32 scriptlib::effect_set_description(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
peffect
->
description
=
v
;
return
0
;
}
...
...
@@ -69,7 +69,7 @@ int32 scriptlib::effect_set_code(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
peffect
->
code
=
v
;
return
0
;
}
...
...
@@ -77,7 +77,7 @@ int32 scriptlib::effect_set_range(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
peffect
->
range
=
v
;
return
0
;
}
...
...
@@ -85,8 +85,8 @@ int32 scriptlib::effect_set_target_range(lua_State *L) {
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
s
=
lua_to
unsigned
(
L
,
2
);
uint32
o
=
lua_to
unsigned
(
L
,
3
);
uint32
s
=
lua_to
integer
(
L
,
2
);
uint32
o
=
lua_to
integer
(
L
,
3
);
peffect
->
s_range
=
s
;
peffect
->
o_range
=
o
;
peffect
->
flag
[
0
]
&=
~
EFFECT_FLAG_ABSOLUTE_TARGET
;
...
...
@@ -96,9 +96,9 @@ int32 scriptlib::effect_set_absolute_range(lua_State *L) {
check_param_count
(
L
,
4
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
playerid
=
lua_to
unsigned
(
L
,
2
);
uint32
s
=
lua_to
unsigned
(
L
,
3
);
uint32
o
=
lua_to
unsigned
(
L
,
4
);
uint32
playerid
=
lua_to
integer
(
L
,
2
);
uint32
s
=
lua_to
integer
(
L
,
3
);
uint32
o
=
lua_to
integer
(
L
,
4
);
if
(
playerid
==
0
)
{
peffect
->
s_range
=
s
;
peffect
->
o_range
=
o
;
...
...
@@ -113,10 +113,10 @@ int32 scriptlib::effect_set_count_limit(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
uint32
code
=
0
;
if
(
lua_gettop
(
L
)
>=
3
)
code
=
lua_to
unsigned
(
L
,
3
);
code
=
lua_to
integer
(
L
,
3
);
if
(
v
==
0
)
v
=
1
;
peffect
->
flag
[
0
]
|=
EFFECT_FLAG_COUNT_LIMIT
;
...
...
@@ -129,8 +129,8 @@ int32 scriptlib::effect_set_reset(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
c
=
lua_to
unsigned
(
L
,
3
);
uint32
v
=
lua_to
integer
(
L
,
2
);
uint32
c
=
lua_to
integer
(
L
,
3
);
if
(
c
==
0
)
c
=
1
;
if
(
v
&
(
RESET_PHASE
)
&&
!
(
v
&
(
RESET_SELF_TURN
|
RESET_OPPO_TURN
)))
...
...
@@ -143,7 +143,7 @@ int32 scriptlib::effect_set_type(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
if
(
v
&
0x0ff0
)
v
|=
EFFECT_TYPE_ACTIONS
;
else
...
...
@@ -164,8 +164,8 @@ int32 scriptlib::effect_set_property(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v1
=
lua_to
unsigned
(
L
,
2
);
uint32
v2
=
lua_to
unsigned
(
L
,
3
);
uint32
v1
=
lua_to
integer
(
L
,
2
);
uint32
v2
=
lua_to
integer
(
L
,
3
);
peffect
->
flag
[
0
]
=
(
peffect
->
flag
[
0
]
&
0x4f
)
|
(
v1
&
~
0x4f
);
peffect
->
flag
[
1
]
=
v2
;
return
0
;
...
...
@@ -174,7 +174,7 @@ int32 scriptlib::effect_set_label(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
peffect
->
label
=
v
;
return
0
;
}
...
...
@@ -196,7 +196,7 @@ int32 scriptlib::effect_set_category(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
v
=
lua_to
unsigned
(
L
,
2
);
uint32
v
=
lua_to
integer
(
L
,
2
);
peffect
->
category
=
v
;
return
0
;
}
...
...
@@ -204,10 +204,10 @@ int32 scriptlib::effect_set_hint_timing(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
vs
=
lua_to
unsigned
(
L
,
2
);
uint32
vs
=
lua_to
integer
(
L
,
2
);
uint32
vo
=
vs
;
if
(
lua_gettop
(
L
)
>=
3
)
vo
=
lua_to
unsigned
(
L
,
3
);
vo
=
lua_to
integer
(
L
,
3
);
peffect
->
hint_timing
[
0
]
=
vs
;
peffect
->
hint_timing
[
1
]
=
vo
;
return
0
;
...
...
@@ -256,7 +256,7 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if
(
lua_isboolean
(
L
,
2
))
peffect
->
value
=
lua_toboolean
(
L
,
2
);
else
peffect
->
value
=
lua_tointeger
(
L
,
2
);
peffect
->
value
=
round
(
lua_tonumber
(
L
,
2
)
);
}
return
0
;
}
...
...
@@ -277,7 +277,7 @@ int32 scriptlib::effect_set_owner_player(lua_State *L) {
check_param_count
(
L
,
1
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
p
=
lua_to
unsigned
(
L
,
2
);
uint32
p
=
lua_to
integer
(
L
,
2
);
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
peffect
->
effect_owner
=
p
;
...
...
@@ -318,8 +318,8 @@ int32 scriptlib::effect_get_property(lua_State *L) {
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
if
(
peffect
)
{
lua_push
unsigned
(
L
,
peffect
->
flag
[
0
]);
lua_push
unsigned
(
L
,
peffect
->
flag
[
1
]);
lua_push
integer
(
L
,
peffect
->
flag
[
0
]);
lua_push
integer
(
L
,
peffect
->
flag
[
1
]);
return
2
;
}
return
0
;
...
...
@@ -468,8 +468,8 @@ int32 scriptlib::effect_is_has_property(lua_State *L) {
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_EFFECT
,
1
);
effect
*
peffect
=
*
(
effect
**
)
lua_touserdata
(
L
,
1
);
uint32
tflag1
=
lua_to
unsigned
(
L
,
2
);
uint32
tflag2
=
lua_to
unsigned
(
L
,
3
);
uint32
tflag1
=
lua_to
integer
(
L
,
2
);
uint32
tflag2
=
lua_to
integer
(
L
,
3
);
if
(
peffect
&&
(
!
tflag1
||
(
peffect
->
flag
[
0
]
&
tflag1
))
&&
(
!
tflag2
||
(
peffect
->
flag
[
1
]
&
tflag2
)))
lua_pushboolean
(
L
,
1
);
else
...
...
premake4.lua
View file @
a4e17256
...
...
@@ -7,4 +7,4 @@ project "ocgcore"
configuration
"not vs*"
buildoptions
{
"-std=gnu++0x"
}
configuration
"not windows"
includedirs
{
"/usr/include/lua"
,
"/usr/include/lua5.
2"
,
"/usr/include/lua/5.2
"
}
includedirs
{
"/usr/include/lua"
,
"/usr/include/lua5.
3"
,
"/usr/include/lua/5.3
"
}
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