Commit 8ededdfd authored by salix5's avatar salix5

const reference in field::special_summon

parent 0adcaa52
...@@ -575,7 +575,7 @@ public: ...@@ -575,7 +575,7 @@ public:
void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE); void summon(uint32 sumplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE);
void mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE); void mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_count, uint32 min_tribute, uint32 zone = 0x1f, uint32 action_type = SUMMON_IN_IDLE);
void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type = SUMMON_IN_IDLE); void special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type = SUMMON_IN_IDLE);
void special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone); void special_summon(const card_set& target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone); void special_summon_step(card* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone);
void special_summon_complete(effect* reason_effect, uint8 reason_player); void special_summon_complete(effect* reason_effect, uint8 reason_player);
void destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid = 2, uint32 destination = 0, uint32 sequence = 0); void destroy(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid = 2, uint32 destination = 0, uint32 sequence = 0);
......
...@@ -577,11 +577,10 @@ int32 scriptlib::duel_special_summon(lua_State *L) { ...@@ -577,11 +577,10 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
if(lua_gettop(L) >= 8) if(lua_gettop(L) >= 8)
zone = (uint32)lua_tointeger(L, 8); zone = (uint32)lua_tointeger(L, 8);
if(pcard) { if(pcard) {
card_set cset; card_set cset{ pcard };
cset.insert(pcard); pduel->game_field->special_summon(cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
pduel->game_field->special_summon(&cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
} else } else
pduel->game_field->special_summon(&(pgroup->container), sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone); pduel->game_field->special_summon(pgroup->container, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
lua_pushinteger(L, pduel->game_field->returns.ivalue[0]); lua_pushinteger(L, pduel->game_field->returns.ivalue[0]);
......
...@@ -158,10 +158,10 @@ void field::mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_cou ...@@ -158,10 +158,10 @@ void field::mset(uint32 setplayer, card* target, effect* proc, uint32 ignore_cou
void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type) { void field::special_summon_rule(uint32 sumplayer, card* target, uint32 summon_type, uint32 action_type) {
add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type, action_type); add_process(PROCESSOR_SPSUMMON_RULE, 0, 0, (group*)target, sumplayer, summon_type, action_type);
} }
void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) { void field::special_summon(const card_set& target, uint32 sumtype, uint32 sumplayer, uint32 playerid, uint32 nocheck, uint32 nolimit, uint32 positions, uint32 zone) {
if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT)) if((positions & POS_FACEDOWN) && is_player_affected_by_effect(sumplayer, EFFECT_DIVINE_LIGHT))
positions = (positions & POS_FACEUP) | ((positions & POS_FACEDOWN) >> 1); positions = (positions & POS_FACEUP) | ((positions & POS_FACEDOWN) >> 1);
for(auto& pcard : *target) { for(auto& pcard : target) {
pcard->temp.reason = pcard->current.reason; pcard->temp.reason = pcard->current.reason;
pcard->temp.reason_effect = pcard->current.reason_effect; pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player; pcard->temp.reason_player = pcard->current.reason_player;
...@@ -172,7 +172,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u ...@@ -172,7 +172,7 @@ void field::special_summon(card_set* target, uint32 sumtype, uint32 sumplayer, u
pcard->current.reason_player = core.reason_player; pcard->current.reason_player = core.reason_player;
pcard->spsummon_param = (playerid << 24) + (nocheck << 16) + (nolimit << 8) + positions; pcard->spsummon_param = (playerid << 24) + (nocheck << 16) + (nolimit << 8) + positions;
} }
group* pgroup = pduel->new_group(*target); group* pgroup = pduel->new_group(target);
pgroup->is_readonly = GTYPE_READ_ONLY; pgroup->is_readonly = GTYPE_READ_ONLY;
add_process(PROCESSOR_SPSUMMON, 0, core.reason_effect, pgroup, core.reason_player, zone); add_process(PROCESSOR_SPSUMMON, 0, core.reason_effect, pgroup, core.reason_player, zone);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment