Commit d85f0da9 authored by DailyShana's avatar DailyShana

revert and clean up

parent 88524694
...@@ -269,7 +269,7 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi ...@@ -269,7 +269,7 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
byte c[64] = {}; byte c[64] = {};
uint8 m = core.select_cards.size(); uint8 m = core.select_cards.size();
for(int32 i = 0; i < returns.bvalue[0]; ++i) { for(int32 i = 0; i < returns.bvalue[0]; ++i) {
uint8 v = returns.bvalue[i + 1]; int8 v = returns.bvalue[i + 1];
if(v < 0 || v >= m || v >= 63 || c[v]) { if(v < 0 || v >= m || v >= 63 || c[v]) {
pduel->write_buffer8(MSG_RETRY); pduel->write_buffer8(MSG_RETRY);
return FALSE; return FALSE;
...@@ -747,12 +747,12 @@ int32 field::sort_card(int16 step, uint8 playerid, uint8 is_chain) { ...@@ -747,12 +747,12 @@ int32 field::sort_card(int16 step, uint8 playerid, uint8 is_chain) {
} }
return FALSE; return FALSE;
} else { } else {
if(returns.ivalue[0] == -1) if(returns.bvalue[0] == -1)
return TRUE; return TRUE;
byte c[64] = {}; byte c[64] = {};
uint8 m = core.select_cards.size(); uint8 m = core.select_cards.size();
for(uint8 i = 0; i < m; ++i) { for(uint8 i = 0; i < m; ++i) {
uint8 v = returns.bvalue[i]; int8 v = returns.bvalue[i];
if(v < 0 || v >= m || c[v]) { if(v < 0 || v >= m || c[v]) {
pduel->write_buffer8(MSG_RETRY); pduel->write_buffer8(MSG_RETRY);
return FALSE; return FALSE;
......
...@@ -674,9 +674,8 @@ int32 field::process() { ...@@ -674,9 +674,8 @@ int32 field::process() {
it->step++; it->step++;
} else { } else {
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
card* pcard;
for(int32 i = 0; i < returns.bvalue[0]; ++i) { for(int32 i = 0; i < returns.bvalue[0]; ++i) {
pcard = core.select_cards[returns.bvalue[i + 1]]; card* pcard = core.select_cards[returns.bvalue[i + 1]];
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
} }
pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP); pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP);
...@@ -719,9 +718,8 @@ int32 field::process() { ...@@ -719,9 +718,8 @@ int32 field::process() {
it->step++; it->step++;
} else { } else {
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
card* pcard;
for(int32 i = 0; i < returns.bvalue[0]; ++i) { for(int32 i = 0; i < returns.bvalue[0]; ++i) {
pcard = core.select_cards[returns.bvalue[i + 1]]; card* pcard = core.select_cards[returns.bvalue[i + 1]];
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
} }
pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP); pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP);
...@@ -735,9 +733,8 @@ int32 field::process() { ...@@ -735,9 +733,8 @@ int32 field::process() {
it->step++; it->step++;
} else { } else {
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
card* pcard;
for(int32 i = 0; i < returns.bvalue[0]; ++i) { for(int32 i = 0; i < returns.bvalue[0]; ++i) {
pcard = core.select_cards[returns.bvalue[i + 1]]; card* pcard = core.select_cards[returns.bvalue[i + 1]];
pgroup->container.insert(pcard); pgroup->container.insert(pcard);
} }
pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP); pduel->lua->add_param(pgroup, PARAM_TYPE_GROUP);
...@@ -852,11 +849,11 @@ int32 field::process() { ...@@ -852,11 +849,11 @@ int32 field::process() {
int32 playerid = it->arg1; int32 playerid = it->arg1;
int32 count = it->arg3; int32 count = it->arg3;
int32 dfflag = 0; int32 dfflag = 0;
uint8 p, l, s, pa = 0; uint8 pa = 0;
for(int32 i = 0; i < count; ++i) { for(int32 i = 0; i < count; ++i) {
p = returns.bvalue[pa]; uint8 p = returns.bvalue[pa];
l = returns.bvalue[pa + 1]; uint8 l = returns.bvalue[pa + 1];
s = returns.bvalue[pa + 2]; uint8 s = returns.bvalue[pa + 2];
dfflag |= 0x1u << (s + (p == playerid ? 0 : 16) + (l == LOCATION_MZONE ? 0 : 8)); dfflag |= 0x1u << (s + (p == playerid ? 0 : 16) + (l == LOCATION_MZONE ? 0 : 8));
pa += 3; pa += 3;
} }
...@@ -1007,9 +1004,8 @@ int32 field::process() { ...@@ -1007,9 +1004,8 @@ int32 field::process() {
it->step++; it->step++;
} else if(it->step == 1) { } else if(it->step == 1) {
card_set cset; card_set cset;
card* pcard;
for(int32 i = 0; i < returns.bvalue[0]; ++i) { for(int32 i = 0; i < returns.bvalue[0]; ++i) {
pcard = core.select_cards[returns.bvalue[i + 1]]; card* pcard = core.select_cards[returns.bvalue[i + 1]];
cset.insert(pcard); cset.insert(pcard);
} }
if(cset.size()) if(cset.size())
...@@ -1050,7 +1046,7 @@ int32 field::process() { ...@@ -1050,7 +1046,7 @@ int32 field::process() {
for(i = 0; i < count; ++i) for(i = 0; i < count; ++i)
player[target_player].list_main.pop_back(); player[target_player].list_main.pop_back();
for(i = 0; i < count; ++i) for(i = 0; i < count; ++i)
tc[(int32)returns.bvalue[i]] = core.select_cards[i]; tc[(uint8)returns.bvalue[i]] = core.select_cards[i];
for(i = 0; i < count; ++i) { for(i = 0; i < count; ++i) {
player[target_player].list_main.push_back(tc[count - i - 1]); player[target_player].list_main.push_back(tc[count - i - 1]);
tc[count - i - 1]->current.sequence = player[target_player].list_main.size() - 1; tc[count - i - 1]->current.sequence = player[target_player].list_main.size() - 1;
......
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