Commit 89b00401 authored by VanillaSalt's avatar VanillaSalt

add rule option

parent 1b1a62aa
......@@ -119,7 +119,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg.info.draw_count = _wtoi(mainGame->ebDrawCount->getText());
cscg.info.time_limit = _wtoi(mainGame->ebTimeLimit->getText());
cscg.info.lflist = mainGame->cbLFlist->getItemData(mainGame->cbLFlist->getSelected());
cscg.info.enable_priority = mainGame->chkEnablePriority->isChecked();
cscg.info.duel_rule = mainGame->cbDuelRule->getSelected();
cscg.info.no_check_deck = mainGame->chkNoCheckDeck->isChecked();
cscg.info.no_shuffle_deck = mainGame->chkNoShuffleDeck->isChecked();
SendPacketToServer(CTOS_CREATE_GAME, cscg);
......@@ -329,8 +329,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
str.append(msgbuf);
myswprintf(msgbuf, L"%ls%d\n", dataManager.GetSysString(1233), pkt->info.draw_count);
str.append(msgbuf);
if(pkt->info.enable_priority) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1236));
if(pkt->info.duel_rule != 2) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1260 + pkt->info.duel_rule));
str.append(msgbuf);
}
if(pkt->info.no_check_deck) {
......@@ -3441,7 +3441,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
hoststr.append(dataManager.GetSysString(pHP->host.mode + 1244));
hoststr.append(L"][");
if(pHP->host.draw_count == 1 && pHP->host.start_hand == 5 && pHP->host.start_lp == 8000
&& !pHP->host.no_check_deck && !pHP->host.no_shuffle_deck && ! pHP->host.enable_priority)
&& !pHP->host.no_check_deck && !pHP->host.no_shuffle_deck && pHP->host.duel_rule == 2)
hoststr.append(dataManager.GetSysString(1280));
else hoststr.append(dataManager.GetSysString(1281));
hoststr.append(L"]");
......
......@@ -134,7 +134,13 @@ bool Game::Initialize() {
ebTimeLimit = env->addEditBox(strbuf, rect<s32>(140, 115, 220, 140), true, wCreateHost);
ebTimeLimit->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1228), rect<s32>(20, 150, 320, 170), false, false, wCreateHost);
chkEnablePriority = env->addCheckBox(false, rect<s32>(20, 180, 360, 200), wCreateHost, -1, dataManager.GetSysString(1236));
env->addStaticText(dataManager.GetSysString(1236), rect<s32>(20, 180, 220, 200), false, false, wCreateHost);
cbDuelRule = env->addComboBox(rect<s32>(140, 175, 300, 200), wCreateHost);
cbDuelRule->addItem(dataManager.GetSysString(1260));
cbDuelRule->addItem(dataManager.GetSysString(1261));
cbDuelRule->addItem(dataManager.GetSysString(1262));
cbDuelRule->addItem(dataManager.GetSysString(1263));
cbDuelRule->setSelected(2);
chkNoCheckDeck = env->addCheckBox(false, rect<s32>(20, 210, 170, 230), wCreateHost, -1, dataManager.GetSysString(1229));
chkNoShuffleDeck = env->addCheckBox(false, rect<s32>(180, 210, 360, 230), wCreateHost, -1, dataManager.GetSysString(1230));
env->addStaticText(dataManager.GetSysString(1231), rect<s32>(20, 240, 320, 260), false, false, wCreateHost);
......
......@@ -235,7 +235,7 @@ public:
irr::gui::IGUIEditBox* ebDrawCount;
irr::gui::IGUIEditBox* ebServerName;
irr::gui::IGUIEditBox* ebServerPass;
irr::gui::IGUICheckBox* chkEnablePriority;
irr::gui::IGUIComboBox* cbDuelRule;
irr::gui::IGUICheckBox* chkNoCheckDeck;
irr::gui::IGUICheckBox* chkNoShuffleDeck;
irr::gui::IGUIButton* btnHostConfirm;
......
......@@ -15,7 +15,7 @@ struct HostInfo {
unsigned int lflist;
unsigned char rule;
unsigned char mode;
bool enable_priority;
unsigned char duel_rule;
bool no_check_deck;
bool no_shuffle_deck;
unsigned int start_lp;
......
......@@ -412,9 +412,7 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
pduel = create_duel(rnd.rand());
set_player_info(pduel, 0, host_info.start_lp, host_info.start_hand, host_info.draw_count);
set_player_info(pduel, 1, host_info.start_lp, host_info.start_hand, host_info.draw_count);
int opt = 0;
if(host_info.enable_priority)
opt |= DUEL_OBSOLETE_RULING;
int opt = ((int)host_info.duel_rule + 1) << 16;
if(host_info.no_shuffle_deck)
opt |= DUEL_PSEUDO_SHUFFLE;
last_replay.WriteInt32(host_info.start_lp, false);
......
......@@ -382,9 +382,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
pduel = create_duel(rnd.rand());
set_player_info(pduel, 0, host_info.start_lp, host_info.start_hand, host_info.draw_count);
set_player_info(pduel, 1, host_info.start_lp, host_info.start_hand, host_info.draw_count);
int opt = 0;
if(host_info.enable_priority)
opt |= DUEL_OBSOLETE_RULING;
int opt = ((int)host_info.duel_rule + 1) << 16;
if(host_info.no_shuffle_deck)
opt |= DUEL_PSEUDO_SHUFFLE;
opt |= DUEL_TAG_MODE;
......
Subproject commit 3c1db2fc6f1427bb560ce8ac6858da509ac7f832
Subproject commit c49a463fab6446c90354a12cb3f6377cb1c3bbba
Subproject commit f809dfae2533fcbd65679982d09fabc5275033ba
Subproject commit 5bac33f528c7838f1909fd4e460d1b9d5308bdf8
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