Commit b5e7bc61 authored by VanillaSalt's avatar VanillaSalt

update

parent 0e73e109
...@@ -118,6 +118,7 @@ public: ...@@ -118,6 +118,7 @@ public:
virtual bool OnEvent(const irr::SEvent& event); virtual bool OnEvent(const irr::SEvent& event);
void GetHoverField(int x, int y); void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y); void ShowMenu(int flag, int x, int y);
void SetResponseSelectedCards() const;
}; };
} }
......
...@@ -168,11 +168,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -168,11 +168,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: case MSG_SELECT_TRIBUTE:
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -566,11 +562,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -566,11 +562,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
int sel = selected_cards.size(); int sel = selected_cards.size();
if (sel >= select_max) { if (sel >= select_max) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
} else if (sel >= select_min) { } else if (sel >= select_min) {
select_ready = true; select_ready = true;
...@@ -585,11 +577,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -585,11 +577,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
command_card = selectable_cards[id - BUTTON_CARD_0 + mainGame->scrCardList->getPos() / 10]; command_card = selectable_cards[id - BUTTON_CARD_0 + mainGame->scrCardList->getPos() / 10];
selected_cards.push_back(command_card); selected_cards.push_back(command_card);
if (CheckSelectSum()) { if (CheckSelectSum()) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
} else { } else {
mainGame->wCardSelect->setVisible(false); mainGame->wCardSelect->setVisible(false);
...@@ -642,11 +630,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -642,11 +630,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
if(mainGame->dInfo.curMsg == MSG_SELECT_CARD) { if(mainGame->dInfo.curMsg == MSG_SELECT_CARD) {
if(select_ready) { if(select_ready) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
} }
break; break;
...@@ -1228,19 +1212,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1228,19 +1212,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
max += selected_cards[i]->opParam; max += selected_cards[i]->opParam;
} }
if (min >= select_max) { if (min >= select_max) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
DuelClient::SendResponse(); DuelClient::SendResponse();
} else if (max >= select_min) { } else if (max >= select_min) {
if(selected_cards.size() == selectable_cards.size()) { if(selected_cards.size() == selectable_cards.size()) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
DuelClient::SendResponse(); DuelClient::SendResponse();
} else { } else {
select_ready = true; select_ready = true;
...@@ -1291,11 +1267,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1291,11 +1267,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else break; else break;
if (CheckSelectSum()) { if (CheckSelectSum()) {
if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) { if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
DuelClient::SendResponse(); DuelClient::SendResponse();
} else { } else {
select_ready = true; select_ready = true;
...@@ -1365,20 +1337,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1365,20 +1337,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
if(select_ready) { if(select_ready) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
else else
...@@ -1398,11 +1362,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1398,11 +1362,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -1410,11 +1370,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1410,11 +1370,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
unsigned char respbuf[64]; SetResponseSelectedCards();
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -1938,4 +1894,12 @@ void ClientField::ShowMenu(int flag, int x, int y) { ...@@ -1938,4 +1894,12 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->wCmdMenu->setVisible(true); mainGame->wCmdMenu->setVisible(true);
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20)); mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20));
} }
void ClientField::SetResponseSelectedCards() const {
unsigned char respbuf[64];
respbuf[0] = selected_cards.size();
for (size_t i = 0; i < selected_cards.size(); ++i)
respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
}
} }
Subproject commit 4e0295fab88326b216e54b6da644676b42a609c4 Subproject commit dcde72e410c233b44a71cf2dd4112d036cc2d25e
Subproject commit 025e884fb70d0776610ce1301e367b9b331bdf79 Subproject commit 9f8bf9e40dfb023a2c95a14f708cd52c7e7d9521
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