summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-10 19:00:34 +0000
committersmatz <smatz@openttd.org>2009-06-10 19:00:34 +0000
commit35635c62482bb7955d3f3633b5e22712a2039ce7 (patch)
treec2a0c8482b35b5a1326578bdbb8533e3d9d50e34 /src/openttd.cpp
parent3eb8f643fb17b34826370823cdc65d2aaf0958e4 (diff)
downloadopenttd-35635c62482bb7955d3f3633b5e22712a2039ce7.tar.xz
(svn r16555) -Feature [FS#570]: ability to enter server and company password via command line when joining a server (based on patch by Progman, Ammler and planetmaker)
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 50efa4f8c..e60325c8d 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -160,6 +160,8 @@ static void ShowHelp()
" -G seed = Set random seed\n"
#if defined(ENABLE_NETWORK)
" -n [ip:port#company]= Start networkgame\n"
+ " -p password = Password to join server\n"
+ " -P password = Password to join company\n"
" -D [ip][:port] = Start dedicated server\n"
" -l ip[:port] = Redirect DEBUG()\n"
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
@@ -406,6 +408,8 @@ int ttd_main(int argc, char *argv[])
char *debuglog_conn = NULL;
char *dedicated_host = NULL;
uint16 dedicated_port = 0;
+ char *join_server_password = NULL;
+ char *join_company_password = NULL;
#endif /* ENABLE_NETWORK */
_game_mode = GM_MENU;
@@ -418,7 +422,7 @@ int ttd_main(int argc, char *argv[])
* a letter means: it accepts that param (e.g.: -h)
* a ':' behind it means: it need a param (e.g.: -m<driver>)
* a '::' behind it means: it can optional have a param (e.g.: -d<debug>) */
- optformat = "m:s:v:b:hD::n::ei::I:t:d::r:g::G:c:xl:"
+ optformat = "m:s:v:b:hD::n::ei::I:t:d::r:g::G:c:xl:p:P:"
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
"f"
#endif
@@ -463,6 +467,12 @@ int ttd_main(int argc, char *argv[])
case 'l':
debuglog_conn = mgo.opt;
break;
+ case 'p':
+ join_server_password = mgo.opt;
+ break;
+ case 'P':
+ join_company_password = mgo.opt;
+ break;
#endif /* ENABLE_NETWORK */
case 'r': ParseResolution(&resolution, mgo.opt); break;
case 't': startyear = atoi(mgo.opt); break;
@@ -694,7 +704,7 @@ int ttd_main(int argc, char *argv[])
LoadIntroGame();
_switch_mode = SM_NONE;
- NetworkClientConnectGame(NetworkAddress(network_conn, rport), join_as);
+ NetworkClientConnectGame(NetworkAddress(network_conn, rport), join_as, join_server_password, join_company_password);
}
}
#endif /* ENABLE_NETWORK */