Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
74583608
Commit
74583608
authored
Jan 28, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/purerosefallen/ygopro-222DIY
parents
9b3616c8
dbd3816a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+5
-0
ocgcore/libgroup.cpp
ocgcore/libgroup.cpp
+57
-0
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+3
-0
No files found.
ocgcore/interpreter.cpp
View file @
74583608
...
...
@@ -333,6 +333,10 @@ static const struct luaL_Reg effectlib[] = {
};
static
const
struct
luaL_Reg
grouplib
[]
=
{
//metatable
{
"__add"
,
scriptlib
::
group_meta_add
},
{
"__sub"
,
scriptlib
::
group_meta_sub
},
{
"CreateGroup"
,
scriptlib
::
group_new
},
{
"KeepAlive"
,
scriptlib
::
group_keep_alive
},
{
"DeleteGroup"
,
scriptlib
::
group_delete
},
...
...
@@ -344,6 +348,7 @@ static const struct luaL_Reg grouplib[] = {
{
"GetNext"
,
scriptlib
::
group_get_next
},
{
"GetFirst"
,
scriptlib
::
group_get_first
},
{
"GetCount"
,
scriptlib
::
group_get_count
},
{
"__len"
,
scriptlib
::
group_get_count
},
{
"ForEach"
,
scriptlib
::
group_for_each
},
{
"Filter"
,
scriptlib
::
group_filter
},
{
"FilterCount"
,
scriptlib
::
group_filter_count
},
...
...
ocgcore/libgroup.cpp
View file @
74583608
...
...
@@ -11,6 +11,63 @@
#include "effect.h"
#include "duel.h"
//metatables
//metatable functions
int32
scriptlib
::
group_meta_add
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
if
(
!
check_param
(
L
,
PARAM_TYPE_CARD
,
1
,
TRUE
)
&&
!
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
,
TRUE
))
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
if
(
!
check_param
(
L
,
PARAM_TYPE_CARD
,
2
,
TRUE
)
&&
!
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
,
TRUE
))
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
1
,
TRUE
))
{
card
*
ccard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pgroup
->
container
.
insert
(
ccard
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
,
TRUE
))
{
group
*
cgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
for
(
auto
cit
=
cgroup
->
container
.
begin
();
cit
!=
cgroup
->
container
.
end
();
++
cit
)
pgroup
->
container
.
insert
(
*
cit
);
}
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
2
,
TRUE
))
{
card
*
ccard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
pgroup
->
container
.
insert
(
ccard
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
,
TRUE
))
{
group
*
cgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
for
(
auto
cit
=
cgroup
->
container
.
begin
();
cit
!=
cgroup
->
container
.
end
();
++
cit
)
pgroup
->
container
.
insert
(
*
cit
);
}
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
int32
scriptlib
::
group_meta_sub
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
if
(
!
check_param
(
L
,
PARAM_TYPE_CARD
,
1
,
TRUE
)
&&
!
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
,
TRUE
))
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
1
);
if
(
!
check_param
(
L
,
PARAM_TYPE_CARD
,
2
,
TRUE
)
&&
!
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
,
TRUE
))
luaL_error
(
L
,
"Parameter %d should be
\"
Card
\"
or
\"
Group
\"
."
,
2
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
1
,
TRUE
))
{
card
*
ccard
=
*
(
card
**
)
lua_touserdata
(
L
,
1
);
pgroup
->
container
.
insert
(
ccard
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
,
TRUE
))
{
group
*
cgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
for
(
auto
cit
=
cgroup
->
container
.
begin
();
cit
!=
cgroup
->
container
.
end
();
++
cit
)
pgroup
->
container
.
insert
(
*
cit
);
}
if
(
check_param
(
L
,
PARAM_TYPE_CARD
,
2
,
TRUE
))
{
card
*
ccard
=
*
(
card
**
)
lua_touserdata
(
L
,
2
);
pgroup
->
container
.
erase
(
ccard
);
}
else
if
(
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
,
TRUE
))
{
group
*
cgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
for
(
auto
cit
=
cgroup
->
container
.
begin
();
cit
!=
cgroup
->
container
.
end
();
++
cit
)
pgroup
->
container
.
erase
(
*
cit
);
}
interpreter
::
group2value
(
L
,
pgroup
);
return
1
;
}
int32
scriptlib
::
group_new
(
lua_State
*
L
)
{
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
group
*
pgroup
=
pduel
->
new_group
();
...
...
ocgcore/scriptlib.h
View file @
74583608
...
...
@@ -38,6 +38,9 @@ public:
static
int32
duel_disable_action_check
(
lua_State
*
L
);
static
int32
duel_setmetatable
(
lua_State
*
L
);
static
int32
duel_move_turn_count
(
lua_State
*
L
);
//metatable
static
int32
group_meta_add
(
lua_State
*
L
);
static
int32
group_meta_sub
(
lua_State
*
L
);
//card lib
static
int32
card_get_code
(
lua_State
*
L
);
...
...
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