MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ProcessCommandLine

Function ProcessCommandLine

Descent3/menu.cpp:920–1046  ·  view source on GitHub ↗

runs command line options.

Source from the content-addressed store, hash-verified

918}
919// runs command line options.
920bool ProcessCommandLine() {
921 int exit_menu = 0;
922 // Auto connect to a network game if the parm is there.
923 if ((!Auto_connected) && (TCP_active) && (FindArg("-url"))) {
924 Auto_connected = true;
925 int urlarg = FindArg("-url") + 1;
926 char szurl[200];
927 char *p;
928 char *tokp;
929 strcpy(szurl, GameArgs[urlarg]);
930#ifdef DEMO
931 szurl[strlen("d3demo2://") - 1] = '\0'; // Should make the string "d3demo:/"
932 p = szurl + strlen("d3demo2://"); // pointer to the first character of the url after the //
933 if (stricmp(szurl, "d3demo2:/") == 0) {
934 mprintf(0, "Got a url passed: %s\n", p);
935 }
936#else
937 szurl[strlen("descent3://") - 1] = '\0'; // Should make the string "descent3:/"
938 p = szurl + strlen("descent3://"); // pointer to the first character of the url after the //
939 if (stricmp(szurl, "descent3:/") == 0) {
940 mprintf(0, "Got a url passed: %s\n", p);
941 }
942#endif
943 tokp = strtok(p, "/");
944 if (stricmp(tokp, "ip") == 0) {
945 tokp = strtok(NULL, "/");
946 Auto_login_port[0] = '\0';
947 strcpy(Auto_login_addr, tokp);
948 // char seldll[_MAX_PATH*2];
949 // ddio_MakePath(seldll,Base_directory,"online","Direct TCP~IP Game.d3c",NULL);
950 if (LoadMultiDLL("Direct TCP~IP")) {
951 CallMultiDLL(MT_AUTO_LOGIN);
952 if (MultiDLLGameStarting) {
953 mprintf(0, "Successfully connected to server at specified url.\n");
954 exit_menu = 1;
955 } else {
956 mprintf(0, "Couldn't connect to server at specified url.\n");
957 }
958 } else {
959 mprintf(0, "Couldn't load DLL.\n");
960 }
961 } else if (stricmp(tokp, "pxo") == 0) {
962 tokp = strtok(NULL, "/");
963 Auto_login_port[0] = '\0';
964 strcpy(Auto_login_addr, tokp);
965 // char seldll[_MAX_PATH*2];
966 // ddio_MakePath(seldll,Base_directory,"online","parallax online.d3c",NULL);
967 if (LoadMultiDLL("parallax online")) {
968 CallMultiDLL(MT_AUTO_LOGIN);
969 if (MultiDLLGameStarting) {
970 mprintf(0, "Successfully connected to server at specified url.\n");
971 exit_menu = 1;
972 } else {
973 mprintf(0, "Couldn't connect to server at specified url.\n");
974 }
975 } else {
976 mprintf(0, "Couldn't load DLL.\n");
977 }

Callers 1

MainMenuFunction · 0.85

Calls 10

LoadMultiDLLFunction · 0.85
CallMultiDLLFunction · 0.85
AutoConnectPXOFunction · 0.85
AutoConnectLANIPFunction · 0.85
AutoConnectHeatFunction · 0.85
dp_AutoConnectFunction · 0.85
SimpleStartLevelFunction · 0.85
SetFunctionModeFunction · 0.85
SetUICallbackFunction · 0.85
FindArgFunction · 0.70

Tested by

no test coverage detected