The server, like the client, is a state machine. More...
#include "Server.hpp"
Classes | |
class | GuiCallbackI |
A class that the server uses in order to let a GUI know in which state the server currently is. More... | |
class | InitErrorT |
A class that is thrown on server initialization errors. More... | |
Public Member Functions | |
ServerT (const GameInfoT &GameInfo, const GuiCallbackI &GuiCallback_, ModelManagerT &ModelMan, cf::GuiSys::GuiResourcesT &GuiRes) | |
The constructor. More... | |
void | MainLoop () |
Static Public Member Functions | |
static int | ConFunc_changeLevel_Callback (lua_State *LuaState) |
static int | ConFunc_runMapCmd_Callback (lua_State *LuaState) |
A console function that stores the given command string until the server "thinks" next. More... | |
The server, like the client, is a state machine.
It doesn't present its state explicitly however, but only as two implicit states: map loaded ("normal, running") and map unloaded ("idle"). As with the client, having a true "idle" state (rather than expressing it with a NULL ServerT instance pointer) has several advantages: a) We can gracefully terminate pending network connections (e.g. resend reliable data in the clients zombie state), and b) the server can receive and process conn-less network packets, and thus is available for administration via rcon commands.
ServerT::ServerT | ( | const GameInfoT & | GameInfo, |
const GuiCallbackI & | GuiCallback_, | ||
ModelManagerT & | ModelMan, | ||
cf::GuiSys::GuiResourcesT & | GuiRes | ||
) |
The constructor.
InitErrorT | if the server could not be initialized (e.g. a socket for the desired port could not be aquired). |
|
static |
A console function that stores the given command string until the server "thinks" next.
The RunMapCmdsFromConsole() method then runs the commands in the context of the current map/entity script.