Commit 9b9ddb8d authored by DailyShana's avatar DailyShana

backward compatibility

parent 2fa138f1
...@@ -17,7 +17,6 @@ void GetParameter(char* param, const char* arg) { ...@@ -17,7 +17,6 @@ void GetParameter(char* param, const char* arg) {
strcpy(param, arg1); strcpy(param, arg1);
#endif #endif
} }
void GetParameterW(wchar_t* param, const char* arg) { void GetParameterW(wchar_t* param, const char* arg) {
#ifdef _WIN32 #ifdef _WIN32
MultiByteToWideChar(CP_ACP, 0, arg, -1, param, 260); MultiByteToWideChar(CP_ACP, 0, arg, -1, param, 260);
...@@ -25,7 +24,6 @@ void GetParameterW(wchar_t* param, const char* arg) { ...@@ -25,7 +24,6 @@ void GetParameterW(wchar_t* param, const char* arg) {
BufferIO::DecodeUTF8(arg, param); BufferIO::DecodeUTF8(arg, param);
#endif #endif
} }
void ClickButton(irr::gui::IGUIElement* btn) { void ClickButton(irr::gui::IGUIElement* btn) {
irr::SEvent event; irr::SEvent event;
event.EventType = irr::EET_GUI_EVENT; event.EventType = irr::EET_GUI_EVENT;
...@@ -50,31 +48,41 @@ int main(int argc, char* argv[]) { ...@@ -50,31 +48,41 @@ int main(int argc, char* argv[]) {
return 0; return 0;
for(int i = 1; i < argc; ++i) { for(int i = 1; i < argc; ++i) {
if(argv[i][0] == '-' && argv[i][1] == 'e') {
char param[128];
GetParameter(param, &argv[i][2]);
ygo::dataManager.LoadDB(param);
}
if(!strcmp(argv[i], "-e")) { // extra database if(!strcmp(argv[i], "-e")) { // extra database
++i; ++i;
char param[128]; char param[128];
GetParameter(param, &argv[i][0]); GetParameter(param, &argv[i][0]);
ygo::dataManager.LoadDB(param); ygo::dataManager.LoadDB(param);
continue;
} else if(!strcmp(argv[i], "-n")) { // nickName } else if(!strcmp(argv[i], "-n")) { // nickName
++i; ++i;
wchar_t param[128]; wchar_t param[128];
GetParameterW(param, &argv[i][0]); GetParameterW(param, &argv[i][0]);
ygo::mainGame->ebNickName->setText(param); ygo::mainGame->ebNickName->setText(param);
continue;
} else if(!strcmp(argv[i], "-h")) { // Host address } else if(!strcmp(argv[i], "-h")) { // Host address
++i; ++i;
wchar_t param[128]; wchar_t param[128];
GetParameterW(param, &argv[i][0]); GetParameterW(param, &argv[i][0]);
ygo::mainGame->ebJoinIP->setText(param); ygo::mainGame->ebJoinIP->setText(param);
continue;
} else if(!strcmp(argv[i], "-p")) { // host Port } else if(!strcmp(argv[i], "-p")) { // host Port
++i; ++i;
wchar_t param[128]; wchar_t param[128];
GetParameterW(param, &argv[i][0]); GetParameterW(param, &argv[i][0]);
ygo::mainGame->ebJoinPort->setText(param); ygo::mainGame->ebJoinPort->setText(param);
continue;
} else if(!strcmp(argv[i], "-w")) { // host passWord } else if(!strcmp(argv[i], "-w")) { // host passWord
++i; ++i;
wchar_t param[128]; wchar_t param[128];
GetParameterW(param, &argv[i][0]); GetParameterW(param, &argv[i][0]);
ygo::mainGame->ebJoinPass->setText(param); ygo::mainGame->ebJoinPass->setText(param);
continue;
} else if(!strcmp(argv[i], "-x")) { // eXit on return } else if(!strcmp(argv[i], "-x")) { // eXit on return
exit_on_return = true; exit_on_return = true;
} else if(!strcmp(argv[i], "-j")) { // Join host } else if(!strcmp(argv[i], "-j")) { // Join host
...@@ -107,7 +115,6 @@ int main(int argc, char* argv[]) { ...@@ -107,7 +115,6 @@ int main(int argc, char* argv[]) {
ClickButton(ygo::mainGame->btnLoadSinglePlay); ClickButton(ygo::mainGame->btnLoadSinglePlay);
break; break;
} }
} }
ygo::mainGame->MainLoop(); ygo::mainGame->MainLoop();
#ifdef _WIN32 #ifdef _WIN32
......
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