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

Function DoDedicatedServerFrame

Descent3/dedicated_server.cpp:726–773  ·  view source on GitHub ↗

Called once per frame for the dedicated server

Source from the content-addressed store, hash-verified

724
725// Called once per frame for the dedicated server
726void DoDedicatedServerFrame() {
727 char str[255];
728 char command[255] = {}; // operand
729 char operand[255]; // operand
730
731 ListenDedicatedSocket();
732 DedicatedReadTelnet();
733
734 // CallGameDLL (EVT_GAME_INTERVAL,&DLLInfo);
735
736 if (ServerTimeout) {
737 float now = timer_GetTime();
738 int sincelastpacket = ((float)(now - LastPacketReceived)) / 60;
739 // See if it's time to shutdown...
740 if (sincelastpacket > ServerTimeout) {
741 int quitno = DedicatedServerLex("Quit");
742 if (quitno >= 0)
743 SetCVar(CVars[quitno].varname, "", false);
744 }
745 }
746
747 bool new_command = con_Input(str, 255);
748
749 if (!new_command)
750 return;
751
752 if (str[0] == '$') {
753 DLLInfo.input_string = str;
754 CallGameDLL(EVT_CLIENT_INPUT_STRING, &DLLInfo);
755 return;
756 }
757
758 ParseLine(str, command, operand, 255, 255);
759
760 if (!command[0])
761 return;
762
763 int index = DedicatedServerLex(command);
764
765 if (index < 0) {
766 PrintDedicatedMessage(TXT_DS_BADCOMMAND);
767 PrintDedicatedMessage("\n");
768 return;
769 }
770
771 // Everything ok, set command
772 SetCVar(CVars[index].varname, operand, false);
773}
774
775// Prints a message to the console if the dedicated server is active
776void PrintDedicatedMessage(const char *fmt, ...) {

Callers 1

MultiDoServerFrameFunction · 0.85

Calls 8

ListenDedicatedSocketFunction · 0.85
DedicatedReadTelnetFunction · 0.85
DedicatedServerLexFunction · 0.85
SetCVarFunction · 0.85
CallGameDLLFunction · 0.85
ParseLineFunction · 0.85
PrintDedicatedMessageFunction · 0.85
con_InputFunction · 0.50

Tested by

no test coverage detected