diff options
author | truelight <truelight@openttd.org> | 2007-02-08 12:27:53 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2007-02-08 12:27:53 +0000 |
commit | c46a1cc2f685b4351b429b382a28a468fbf2c623 (patch) | |
tree | 18108e9e6f3d116f39e99f84eb6540da848e01cf /src/openttd.cpp | |
parent | 2a7682be799ed35b6a63373be232332657b262da (diff) | |
download | openttd-c46a1cc2f685b4351b429b382a28a468fbf2c623.tar.xz |
(svn r8631) -Add: added parameter -l ip[:port] to ./openttd, which redirects DEBUG() to a remote connection over TCP
For example, launch on 192.168.0.1 with, say, netcat a listener: netcat -l -p 3982
Launch OpenTTD on a remote host (say, PSP): ./openttd -l 192.168.0.1 -d9
And you get all debug information on 192.168.0.1. Very useful for debugging Portable systems.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index d60a63643..b147b994d 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -159,6 +159,7 @@ static void showhelp(void) #if defined(ENABLE_NETWORK) " -n [ip:port#player] = Start networkgame\n" " -D [ip][:port] = Start dedicated server\n" + " -l ip[:port] = Redirect DEBUG()\n" #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) " -f = Fork into the background (dedicated only)\n" #endif @@ -344,6 +345,7 @@ int ttd_main(int argc, char *argv[]) bool dedicated = false; bool network = false; char *network_conn = NULL; + char *debuglog_conn = NULL; char *dedicated_host = NULL; uint16 dedicated_port = 0; #endif /* ENABLE_NETWORK */ @@ -360,7 +362,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:hD::n::eit:d::r:g::G:c:x" + optformat = "m:s:v:hD::n::eit:d::r:g::G:c:xl:" #if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32) "f" #endif @@ -394,6 +396,9 @@ int ttd_main(int argc, char *argv[]) network = true; network_conn = mgo.opt; // optional IP parameter, NULL if unset break; + case 'l': + debuglog_conn = mgo.opt; + break; #endif /* ENABLE_NETWORK */ case 'r': ParseResolution(resolution, mgo.opt); break; case 't': startyear = atoi(mgo.opt); break; @@ -490,6 +495,21 @@ int ttd_main(int argc, char *argv[]) NetworkStartUp(); // initialize network-core +#if defined(ENABLE_NETWORK) + if (debuglog_conn != NULL && _network_available) { + const char *not_used = NULL; + const char *port = NULL; + uint16 rport; + + rport = NETWORK_DEFAULT_DEBUGLOG_PORT; + + ParseConnectionString(¬_used, &port, debuglog_conn); + if (port != NULL) rport = atoi(port); + + NetworkStartDebugLog(debuglog_conn, rport); + } +#endif /* ENABLE_NETWORK */ + ScanNewGRFFiles(); _opt_ptr = &_opt_newgame; |