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
f150c9ae
Commit
f150c9ae
authored
Dec 02, 2024
by
Chen Bill
Committed by
GitHub
Dec 02, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no longer load script for temp card (#682)
parent
9b4a241e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
6 deletions
+13
-6
duel.cpp
duel.cpp
+1
-1
interpreter.cpp
interpreter.cpp
+5
-3
interpreter.h
interpreter.h
+1
-1
ocgapi.cpp
ocgapi.cpp
+5
-1
ocgapi.h
ocgapi.h
+1
-0
No files found.
duel.cpp
View file @
f150c9ae
...
...
@@ -51,7 +51,7 @@ void duel::clear() {
card
*
duel
::
new_card
(
uint32
code
)
{
card
*
pcard
=
new
card
(
this
);
cards
.
insert
(
pcard
);
if
(
code
)
if
(
code
!=
TEMP_CARD_ID
)
::
read_card
(
code
,
&
(
pcard
->
data
));
pcard
->
data
.
code
=
code
;
lua
->
register_card
(
pcard
);
...
...
interpreter.cpp
View file @
f150c9ae
...
...
@@ -63,7 +63,7 @@ void interpreter::register_card(card *pcard) {
lua_setmetatable
(
current_state
,
-
2
);
//-1
lua_pop
(
current_state
,
1
);
//-1
//Initial
if
(
pcard
->
data
.
code
&&
is_load_script
(
pcard
->
data
))
{
if
(
is_load_script
(
pcard
->
data
))
{
pcard
->
set_status
(
STATUS_INITIALIZING
,
TRUE
);
add_param
(
pcard
,
PARAM_TYPE_CARD
);
call_card_function
(
pcard
,
"initial_effect"
,
1
,
0
);
...
...
@@ -669,11 +669,13 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
int32
ref
=
luaL_ref
(
L
,
LUA_REGISTRYINDEX
);
return
ref
;
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
pduel
;
std
::
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
return
pduel
;
}
bool
interpreter
::
is_load_script
(
card_data
data
)
{
bool
interpreter
::
is_load_script
(
const
card_data
&
data
)
{
if
(
data
.
code
==
TEMP_CARD_ID
)
return
false
;
return
!
(
data
.
type
&
TYPE_NORMAL
)
||
(
data
.
type
&
TYPE_PENDULUM
);
}
interpreter.h
View file @
f150c9ae
...
...
@@ -85,7 +85,7 @@ public:
static
void
function2value
(
lua_State
*
L
,
int32
func_ref
);
static
int32
get_function_handle
(
lua_State
*
L
,
int32
index
);
static
duel
*
get_duel_info
(
lua_State
*
L
);
static
bool
is_load_script
(
c
ard_data
data
);
static
bool
is_load_script
(
c
onst
card_data
&
data
);
template
<
size_t
N
,
typename
...
TR
>
static
int
sprintf
(
char
(
&
buffer
)[
N
],
const
char
*
format
,
TR
...
args
)
{
...
...
ocgapi.cpp
View file @
f150c9ae
...
...
@@ -6,6 +6,7 @@
*/
#include <cstdio>
#include <cstring>
#include <set>
#include "ocgapi.h"
#include "duel.h"
#include "card.h"
...
...
@@ -14,7 +15,6 @@
#include "field.h"
#include "interpreter.h"
#include "buffer.h"
#include <set>
static
script_reader
sreader
=
default_script_reader
;
static
card_reader
creader
=
default_card_reader
;
...
...
@@ -35,6 +35,10 @@ byte* read_script(const char* script_name, int* len) {
return
sreader
(
script_name
,
len
);
}
uint32
read_card
(
uint32
code
,
card_data
*
data
)
{
if
(
code
==
TEMP_CARD_ID
)
{
data
->
clear
();
return
0
;
}
return
creader
(
code
,
data
);
}
uint32
handle_message
(
void
*
pduel
,
uint32
msg_type
)
{
...
...
ocgapi.h
View file @
f150c9ae
...
...
@@ -19,6 +19,7 @@
#define LEN_FAIL 0
#define LEN_EMPTY 4
#define LEN_HEADER 8
#define TEMP_CARD_ID 0
class
card
;
struct
card_data
;
...
...
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