This patch adds a --host option (to compliment the --join option) to the game, so you can launch the game via a external client.
Usage: --host (takes you directly to the host screen) --join ip/hostname (takes you directly to the join screen, you should see the game of the ip/hostname that you specified.) The join patch was already comitted. --- Index: src/clparse.c =================================================================== --- src/clparse.c (revision 5098) +++ src/clparse.c (working copy) @@ -47,12 +47,14 @@ #include "display.h" #include "version.h" +// these are all global variables extern char datadir[PATH_MAX]; extern char configdir[PATH_MAX]; extern char * global_mods[MAX_MODS]; extern char * campaign_mods[MAX_MODS]; extern char * multiplay_mods[MAX_MODS]; extern char iptoconnect[PATH_MAX]; +extern BOOL hostlaunch; //! Let the end user into debug mode.... BOOL bAllowDebugMode = false; @@ -82,6 +84,7 @@ CLI_NOSOUND, CLI_SELFTEST, CLI_CONNECTTOIP, + CLI_HOSTLAUNCH, } CLI_OPTIONS; static const struct poptOption* getOptionsTable(void) @@ -110,7 +113,8 @@ { "sound", '\0', POPT_ARG_NONE, NULL, CLI_SOUND, N_("Enable sound"), NULL }, { "nosound", '\0', POPT_ARG_NONE, NULL, CLI_NOSOUND, N_("Disable sound"), NULL }, { "selftest", '\0', POPT_ARG_NONE, NULL, CLI_SELFTEST, N_("Activate self-test"), NULL }, - { "join", '\0', POPT_ARG_STRING, NULL, CLI_CONNECTTOIP, N_("connect directly to IP/hostname"),NULL }, + { "join", '\0', POPT_ARG_STRING, NULL, CLI_CONNECTTOIP, N_("connect directly to IP/hostname"),NULL }, + { "host", '\0', POPT_ARG_NONE, NULL, CLI_HOSTLAUNCH, N_("go directly to host screen"), NULL }, // Terminating entry { NULL, '\0', 0, NULL, 0, NULL, NULL }, }; @@ -292,7 +296,7 @@ war_setFullscreen(true); break; case CLI_CONNECTTOIP: - //get the ip we want to connect with + //get the ip we want to connect with, and go directly to join screen. token = poptGetOptArg(poptCon); if (token == NULL) { @@ -303,6 +307,10 @@ } sstrcpy(iptoconnect, token); break; + case CLI_HOSTLAUNCH: + // go directly to host screen, bypass all others. + hostlaunch = true; + break; case CLI_GAME: // retrieve the game name token = poptGetOptArg(poptCon); Index: src/wrappers.c =================================================================== --- src/wrappers.c (revision 5098) +++ src/wrappers.c (working copy) @@ -81,7 +81,8 @@ static UDWORD lastTick = 0; static UDWORD lastChange = 0; -extern char iptoconnect[PATH_MAX]; // holds out ip/hostname from the command line +extern char iptoconnect[PATH_MAX]; // holds our ip/hostname from the command line +BOOL hostlaunch = false; // used to detect if we are hosting a game via command line option. static void initStars(void) { @@ -119,9 +120,15 @@ if (firstcall) { firstcall = false; - // We now check to see if we were given a ip/hostname on the command line - if(strlen(iptoconnect) ) + // First check to see if --host was given as a command line option, if not, + // then check --join and if neither, run the normal game menu. + if( hostlaunch ) { + changeTitleMode(MULTIOPTION); + hostlaunch = false; // reset the bool to default state. + } + else if(strlen(iptoconnect) ) + { changeTitleMode(GAMEFIND); // a ip/hostname was found, so go directly to the GAMEFIND screen } else _______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev