runs command line options.
| 918 | } |
| 919 | // runs command line options. |
| 920 | bool 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 | } |
no test coverage detected