@@ -1208,8 +1208,8 @@ bool ClientField::CheckSelectSum() {
12081208 int mm = -1 , mx = -1 , max = 0 , sumc = 0 ;
12091209 bool ret = false ;
12101210 for (auto sc : selected_cards) {
1211- int op1 = sc-> opParam & 0xffff ;
1212- int op2 = sc->opParam >> 16 ;
1211+ int op1, op2 ;
1212+ get_sum_params ( sc->opParam , op1, op2) ;
12131213 int opmin = (op2 > 0 && op1 > op2) ? op2 : op1;
12141214 int opmax = op2 > op1 ? op2 : op1;
12151215 if (mm == -1 || opmin < mm)
@@ -1224,8 +1224,8 @@ bool ClientField::CheckSelectSum() {
12241224 if (select_sumval <= max && select_sumval > max - mx)
12251225 ret = true ;
12261226 for (auto sc : selable) {
1227- int op1 = sc-> opParam & 0xffff ;
1228- int op2 = sc->opParam >> 16 ;
1227+ int op1, op2 ;
1228+ get_sum_params ( sc->opParam , op1, op2) ;
12291229 int m = op1;
12301230 int sums = sumc;
12311231 sums += m;
@@ -1291,11 +1291,19 @@ bool ClientField::CheckSelectTribute() {
12911291 }
12921292 return ret;
12931293}
1294+ void ClientField::get_sum_params (unsigned int opParam, int & op1, int & op2) {
1295+ op1 = opParam & 0xffff ;
1296+ op2 = (opParam >> 16 ) & 0xffff ;
1297+ if (op2 & 0x8000 ) {
1298+ op1 = opParam & 0x7fffffff ;
1299+ op2 = 0 ;
1300+ }
1301+ }
12941302bool ClientField::check_min (const std::set<ClientCard*>& left, std::set<ClientCard*>::const_iterator index, int min, int max) {
12951303 if (index == left.end ())
12961304 return false ;
1297- int op1 = (*index)-> opParam & 0xffff ;
1298- int op2 = ( *index)->opParam >> 16 ;
1305+ int op1, op2 ;
1306+ get_sum_params (( *index)->opParam , op1, op2) ;
12991307 int m = (op2 > 0 && op1 > op2) ? op2 : op1;
13001308 if (m >= min && m <= max)
13011309 return true ;
@@ -1314,9 +1322,8 @@ bool ClientField::check_sel_sum_s(const std::set<ClientCard*>& left, int index,
13141322 check_sel_sum_t (left, acc);
13151323 return false ;
13161324 }
1317- int l = selected_cards[index]->opParam ;
1318- int l1 = l & 0xffff ;
1319- int l2 = l >> 16 ;
1325+ int l1, l2;
1326+ get_sum_params (selected_cards[index]->opParam , l1, l2);
13201327 bool res1 = false , res2 = false ;
13211328 res1 = check_sel_sum_s (left, index + 1 , acc - l1);
13221329 if (l2 > 0 )
@@ -1330,9 +1337,8 @@ void ClientField::check_sel_sum_t(const std::set<ClientCard*>& left, int acc) {
13301337 continue ;
13311338 std::set<ClientCard*> testlist (left);
13321339 testlist.erase (*sit);
1333- int l = (*sit)->opParam ;
1334- int l1 = l & 0xffff ;
1335- int l2 = l >> 16 ;
1340+ int l1, l2;
1341+ get_sum_params ((*sit)->opParam , l1, l2);
13361342 if (check_sum (testlist.begin (), testlist.end (), acc - l1, count)
13371343 || (l2 > 0 && check_sum (testlist.begin (), testlist.end (), acc - l2, count))) {
13381344 selectsum_cards.insert (*sit);
@@ -1344,9 +1350,8 @@ bool ClientField::check_sum(std::set<ClientCard*>::const_iterator index, std::se
13441350 return count >= select_min && count <= select_max;
13451351 if (acc < 0 || index == end)
13461352 return false ;
1347- int l = (*index)->opParam ;
1348- int l1 = l & 0xffff ;
1349- int l2 = l >> 16 ;
1353+ int l1, l2;
1354+ get_sum_params ((*index)->opParam , l1, l2);
13501355 if ((l1 == acc || (l2 > 0 && l2 == acc)) && (count + 1 >= select_min) && (count + 1 <= select_max))
13511356 return true ;
13521357 ++index;
@@ -1361,9 +1366,8 @@ bool ClientField::check_sel_sum_trib_s(const std::set<ClientCard*>& left, int in
13611366 check_sel_sum_trib_t (left, acc);
13621367 return acc >= select_min && acc <= select_max;
13631368 }
1364- int l = selected_cards[index]->opParam ;
1365- int l1 = l & 0xffff ;
1366- int l2 = l >> 16 ;
1369+ int l1, l2;
1370+ get_sum_params (selected_cards[index]->opParam , l1, l2);
13671371 bool res1 = false , res2 = false ;
13681372 res1 = check_sel_sum_trib_s (left, index + 1 , acc + l1);
13691373 if (l2 > 0 )
@@ -1376,9 +1380,8 @@ void ClientField::check_sel_sum_trib_t(const std::set<ClientCard*>& left, int ac
13761380 continue ;
13771381 std::set<ClientCard*> testlist (left);
13781382 testlist.erase (*sit);
1379- int l = (*sit)->opParam ;
1380- int l1 = l & 0xffff ;
1381- int l2 = l >> 16 ;
1383+ int l1, l2;
1384+ get_sum_params ((*sit)->opParam , l1, l2);
13821385 if (check_sum_trib (testlist.begin (), testlist.end (), acc + l1)
13831386 || (l2 > 0 && check_sum_trib (testlist.begin (), testlist.end (), acc + l2))) {
13841387 selectsum_cards.insert (*sit);
@@ -1390,9 +1393,8 @@ bool ClientField::check_sum_trib(std::set<ClientCard*>::const_iterator index, st
13901393 return true ;
13911394 if (acc > select_max || index == end)
13921395 return false ;
1393- int l = (*index)->opParam ;
1394- int l1 = l & 0xffff ;
1395- int l2 = l >> 16 ;
1396+ int l1, l2;
1397+ get_sum_params ((*index)->opParam , l1, l2);
13961398 if ((acc + l1 >= select_min && acc + l1 <= select_max) || (acc + l2 >= select_min && acc + l2 <= select_max))
13971399 return true ;
13981400 ++index;
0 commit comments