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