summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-25 21:31:57 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-25 21:31:57 +0000
commitb08056a18524d65924e2eb3e3ea4b7843e492cca (patch)
tree5e7186eb1dcf59f51f52370ab179a15bfd3be8f5
parent833abc3732c87ed4822fa31065f84d857e9018cc (diff)
downloadmana-b08056a18524d65924e2eb3e3ea4b7843e492cca.tar.gz
mana-b08056a18524d65924e2eb3e3ea4b7843e492cca.tar.bz2
mana-b08056a18524d65924e2eb3e3ea4b7843e492cca.tar.xz
mana-b08056a18524d65924e2eb3e3ea4b7843e492cca.zip
Applied patch by Matthias, adding --playername command line option.
-rw-r--r--ChangeLog20
-rw-r--r--src/gui/char_select.cpp5
-rw-r--r--src/gui/char_select.h5
-rw-r--r--src/main.cpp27
4 files changed, 46 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 0cef2212..448185d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
-2006-08-25 Philipp Sehmisch <tmw@crushnet.org>
-
+2006-08-25 Matthias Hartmann <hartmann.matthias@gmail.com>
+
+ * src/gui/char_select.cpp, src/gui/char_select.h, src/main.cpp: Added
+ --playername command line option for selecting the character you want
+ to play with (patch applied by Bjørn Lindeijer).
+
+2006-08-25 Philipp Sehmisch <tmw@crushnet.org>
+
* src/engine.cpp, src/map.h, src/map.cpp: Addded new config variable
- "OverlayDetail" to control the number of drawn overlays.
+ "OverlayDetail" to control the number of drawn overlays.
2 (or more) = all (default), 1 = only the first one, 0 = none.
2006-08-24 Eugenio Favalli <elvenprogrammer@gmail.com>
@@ -12,7 +18,7 @@
* data/items.xml: Added jeans shorts.
2006-08-24 Philipp Sehmisch <tmw@crushnet.org>
-
+
* src/engine.cpp: Scrolling speed no longer affected by framerate.
* src/map.cpp, scr/map.h: Overlay speed no longer affected by
framerate.
@@ -28,12 +34,12 @@
data/graphics/items/armor-legs-jeanshorts: Added the equip graphics of
the short jeans and the cotton shorts and an inventory icon of the
cotton shorts. Also added all added files to the makefile.
-
+
2006-08-23 Philipp Sehmisch <tmw@crushnet.org>
- * data/maps/new_7-1.tmx.gz: fixed a minor mapping bug reported on the
+ * data/maps/new_7-1.tmx.gz: Fixed a minor mapping bug reported on the
forum (no new walkmap required).
- * data/maps/new_9-1.tmx.gz: fixed two minor mapping bugs (new walkmap
+ * data/maps/new_9-1.tmx.gz: Fixed two minor mapping bugs (new walkmap
required).
2006-08-22 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index e6a6a381..c52f73a9 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -228,6 +228,11 @@ void CharSelectDialog::logic()
updatePlayerInfo();
}
+std::string CharSelectDialog::getName()
+{
+ return mNameLabel->getCaption();
+}
+
CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
unsigned char sex):
Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 20105516..6784c073 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -57,6 +57,11 @@ class CharSelectDialog : public Window, public gcn::ActionListener
void logic();
+ /**
+ * Returns name of selected player
+ */
+ std::string getName();
+
private:
Network *mNetwork;
LockedArray<LocalPlayer*> *mCharInfo;
diff --git a/src/main.cpp b/src/main.cpp
index d2190de4..3a1cdf7d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -322,6 +322,7 @@ struct Options
bool chooseDefault;
std::string username;
std::string password;
+ std::string playername;
};
void printHelp()
@@ -333,13 +334,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' },
@@ -347,6 +349,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 }
};
@@ -374,6 +377,9 @@ void parseOptions(int argc, char *argv[], Options &options)
case 'D':
options.chooseDefault = true;
break;
+ case 'p':
+ options.playername = optarg;
+ break;
}
}
}
@@ -628,7 +634,7 @@ int main(int argc, char *argv[])
case CHAR_SERVER_STATE:
logger->log("State: CHAR_SERVER");
currentDialog = new ServerSelectDialog(&loginData);
- if (options.chooseDefault) {
+ if (options.chooseDefault || options.playername != "") {
((ServerSelectDialog*)currentDialog)->action("ok",
NULL);
}
@@ -638,7 +644,20 @@ int main(int argc, char *argv[])
logger->log("State: CHAR_SELECT");
currentDialog = new CharSelectDialog(network, &charInfo,
1 - loginData.sex);
- 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);
}