summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-09-13 22:34:17 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-09-13 22:34:17 +0000
commit4423d208ad7dc1ed3967d715642595f4fd1e6faf (patch)
treedeb3bfb729401a5b260007154ed58241291e1524
parent6c1bf893c93bcfe8115d102eea7460e07b799aac (diff)
downloadmana-4423d208ad7dc1ed3967d715642595f4fd1e6faf.tar.gz
mana-4423d208ad7dc1ed3967d715642595f4fd1e6faf.tar.bz2
mana-4423d208ad7dc1ed3967d715642595f4fd1e6faf.tar.xz
mana-4423d208ad7dc1ed3967d715642595f4fd1e6faf.zip
Fix up the player selection command line option.
-rw-r--r--ChangeLog4
-rw-r--r--src/main.cpp31
2 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index cfd524d3..b0d71167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-14 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/main.cpp: Fix up the player selection command line option.
+
2006-09-12 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/game.cpp, src/game.h: Simplified fps limiting a bit and added
diff --git a/src/main.cpp b/src/main.cpp
index 17d00949..127b2a84 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -653,23 +653,24 @@ int main(int argc, char *argv[])
logger->log("State: CHAR_SELECT");
currentDialog = new CharSelectDialog(network, &charInfo,
1 - loginData.sex);
+
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);
+ charInfo.select(0);
+ do {
+ LocalPlayer *player = charInfo.getEntry();
+
+ if (player && player->getName() ==
+ options.playername) {
+ options.chooseDefault = true;
+ break;
+ }
+
+ charInfo.next();
+ } while (charInfo.getPos());
}
+
+ if (options.chooseDefault)
+ ((CharSelectDialog*)currentDialog)->action("ok", NULL);
break;
case GAME_STATE: