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
xiaoye
ygopro-core
Commits
49a2107c
You need to sign in or sign up before continuing.
Commit
49a2107c
authored
Dec 22, 2023
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include <cstring>
parent
32fb1c71
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
16 deletions
+17
-16
duel.cpp
duel.cpp
+9
-0
duel.h
duel.h
+0
-8
interpreter.cpp
interpreter.cpp
+3
-2
interpreter.h
interpreter.h
+0
-1
libdebug.cpp
libdebug.cpp
+3
-3
ocgapi.cpp
ocgapi.cpp
+2
-2
No files found.
duel.cpp
View file @
49a2107c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* Author: Argon
* Author: Argon
*/
*/
#include <cstring>
#include "duel.h"
#include "duel.h"
#include "interpreter.h"
#include "interpreter.h"
#include "field.h"
#include "field.h"
...
@@ -13,6 +14,14 @@
...
@@ -13,6 +14,14 @@
#include "group.h"
#include "group.h"
#include "ocgapi.h"
#include "ocgapi.h"
inline
void
write_buffer_vector
(
std
::
vector
<
byte
>&
buffer
,
const
void
*
data
,
int
size
)
{
if
(
size
>
0
)
{
const
auto
len
=
buffer
.
size
();
buffer
.
resize
(
len
+
size
);
std
::
memcpy
(
&
buffer
[
len
],
data
,
size
);
}
}
duel
::
duel
()
{
duel
::
duel
()
{
lua
=
new
interpreter
(
this
);
lua
=
new
interpreter
(
this
);
game_field
=
new
field
(
this
);
game_field
=
new
field
(
this
);
...
...
duel.h
View file @
49a2107c
...
@@ -19,14 +19,6 @@ class effect;
...
@@ -19,14 +19,6 @@ class effect;
class
field
;
class
field
;
class
interpreter
;
class
interpreter
;
inline
void
write_buffer_vector
(
std
::
vector
<
byte
>&
buffer
,
const
void
*
data
,
int
size
)
{
if
(
size
>
0
)
{
const
auto
len
=
buffer
.
size
();
buffer
.
resize
(
len
+
size
);
std
::
memcpy
(
&
buffer
[
len
],
data
,
size
);
}
}
class
duel
{
class
duel
{
public:
public:
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
using
card_set
=
std
::
set
<
card
*
,
card_sort
>
;
...
...
interpreter.cpp
View file @
49a2107c
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
* Author: Argon
* Author: Argon
*/
*/
#include <cstring>
#include "duel.h"
#include "duel.h"
#include "group.h"
#include "group.h"
#include "card.h"
#include "card.h"
...
@@ -17,7 +18,7 @@ interpreter::interpreter(duel* pd): coroutines(256) {
...
@@ -17,7 +18,7 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_state
=
luaL_newstate
();
lua_state
=
luaL_newstate
();
current_state
=
lua_state
;
current_state
=
lua_state
;
pduel
=
pd
;
pduel
=
pd
;
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
std
::
memcpy
(
lua_getextraspace
(
lua_state
),
&
pd
,
LUA_EXTRASPACE
);
//set_duel_info
no_action
=
0
;
no_action
=
0
;
call_depth
=
0
;
call_depth
=
0
;
//Initial
//Initial
...
@@ -663,6 +664,6 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
...
@@ -663,6 +664,6 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
}
}
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
interpreter
::
get_duel_info
(
lua_State
*
L
)
{
duel
*
pduel
;
duel
*
pduel
;
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
std
::
memcpy
(
&
pduel
,
lua_getextraspace
(
L
),
LUA_EXTRASPACE
);
return
pduel
;
return
pduel
;
}
}
interpreter.h
View file @
49a2107c
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
#include <list>
#include <list>
#include <vector>
#include <vector>
#include <cstdio>
#include <cstdio>
#include <cstring>
class
card
;
class
card
;
class
effect
;
class
effect
;
...
...
libdebug.cpp
View file @
49a2107c
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* Author: Argon
* Author: Argon
*/
*/
#include <
string.h
>
#include <
cstring
>
#include "scriptlib.h"
#include "scriptlib.h"
#include "duel.h"
#include "duel.h"
#include "field.h"
#include "field.h"
...
@@ -170,7 +170,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) {
...
@@ -170,7 +170,7 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_AI_NAME
);
pduel
->
write_buffer8
(
MSG_AI_NAME
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
(
int
)
strlen
(
pstr
);
int
len
=
(
int
)
st
d
::
st
rlen
(
pstr
);
if
(
len
>
100
)
if
(
len
>
100
)
len
=
100
;
len
=
100
;
pduel
->
write_buffer16
(
len
);
pduel
->
write_buffer16
(
len
);
...
@@ -184,7 +184,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
...
@@ -184,7 +184,7 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
duel
*
pduel
=
interpreter
::
get_duel_info
(
L
);
pduel
->
write_buffer8
(
MSG_SHOW_HINT
);
pduel
->
write_buffer8
(
MSG_SHOW_HINT
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
const
char
*
pstr
=
lua_tostring
(
L
,
1
);
int
len
=
(
int
)
strlen
(
pstr
);
int
len
=
(
int
)
st
d
::
st
rlen
(
pstr
);
if
(
len
>
1024
)
if
(
len
>
1024
)
len
=
1024
;
len
=
1024
;
pduel
->
write_buffer16
(
len
);
pduel
->
write_buffer16
(
len
);
...
...
ocgapi.cpp
View file @
49a2107c
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* Author: Argon
* Author: Argon
*/
*/
#include <stdio.h>
#include <stdio.h>
#include <
string.h
>
#include <
cstring
>
#include "ocgapi.h"
#include "ocgapi.h"
#include "duel.h"
#include "duel.h"
#include "card.h"
#include "card.h"
...
@@ -120,7 +120,7 @@ extern "C" DECL_DLLEXPORT void set_player_info(intptr_t pduel, int32 playerid, i
...
@@ -120,7 +120,7 @@ extern "C" DECL_DLLEXPORT void set_player_info(intptr_t pduel, int32 playerid, i
pd
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
pd
->
game_field
->
player
[
playerid
].
draw_count
=
drawcount
;
}
}
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
intptr_t
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
void
get_log_message
(
intptr_t
pduel
,
byte
*
buf
)
{
strcpy
((
char
*
)
buf
,
((
duel
*
)
pduel
)
->
strbuffer
);
st
d
::
st
rcpy
((
char
*
)
buf
,
((
duel
*
)
pduel
)
->
strbuffer
);
}
}
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
intptr_t
pduel
,
byte
*
buf
)
{
extern
"C"
DECL_DLLEXPORT
int32
get_message
(
intptr_t
pduel
,
byte
*
buf
)
{
int32
len
=
((
duel
*
)
pduel
)
->
read_buffer
(
buf
);
int32
len
=
((
duel
*
)
pduel
)
->
read_buffer
(
buf
);
...
...
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