Commit 0b10d0ae authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/Fluorohydride/ygopro

parents 95686225 ae29e5f2
......@@ -1207,28 +1207,31 @@ bool ClientField::CheckSelectSum() {
}
return ret;
} else {
int op1, op2, mm = -1, ms, m, max = 0, sumc = 0, sums;
int mm = -1, mx = -1, max = 0, sumc = 0;
bool ret = false;
for (size_t i = 0; i < selected_cards.size(); ++i) {
op1 = selected_cards[i]->opParam & 0xffff;
op2 = selected_cards[i]->opParam >> 16;
m = (op2 > 0 && op1 > op2) ? op2 : op1;
max += op2 > op1 ? op2 : op1;
if (mm == -1 || m < mm)
mm = m;
sumc += m;
int op1 = selected_cards[i]->opParam & 0xffff;
int op2 = selected_cards[i]->opParam >> 16;
int opmin = (op2 > 0 && op1 > op2) ? op2 : op1;
int opmax = op2 > op1 ? op2 : op1;
if (mm == -1 || opmin < mm)
mm = opmin;
if (mx == -1 || opmax < mx)
mx = opmax;
sumc += opmin;
max += opmax;
}
if (select_sumval <= sumc)
return true;
if (select_sumval <= max)
if (select_sumval <= max && select_sumval > max - mx)
ret = true;
for(sit = selable.begin(); sit != selable.end(); ++sit) {
op1 = (*sit)->opParam & 0xffff;
op2 = (*sit)->opParam >> 16;
m = op1;
sums = sumc;
int op1 = (*sit)->opParam & 0xffff;
int op2 = (*sit)->opParam >> 16;
int m = op1;
int sums = sumc;
sums += m;
ms = mm;
int ms = mm;
if (ms == -1 || m < ms)
ms = m;
if (sums >= select_sumval) {
......
......@@ -3275,7 +3275,7 @@ void DuelClient::SetResponseI(int respI) {
*((int*)response_buf) = respI;
response_len = 4;
}
void DuelClient::SetResponseB(unsigned char * respB, unsigned char len) {
void DuelClient::SetResponseB(void* respB, unsigned char len) {
memcpy(response_buf, respB, len);
response_len = len;
}
......
......@@ -42,7 +42,7 @@ public:
static void HandleSTOCPacketLan(char* data, unsigned int len);
static int ClientAnalyze(char* msg, unsigned int len);
static void SetResponseI(int respI);
static void SetResponseB(unsigned char* respB, unsigned char len);
static void SetResponseB(void* respB, unsigned char len);
static void SendResponse();
static void SendPacketToServer(unsigned char proto) {
char* p = duel_client_write;
......
......@@ -1453,12 +1453,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
clicked_card->is_selectable = false;
select_counter_count--;
if (select_counter_count == 0) {
unsigned char respbuf[64];
unsigned short int respbuf[32];
for(size_t i = 0; i < selectable_cards.size(); ++i)
respbuf[i] = (selectable_cards[i]->opParam >> 16) - (selectable_cards[i]->opParam & 0xffff);
mainGame->stHintMsg->setVisible(false);
ClearSelect();
DuelClient::SetResponseB(respbuf, selectable_cards.size());
DuelClient::SetResponseB(respbuf, selectable_cards.size() * 2);
DuelClient::SendResponse();
} else {
wchar_t formatBuffer[2048];
......@@ -1860,7 +1860,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) {
case irr::KEY_KEY_A: {
if(mainGame->gameConf.control_mode == 0) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->always_chain = event.KeyInput.PressedDown;
mainGame->ignore_chain = false;
mainGame->chain_when_avail = false;
......@@ -1869,7 +1869,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case irr::KEY_KEY_S: {
if(mainGame->gameConf.control_mode == 0) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->ignore_chain = event.KeyInput.PressedDown;
mainGame->always_chain = false;
mainGame->chain_when_avail = false;
......@@ -1878,7 +1878,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case irr::KEY_KEY_D: {
if(mainGame->gameConf.control_mode == 0) {
if(mainGame->gameConf.control_mode == 0 && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->chain_when_avail = event.KeyInput.PressedDown;
mainGame->always_chain = false;
mainGame->ignore_chain = false;
......
......@@ -14,7 +14,7 @@
#include <dirent.h>
#endif
const unsigned short PRO_VERSION = 0x133C;
const unsigned short PRO_VERSION = 0x133D;
namespace ygo {
......
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