Commit 0962bce7 authored by VanillaSalt's avatar VanillaSalt

fix

parent 29980b7f
...@@ -1112,7 +1112,7 @@ bool ClientField::check_min(std::set<ClientCard*>& left, std::set<ClientCard*>:: ...@@ -1112,7 +1112,7 @@ bool ClientField::check_min(std::set<ClientCard*>& left, std::set<ClientCard*>::
int m = (op2 > 0 && op1 > op2) ? op2 : op1; int m = (op2 > 0 && op1 > op2) ? op2 : op1;
if (m >= min && m <= max) if (m >= min && m <= max)
return true; return true;
index++; ++index;
return (min > m && check_min(left, index, min - m, max - m)) return (min > m && check_min(left, index, min - m, max - m))
|| check_min(left, index, min, max); || check_min(left, index, min, max);
} }
...@@ -1158,7 +1158,7 @@ bool ClientField::check_sum(std::set<ClientCard*>& testlist, std::set<ClientCard ...@@ -1158,7 +1158,7 @@ bool ClientField::check_sum(std::set<ClientCard*>& testlist, std::set<ClientCard
int l2 = l >> 16; int l2 = l >> 16;
if ((l1 == acc || (l2 > 0 && l2 == acc)) && (count + 1 >= select_min) && (count + 1 <= select_max)) if ((l1 == acc || (l2 > 0 && l2 == acc)) && (count + 1 >= select_min) && (count + 1 <= select_max))
return true; return true;
index++; ++index;
return (acc > l1 && check_sum(testlist, index, acc - l1, count + 1)) return (acc > l1 && check_sum(testlist, index, acc - l1, count + 1))
|| (l2 > 0 && acc > l2 && check_sum(testlist, index, acc - l2, count + 1)) || (l2 > 0 && acc > l2 && check_sum(testlist, index, acc - l2, count + 1))
|| check_sum(testlist, index, acc, count); || check_sum(testlist, index, acc, count);
......
...@@ -46,9 +46,10 @@ bool card::card_operation_sort(card* c1, card* c2) { ...@@ -46,9 +46,10 @@ bool card::card_operation_sort(card* c1, card* c2) {
return c1->current.sequence < c2->current.sequence; return c1->current.sequence < c2->current.sequence;
} }
} }
card::card() { card::card(duel* pd) {
scrtype = 1; scrtype = 1;
ref_handle = 0; ref_handle = 0;
pduel = pd;
owner = PLAYER_NONE; owner = PLAYER_NONE;
operation_param = 0; operation_param = 0;
status = 0; status = 0;
......
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
effect_relation relate_effect; effect_relation relate_effect;
effect_set_v immune_effect; effect_set_v immune_effect;
card(); explicit card(duel* pd);
~card(); ~card();
static bool card_operation_sort(card* c1, card* c2); static bool card_operation_sort(card* c1, card* c2);
......
...@@ -17,9 +17,7 @@ ...@@ -17,9 +17,7 @@
duel::duel() { duel::duel() {
lua = new interpreter(this); lua = new interpreter(this);
game_field = new field(this); game_field = new field(this);
game_field->temp_card = new_card(0); clear_buffer();
bufferlen = 0;
bufferp = buffer;
} }
duel::~duel() { duel::~duel() {
for(std::set<card*>::iterator cit = cards.begin(); cit != cards.end(); ++cit) for(std::set<card*>::iterator cit = cards.begin(); cit != cards.end(); ++cit)
...@@ -43,15 +41,13 @@ void duel::clear() { ...@@ -43,15 +41,13 @@ void duel::clear() {
groups.clear(); groups.clear();
effects.clear(); effects.clear();
game_field = new field(this); game_field = new field(this);
game_field->temp_card = new_card(0);
} }
card* duel::new_card(uint32 code) { card* duel::new_card(uint32 code) {
card* pcard = new card(); card* pcard = new card(this);
cards.insert(pcard); cards.insert(pcard);
if(code) if(code)
::read_card(code, &(pcard->data)); ::read_card(code, &(pcard->data));
pcard->data.code = code; pcard->data.code = code;
pcard->pduel = this;
lua->register_card(pcard); lua->register_card(pcard);
return pcard; return pcard;
} }
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
int32 value; int32 value;
int32 operation; int32 operation;
effect(duel* pd); explicit effect(duel* pd);
~effect(); ~effect();
int32 is_disable_related(); int32 is_disable_related();
......
...@@ -25,6 +25,7 @@ bool tevent::operator< (const tevent& v) const { ...@@ -25,6 +25,7 @@ bool tevent::operator< (const tevent& v) const {
} }
field::field(duel* pduel) { field::field(duel* pduel) {
this->pduel = pduel; this->pduel = pduel;
temp_card = pduel->new_card(0);
infos.copy_id = 1; infos.copy_id = 1;
infos.turn_player = 0; infos.turn_player = 0;
infos.turn_id = 0; infos.turn_id = 0;
......
...@@ -312,7 +312,7 @@ public: ...@@ -312,7 +312,7 @@ public:
tevent nil_event; tevent nil_event;
static int32 field_used_count[32]; static int32 field_used_count[32];
field(duel* pduel); explicit field(duel* pduel);
~field(); ~field();
void reload_field_info(); void reload_field_info();
......
...@@ -22,7 +22,7 @@ group::group(duel* pd, card* pcard) { ...@@ -22,7 +22,7 @@ group::group(duel* pd, card* pcard) {
pduel = pd; pduel = pd;
is_readonly = FALSE; is_readonly = FALSE;
} }
group::group(duel* pd, const card_set& cset) : container(cset) { group::group(duel* pd, const card_set& cset): container(cset) {
scrtype = 2; scrtype = 2;
ref_handle = 0; ref_handle = 0;
pduel = pd; pduel = pd;
......
...@@ -42,7 +42,8 @@ public: ...@@ -42,7 +42,8 @@ public:
coroutine_map coroutines; coroutine_map coroutines;
int32 no_action; int32 no_action;
int32 call_depth; int32 call_depth;
interpreter(duel* pd);
explicit interpreter(duel* pd);
~interpreter(); ~interpreter();
int32 register_card(card *pcard); int32 register_card(card *pcard);
......
...@@ -2444,7 +2444,6 @@ int32 scriptlib::duel_select_xyz_material(lua_State *L) { ...@@ -2444,7 +2444,6 @@ int32 scriptlib::duel_select_xyz_material(lua_State *L) {
uint32 lv = lua_tointeger(L, 4); uint32 lv = lua_tointeger(L, 4);
uint32 minc = lua_tointeger(L, 5); uint32 minc = lua_tointeger(L, 5);
uint32 maxc = lua_tointeger(L, 6); uint32 maxc = lua_tointeger(L, 6);
field::card_set mat, cset;
duel* pduel = scard->pduel; duel* pduel = scard->pduel;
pduel->game_field->get_xyz_material(scard, findex, lv, maxc); pduel->game_field->get_xyz_material(scard, findex, lv, maxc);
scard->pduel->game_field->add_process(PROCESSOR_SELECT_XMATERIAL, 0, 0, (group*)scard, playerid + (lv << 16), minc + (maxc << 16)); scard->pduel->game_field->add_process(PROCESSOR_SELECT_XMATERIAL, 0, 0, (group*)scard, playerid + (lv << 16), minc + (maxc << 16));
......
...@@ -101,7 +101,7 @@ int32 scriptlib::group_get_next(lua_State *L) { ...@@ -101,7 +101,7 @@ int32 scriptlib::group_get_next(lua_State *L) {
if(pgroup->it == pgroup->container.end()) if(pgroup->it == pgroup->container.end())
lua_pushnil(L); lua_pushnil(L);
else { else {
pgroup->it++; ++pgroup->it;
if (pgroup->it == pgroup->container.end()) if (pgroup->it == pgroup->container.end())
lua_pushnil(L); lua_pushnil(L);
else else
...@@ -386,7 +386,7 @@ int32 scriptlib::group_get_min_group(lua_State *L) { ...@@ -386,7 +386,7 @@ int32 scriptlib::group_get_min_group(lua_State *L) {
field::card_set::iterator cit = pgroup->container.begin(); field::card_set::iterator cit = pgroup->container.begin();
min = pduel->lua->get_operation_value(*cit, 2, extraargs); min = pduel->lua->get_operation_value(*cit, 2, extraargs);
newgroup->container.insert(*cit); newgroup->container.insert(*cit);
cit++; ++cit;
for(; cit != pgroup->container.end(); ++cit) { for(; cit != pgroup->container.end(); ++cit) {
op = pduel->lua->get_operation_value(*cit, 2, extraargs); op = pduel->lua->get_operation_value(*cit, 2, extraargs);
if(op == min) if(op == min)
...@@ -415,7 +415,7 @@ int32 scriptlib::group_get_max_group(lua_State *L) { ...@@ -415,7 +415,7 @@ int32 scriptlib::group_get_max_group(lua_State *L) {
field::card_set::iterator cit = pgroup->container.begin(); field::card_set::iterator cit = pgroup->container.begin();
max = pduel->lua->get_operation_value(*cit, 2, extraargs); max = pduel->lua->get_operation_value(*cit, 2, extraargs);
newgroup->container.insert(*cit); newgroup->container.insert(*cit);
cit++; ++cit;
for(; cit != pgroup->container.end(); ++cit) { for(; cit != pgroup->container.end(); ++cit) {
op = pduel->lua->get_operation_value(*cit, 2, extraargs); op = pduel->lua->get_operation_value(*cit, 2, extraargs);
if(op == max) if(op == max)
......
...@@ -2174,7 +2174,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -2174,7 +2174,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
core.delayed_quick_break.erase(make_pair(peffect, *evit)); core.delayed_quick_break.erase(make_pair(peffect, *evit));
} }
} }
evit++; ++evit;
if(pev && evit == core.point_event.end()) { if(pev && evit == core.point_event.end()) {
evit = core.instant_event.begin(); evit = core.instant_event.begin();
pev = false; pev = false;
...@@ -4709,10 +4709,8 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4709,10 +4709,8 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
if(cait->opinfos.count(0x200) && (core.units.begin()->arg2 != core.spsummon_state_count[cait->triggering_player])) if(cait->opinfos.count(0x200) && (core.units.begin()->arg2 != core.spsummon_state_count[cait->triggering_player]))
set_spsummon_counter(cait->triggering_player, false); set_spsummon_counter(cait->triggering_player, false);
}*/ }*/
if(core.special_summoning.size()) core.special_summoning.clear();
core.special_summoning.clear(); core.equiping_cards.clear();
if(core.equiping_cards.size())
core.equiping_cards.clear();
return FALSE; return FALSE;
} }
case 4: { case 4: {
......
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