MCPcopy Create free account
hub / github.com/assaultcube/AC / wizardmain

Function wizardmain

source/src/wizard.cpp:47–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47int wizardmain(int argc, char **argv)
48{
49 const char *outfile = NULL, *relpath = NULL;
50 for(int i = 1; i < argc; i++)
51 {
52 if(argv[i][0] == '-') continue;
53 if(!outfile) outfile = argv[i];
54 else if(!relpath) relpath = argv[i];
55 }
56 if(!outfile || !relpath)
57 {
58 printf("invalid arguments specified!\n");
59 printf("usage: ac_server <outfile> <relbinarypath>\n");
60 return EXIT_FAILURE;
61 }
62
63 printf("The AssaultCube Server Wizard\n\n");
64 printf("Before setting up a new server, please ensure you've read the rules at:\n"
65 "\thttp://masterserver.cubers.net/rules.html\n\n");
66 printf("You will also need to ensure that the UDP port you choose is open.\n"
67 "Whatever port you choose, you will need to forward that port, plus one port after that.\n"
68 "If you're having issues, use and forward the default ports 28763 and 28764\n"
69 "Use http://www.portforward.com for guidance.\n\n");
70 printf("Now to specify some optional settings for your server.\n"
71 "The default settings will be used if you leave the fields blank.\n"
72 "If you're unsure about what to specify for the settings, leave the field blank.\n\n"
73 "Read http://assault.cubers.net/docs/commandline.html for a description of these settings.\n\n");
74
75 vector<char> argstr;
76 readarg(argstr, "Server description", "-n");
77 readarg(argstr, "Message of the day", "-o");
78 readarg(argstr, "Maximum clients (No more than 16 allowed!)", "-c");
79 readarg(argstr, "Administrator password", "-x");
80 readarg(argstr, "Server port", "-f");
81
82 printf("\nPrivate server settings:\n"
83 "------------------------\n");
84 string ispub = "";
85 readarg("Public server (Yes/No)?", ispub, sizeof(ispub));
86 if(toupper(ispub[0]) == 'N') addarg(argstr, "-mlocalhost");
87 string cmds = "";
88 readarg(argstr, "Player password", "-p");
89
90 readarg("\nAdditional server switches", cmds, sizeof(cmds));
91 if(cmds[0]) addarg(argstr, cmds);
92
93#ifdef WIN32
94
95 string wsname = "", wsdisplayname = "";
96 readarg("win service name", wsname, sizeof(wsname));
97 if(wsname[0])
98 readarg("win service display", wsdisplayname, sizeof(wsdisplayname));
99
100#endif
101
102 printf("\nWriting your configuration to %s ... ", outfile); fflush(stdout);
103
104 argstr.add('\0');

Callers 1

server.cppFile · 0.85

Calls 14

readargFunction · 0.85
addargFunction · 0.85
copystringFunction · 0.85
reserveMethod · 0.80
advanceMethod · 0.80
OpenMangerMethod · 0.80
CloseManagerMethod · 0.80
IsInstalledMethod · 0.80
InstallMethod · 0.80
addMethod · 0.45
getbufMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected