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

Function RunServerConfigs

Descent3/dedicated_server.cpp:240–303  ·  view source on GitHub ↗

Takes the data that the config file has an runs a server based on that data Returns true if ok, false if something is wrong

Source from the content-addressed store, hash-verified

238// Takes the data that the config file has an runs a server based on that data
239// Returns true if ok, false if something is wrong
240int RunServerConfigs() {
241 // Load the connection DLL
242 if (LoadMultiDLL(Netgame.connection_name)) {
243 CallMultiDLL(MT_AUTO_START);
244 if (!MultiDLLGameStarting) {
245 PrintDedicatedMessage(TXT_DS_COULDNTINIT, Netgame.connection_name);
246 PrintDedicatedMessage("\n");
247 return 0;
248 } else {
249 PrintDedicatedMessage(TXT_DS_DLLINIT);
250 PrintDedicatedMessage("\n");
251 }
252 } else {
253 PrintDedicatedMessage(TXT_DS_CONNECTLOADERR, Netgame.connection_name);
254 PrintDedicatedMessage("\n");
255 return 0;
256 }
257
258 // Put in the correct mission names for the oem builds
259#if (defined(OEM) || defined(DEMO))
260 if (stricmp("polaris.d3l", Netgame.mission) == 0) {
261 strcpy(Netgame.mission_name, "Polaris");
262 } else if (stricmp("taurus.d3l", Netgame.mission) == 0) {
263 strcpy(Netgame.mission_name, "Taurus");
264 } else if (stricmp("thecore.d3l", Netgame.mission) == 0) {
265 strcpy(Netgame.mission_name, "The Core");
266 }
267#else
268 const char *p = GetMissionName(Netgame.mission);
269 strcpy(Netgame.mission_name, p);
270#endif
271
272 // Load the mission
273 if (!LoadMission(Netgame.mission)) {
274 PrintDedicatedMessage(TXT_DS_LOADMISSIONERR, Netgame.mission);
275 PrintDedicatedMessage("\n");
276 return 0;
277 } else {
278 PrintDedicatedMessage(TXT_DS_MISSIONLOADED, Netgame.mission);
279 PrintDedicatedMessage("\n");
280 }
281
282 if (Current_mission.num_levels >= Dedicated_start_level) {
283 Current_mission.cur_level = Dedicated_start_level;
284 } else {
285 Current_mission.cur_level = 1;
286 }
287 // Start the actual server
288
289 int teams = CheckMissionForScript(Netgame.mission, Netgame.scriptname, Dedicated_num_teams);
290
291 if (teams == -1) {
292 PrintDedicatedMessage(TXT_MSNNOTCOMPATIBLE);
293 PrintDedicatedMessage("\n");
294 return 0;
295 } else {
296 MultiStartServer(0, Netgame.scriptname, teams);
297 strcpy(Players[0].callsign, TXT_DS_SERVERNAME);

Callers 1

LoadServerConfigFileFunction · 0.85

Calls 8

LoadMultiDLLFunction · 0.85
CallMultiDLLFunction · 0.85
PrintDedicatedMessageFunction · 0.85
GetMissionNameFunction · 0.85
LoadMissionFunction · 0.85
CheckMissionForScriptFunction · 0.85
MultiStartServerFunction · 0.85
InitDedicatedSocketFunction · 0.85

Tested by

no test coverage detected