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
e4a284aa
Commit
e4a284aa
authored
Aug 26, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up
parent
dda0bd01
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
39 deletions
+31
-39
card.cpp
card.cpp
+4
-5
duel.cpp
duel.cpp
+2
-3
field.h
field.h
+0
-3
interpreter.cpp
interpreter.cpp
+5
-5
interpreter.h
interpreter.h
+1
-0
libduel.cpp
libduel.cpp
+1
-1
libeffect.cpp
libeffect.cpp
+1
-1
playerop.cpp
playerop.cpp
+17
-21
No files found.
card.cpp
View file @
e4a284aa
...
...
@@ -12,7 +12,6 @@
#include "group.h"
#include "interpreter.h"
#include "ocgapi.h"
#include <memory.h>
#include <iostream>
#include <algorithm>
...
...
@@ -84,13 +83,13 @@ card::card(duel* pd) {
direct_attackable
=
0
;
summon_info
=
0
;
status
=
0
;
memset
(
&
q_cache
,
0xff
,
sizeof
(
query_cache
));
std
::
memset
(
&
q_cache
,
0xff
,
sizeof
(
query_cache
));
equiping_target
=
0
;
pre_equip_target
=
0
;
overlay_target
=
0
;
memset
(
&
current
,
0
,
sizeof
(
card_state
));
memset
(
&
previous
,
0
,
sizeof
(
card_state
));
memset
(
&
temp
,
0xff
,
sizeof
(
card_state
));
std
::
memset
(
&
current
,
0
,
sizeof
(
card_state
));
std
::
memset
(
&
previous
,
0
,
sizeof
(
card_state
));
std
::
memset
(
&
temp
,
0xff
,
sizeof
(
card_state
));
unique_pos
[
0
]
=
unique_pos
[
1
]
=
0
;
spsummon_counter
[
0
]
=
spsummon_counter
[
1
]
=
0
;
spsummon_counter_rst
[
0
]
=
spsummon_counter_rst
[
1
]
=
0
;
...
...
duel.cpp
View file @
e4a284aa
...
...
@@ -12,7 +12,6 @@
#include "effect.h"
#include "group.h"
#include "ocgapi.h"
#include <memory.h>
duel
::
duel
()
{
lua
=
new
interpreter
(
this
);
...
...
@@ -96,7 +95,7 @@ void duel::delete_effect(effect* peffect) {
delete
peffect
;
}
int32
duel
::
read_buffer
(
byte
*
buf
)
{
memcpy
(
buf
,
buffer
,
bufferlen
);
std
::
memcpy
(
buf
,
buffer
,
bufferlen
);
return
bufferlen
;
}
void
duel
::
release_script_group
()
{
...
...
@@ -138,7 +137,7 @@ void duel::set_responsei(uint32 resp) {
game_field
->
returns
.
ivalue
[
0
]
=
resp
;
}
void
duel
::
set_responseb
(
byte
*
resp
)
{
memcpy
(
game_field
->
returns
.
bvalue
,
resp
,
64
);
std
::
memcpy
(
game_field
->
returns
.
bvalue
,
resp
,
64
);
}
int32
duel
::
get_next_integer
(
int32
l
,
int32
h
)
{
return
(
int32
)
(
random
.
real
()
*
(
h
-
l
+
1
))
+
l
;
...
...
field.h
View file @
e4a284aa
...
...
@@ -8,7 +8,6 @@
#ifndef FIELD_H_
#define FIELD_H_
#include "memory.h"
#include "common.h"
#include "effectset.h"
#include <vector>
...
...
@@ -19,7 +18,6 @@
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
class
card
;
struct
card_data
;
...
...
@@ -206,7 +204,6 @@ struct processor {
chain_list
new_ochain_b
;
chain_list
new_ochain_h
;
chain_list
new_chains
;
chain_list
tmp_chain
;
delayed_effect_collection
delayed_quick_tmp
;
delayed_effect_collection
delayed_quick_break
;
delayed_effect_collection
delayed_quick
;
...
...
interpreter.cpp
View file @
e4a284aa
...
...
@@ -832,7 +832,7 @@ int32 interpreter::call_function(int32 f, uint32 param_count, int32 ret_count) {
return
OPERATION_FAIL
;
}
if
(
param_count
!=
params
.
size
())
{
sprintf
(
pduel
->
strbuffer
,
"
\"
CallFunction
\"
: incorrect parameter count (%d expected, %
ud
pushed)"
,
param_count
,
params
.
size
());
sprintf
(
pduel
->
strbuffer
,
"
\"
CallFunction
\"
: incorrect parameter count (%d expected, %
zu
pushed)"
,
param_count
,
params
.
size
());
handle_message
(
pduel
,
1
);
params
.
clear
();
return
OPERATION_FAIL
;
...
...
@@ -1029,7 +1029,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
}
return
OPERATION_FAIL
;
}
result
=
round
(
lua_tonumber
(
current_state
,
-
1
));
result
=
std
::
round
(
lua_tonumber
(
current_state
,
-
1
));
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -1051,7 +1051,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
=
round
(
lua_tonumber
(
current_state
,
-
1
));
result
=
std
::
round
(
lua_tonumber
(
current_state
,
-
1
));
lua_pop
(
current_state
,
1
);
no_action
--
;
call_depth
--
;
...
...
@@ -1085,7 +1085,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
=
round
(
lua_tonumber
(
current_state
,
index
));
return_value
=
std
::
round
(
lua_tonumber
(
current_state
,
index
));
result
->
push_back
(
return_value
);
}
lua_settop
(
current_state
,
stack_top
);
...
...
@@ -1146,7 +1146,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
)
:
round
(
lua_tonumber
(
rthread
,
-
1
)
);
*
yield_value
=
lua_isboolean
(
rthread
,
-
1
)
?
lua_toboolean
(
rthread
,
-
1
)
:
lua_tointeger
(
rthread
,
-
1
);
current_state
=
lua_state
;
call_depth
--
;
if
(
call_depth
==
0
)
{
...
...
interpreter.h
View file @
e4a284aa
...
...
@@ -24,6 +24,7 @@ extern "C" {
#include <list>
#include <vector>
#include <cstring>
#include <cmath>
class
card
;
class
effect
;
...
...
libduel.cpp
View file @
e4a284aa
...
...
@@ -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
=
round
(
lua_tonumber
(
L
,
2
));
int32
lp
=
std
::
round
(
lua_tonumber
(
L
,
2
));
if
(
lp
<
0
)
lp
=
0
;
if
(
p
!=
0
&&
p
!=
1
)
return
0
;
...
...
libeffect.cpp
View file @
e4a284aa
...
...
@@ -264,7 +264,7 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if
(
lua_isboolean
(
L
,
2
))
peffect
->
value
=
lua_toboolean
(
L
,
2
);
else
peffect
->
value
=
round
(
lua_tonumber
(
L
,
2
));
peffect
->
value
=
std
::
round
(
lua_tonumber
(
L
,
2
));
}
return
0
;
}
...
...
playerop.cpp
View file @
e4a284aa
...
...
@@ -11,7 +11,6 @@
#include "card.h"
#include "ocgapi.h"
#include <memory.h>
#include <algorithm>
#include <stack>
...
...
@@ -263,15 +262,14 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
}
else
{
if
(
cancelable
&&
returns
.
ivalue
[
0
]
==
-
1
)
return
TRUE
;
byte
c
[
64
];
memset
(
c
,
0
,
64
);
if
(
returns
.
bvalue
[
0
]
<
min
||
returns
.
bvalue
[
0
]
>
max
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
uint8
m
=
core
.
select_cards
.
size
(),
v
=
0
;
byte
c
[
64
]
=
{};
uint8
m
=
core
.
select_cards
.
size
();
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
v
=
returns
.
bvalue
[
i
+
1
];
uint8
v
=
returns
.
bvalue
[
i
+
1
];
if
(
v
<
0
||
v
>=
m
||
v
>=
63
||
c
[
v
])
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
...
...
@@ -442,11 +440,11 @@ int32 field::select_place(uint16 step, uint8 playerid, uint32 flag, uint8 count)
returns
.
bvalue
[
0
]
=
0
;
return
FALSE
;
}
else
{
uint8
pt
=
0
,
p
,
l
,
s
;
uint8
pt
=
0
;
for
(
int8
i
=
0
;
i
<
count
;
++
i
)
{
p
=
returns
.
bvalue
[
pt
];
l
=
returns
.
bvalue
[
pt
+
1
];
s
=
returns
.
bvalue
[
pt
+
2
];
uint8
p
=
returns
.
bvalue
[
pt
];
uint8
l
=
returns
.
bvalue
[
pt
+
1
];
uint8
s
=
returns
.
bvalue
[
pt
+
2
];
if
((
p
!=
0
&&
p
!=
1
)
||
((
l
!=
LOCATION_MZONE
)
&&
(
l
!=
LOCATION_SZONE
))
||
((
0x1u
<<
s
)
&
(
flag
>>
(((
p
==
playerid
)
?
0
:
16
)
+
((
l
==
LOCATION_MZONE
)
?
0
:
8
)))))
{
...
...
@@ -516,10 +514,9 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
core
.
select_cards
.
size
());
card
*
pcard
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
pcard
=
core
.
select_cards
[
i
];
card
*
pcard
=
core
.
select_cards
[
i
];
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer8
(
pcard
->
current
.
controler
);
pduel
->
write_buffer8
(
pcard
->
current
.
location
);
...
...
@@ -530,12 +527,11 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
}
else
{
if
(
cancelable
&&
returns
.
ivalue
[
0
]
==
-
1
)
return
TRUE
;
byte
c
[
64
];
memset
(
c
,
0
,
64
);
if
(
returns
.
bvalue
[
0
]
>
max
)
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
byte
c
[
64
]
=
{};
uint8
m
=
core
.
select_cards
.
size
(),
tt
=
0
;
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
int8
v
=
returns
.
bvalue
[
i
+
1
];
...
...
@@ -663,8 +659,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
}
return
FALSE
;
}
else
{
byte
c
[
64
];
memset
(
c
,
0
,
64
);
byte
c
[
64
]
=
{};
if
(
max
)
{
int32
oparam
[
16
];
int32
mcount
=
core
.
must_select_cards
.
size
();
...
...
@@ -752,16 +747,17 @@ int32 field::sort_card(int16 step, uint8 playerid, uint8 is_chain) {
}
return
FALSE
;
}
else
{
if
(
returns
.
b
value
[
0
]
==
-
1
)
if
(
returns
.
i
value
[
0
]
==
-
1
)
return
TRUE
;
uint8
seq
[
64
];
memset
(
seq
,
0
,
64
);
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
if
(
returns
.
bvalue
[
i
]
<
0
||
returns
.
bvalue
[
i
]
>=
(
int32
)
core
.
select_cards
.
size
()
||
seq
[(
int32
)
returns
.
bvalue
[
i
]])
{
byte
c
[
64
]
=
{};
uint8
m
=
core
.
select_cards
.
size
();
for
(
uint8
i
=
0
;
i
<
m
;
++
i
)
{
uint8
v
=
returns
.
bvalue
[
i
];
if
(
v
<
0
||
v
>=
m
||
c
[
v
])
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
seq
[(
int32
)
returns
.
bvalue
[
i
]
]
=
1
;
c
[
v
]
=
1
;
}
return
TRUE
;
}
...
...
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