Commit 642fb39a authored by edo9300's avatar edo9300

Fix

parent 78dcf33c
......@@ -178,7 +178,7 @@ bool Game::Initialize() {
for(int i = 0; i < 5; ++i)
chkCustomRules[i] = env->addCheckBox(false, recti(10, 10 + i * 20, 200, 30 + i * 20), wCustomRules, 353 + i, dataManager.GetSysString(1265 + i));
btnCustomRulesOK = env->addButton(rect<s32>(55, 130, 155, 155), wCustomRules, BUTTON_CUSTOM_RULE_OK, dataManager.GetSysString(1211));
duel_param = 0;
duel_param = MASTER_RULE_4;
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);
......@@ -1411,6 +1411,42 @@ int Game::LocalPlayer(int player) {
const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname;
}
void Game::UpdateDuelParam() {
uint32 flag = 0, filter = 0x100;
for (int i = 0; i < 5; ++i, filter <<= 1)
if (chkCustomRules[i]->isChecked()) {
flag |= filter;
}
cbDuelRule->clear();
cbDuelRule->addItem(dataManager.GetSysString(1260));
cbDuelRule->addItem(dataManager.GetSysString(1261));
cbDuelRule->addItem(dataManager.GetSysString(1262));
cbDuelRule->addItem(dataManager.GetSysString(1263));
switch (flag) {
case MASTER_RULE_1: {
cbDuelRule->setSelected(0);
break;
}
case MASTER_RULE_2: {
cbDuelRule->setSelected(1);
break;
}
case MASTER_RULE_3: {
cbDuelRule->setSelected(2);
break;
}
case MASTER_RULE_4: {
cbDuelRule->setSelected(3);
break;
}
default: {
cbDuelRule->addItem(dataManager.GetSysString(1264));
cbDuelRule->setSelected(4);
break;
}
}
duel_param = flag;
}
int Game::GetMasterRule(uint32 param, int* truerule) {
switch(param) {
case MASTER_RULE_1: {
......
......@@ -127,6 +127,7 @@ public:
int LocalPlayer(int player);
const wchar_t* LocalName(int local_player);
void UpdateDuelParam();
int GetMasterRule(uint32 param, int* truerule = 0);
bool HasFocus(EGUI_ELEMENT_TYPE type) const {
......
......@@ -161,40 +161,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CUSTOM_RULE_OK: {
uint32 flag = 0, filter = 0x100;
for(int i = 0; i < 5; ++i, filter <<= 1)
if(mainGame->chkCustomRules[i]->isChecked()) {
flag |= filter;
}
mainGame->cbDuelRule->clear();
mainGame->cbDuelRule->addItem(dataManager.GetSysString(1260));
mainGame->cbDuelRule->addItem(dataManager.GetSysString(1261));
mainGame->cbDuelRule->addItem(dataManager.GetSysString(1262));
mainGame->cbDuelRule->addItem(dataManager.GetSysString(1263));
switch (flag) {
case MASTER_RULE_1: {
mainGame->cbDuelRule->setSelected(0);
break;
}
case MASTER_RULE_2: {
mainGame->cbDuelRule->setSelected(1);
break;
}
case MASTER_RULE_3: {
mainGame->cbDuelRule->setSelected(2);
break;
}
case MASTER_RULE_4: {
mainGame->cbDuelRule->setSelected(3);
break;
}
default: {
mainGame->cbDuelRule->addItem(dataManager.GetSysString(1264));
mainGame->cbDuelRule->setSelected(4);
break;
}
}
mainGame->duel_param = flag;
mainGame->UpdateDuelParam();
mainGame->HideElement(mainGame->wCustomRules);
break;
}
......
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