diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-28 23:04:08 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-28 23:04:08 +0000 |
commit | 391203d83ed7a72b54fb7d7c72dbe35db14f0ea9 (patch) | |
tree | a9a9e14bbbdde0b48c66b99038d505a42a51609b /src/main.cpp | |
parent | af61e1e7df91b97c3f7516e9eb2b37b621f069ad (diff) | |
download | mana-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.gz mana-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.bz2 mana-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.tar.xz mana-391203d83ed7a72b54fb7d7c72dbe35db14f0ea9.zip |
Merged trunk development between revisions 2530 and 2618 to the 0.1.0 branch.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 573b1a79..f540dacd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -330,6 +330,7 @@ struct Options bool chooseDefault; std::string username; std::string password; + std::string playername; }; void printHelp() @@ -341,13 +342,14 @@ void printHelp() << " -u --skipupdate : Skip the update process" << std::endl << " -U --username : Login with this username" << std::endl << " -P --password : Login with this password" << std::endl - << " -D --default : Bypass the login process with default settings" + << " -D --default : Bypass the login process with default settings" << std::endl + << " -p --playername : Login with this player" << std::endl; } void parseOptions(int argc, char *argv[], Options &options) { - const char *optstring = "huU:P:D"; + const char *optstring = "huU:P:Dp:"; const struct option long_options[] = { { "help", no_argument, 0, 'h' }, @@ -355,6 +357,7 @@ void parseOptions(int argc, char *argv[], Options &options) { "username", required_argument, 0, 'U' }, { "password", required_argument, 0, 'P' }, { "default", no_argument, 0, 'D' }, + { "playername", required_argument, 0, 'p' }, { 0 } }; @@ -382,6 +385,9 @@ void parseOptions(int argc, char *argv[], Options &options) case 'D': options.chooseDefault = true; break; + case 'p': + options.playername = optarg; + break; } } } @@ -668,7 +674,20 @@ int main(int argc, char *argv[]) case STATE_CHAR_SELECT: logger->log("State: CHAR_SELECT"); currentDialog = new CharSelectDialog(&charInfo); - if (options.chooseDefault) { + if (options.playername != "") { + n_character = 0; + while (((CharSelectDialog*) currentDialog)->getName() + != options.playername && + n_character < MAX_SLOT + 1) + { + ((CharSelectDialog*) currentDialog)->action("next", + NULL); + ((CharSelectDialog*) currentDialog)->updatePlayerInfo(); + n_character++; + } + n_character = MAX_SLOT + 1; + } + if (options.chooseDefault || options.playername != "") { ((CharSelectDialog*)currentDialog)->action("ok", NULL); } |