Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.h
Show First 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | private: | ||||
* The given GUID will be (re)assigned to the given player ID. | * The given GUID will be (re)assigned to the given player ID. | ||||
* Any player currently using that ID will be unassigned. | * Any player currently using that ID will be unassigned. | ||||
*/ | */ | ||||
void AssignPlayer(int playerID, const CStr& guid); | void AssignPlayer(int playerID, const CStr& guid); | ||||
/** | /** | ||||
* Switch in game mode and notify all clients to start the game. | * Switch in game mode and notify all clients to start the game. | ||||
*/ | */ | ||||
void StartGame(const CStr& initAttribs); | void StartGame(const CStr& initAttribs, const bool allowCheats); | ||||
sera: Why is allowCheats not part of initAttribs? | |||||
Done Inline ActionsIt is, but the server can't parse initAttribs since there is no ScriptContext anymore. phosit: It is, but the server can't parse `initAttribs` since there is no `ScriptContext` anymore. | |||||
Done Inline ActionsSo it means adding any new attribute needed for the server we have to pass those attributes separately. vladislavbelov: So it means adding any new attribute needed for the server we have to pass those attributes… | |||||
Done Inline ActionsWell, if there are more attributes i'd put them in a struct. phosit: Well, if there are more attributes i'd put them in a struct. | |||||
Not Done Inline ActionsWhat about using the bundled jsonspirit or it's wrapper instead? sera: What about using the bundled jsonspirit or it's wrapper instead? | |||||
/** | /** | ||||
* Make a player name 'nicer' by limiting the length and removing forbidden characters etc. | * Make a player name 'nicer' by limiting the length and removing forbidden characters etc. | ||||
*/ | */ | ||||
static CStrW SanitisePlayerName(const CStrW& original); | static CStrW SanitisePlayerName(const CStrW& original); | ||||
/** | /** | ||||
* Make a player name unique, if it matches any existing session's name. | * Make a player name unique, if it matches any existing session's name. | ||||
*/ | */ | ||||
CStrW DeduplicatePlayerName(const CStrW& original); | CStrW DeduplicatePlayerName(const CStrW& original); | ||||
/** | /** | ||||
* Get the script context used for init attributes. | |||||
*/ | |||||
const ScriptInterface& GetScriptInterface(); | |||||
/** | |||||
* Set the turn length to a fixed value. | * Set the turn length to a fixed value. | ||||
* TODO: we should replace this with some adaptive lag-dependent computation. | * TODO: we should replace this with some adaptive lag-dependent computation. | ||||
*/ | */ | ||||
void SetTurnLength(u32 msecs); | void SetTurnLength(u32 msecs); | ||||
void ProcessLobbyAuth(const CStr& name, const CStr& token); | void ProcessLobbyAuth(const CStr& name, const CStr& token); | ||||
void AddPlayer(const CStr& guid, const CStrW& name); | void AddPlayer(const CStr& guid, const CStrW& name); | ||||
Show All 39 Lines | private: | ||||
/** | /** | ||||
* Send a network warning if the connection to a client is being lost or has bad latency. | * Send a network warning if the connection to a client is being lost or has bad latency. | ||||
*/ | */ | ||||
void CheckClientConnections(); | void CheckClientConnections(); | ||||
void SendHolePunchingMessage(const CStr& ip, u16 port); | void SendHolePunchingMessage(const CStr& ip, u16 port); | ||||
/** | |||||
* Internal script context for (de)serializing script messages, | |||||
* and for storing init attributes. | |||||
* (TODO: we shouldn't bother deserializing (except for debug printing of messages), | |||||
* we should just forward messages blindly and efficiently.) | |||||
*/ | |||||
ScriptInterface* m_ScriptInterface; | |||||
PlayerAssignmentMap m_PlayerAssignments; | PlayerAssignmentMap m_PlayerAssignments; | ||||
/** | /** | ||||
* Stores the most current init attributes. | * Stores the most current init attributes. | ||||
* NB: this is not guaranteed to be up-to-date until the server is LOADING or INGAME. | * NB: this is not guaranteed to be up-to-date until the server is LOADING or INGAME. | ||||
* At that point, the settings are frozen and ought to be identical to the simulation Init Attributes. | * At that point, the settings are frozen and ought to be identical to the simulation Init Attributes. | ||||
*/ | */ | ||||
JS::PersistentRootedValue m_InitAttributes; | std::string m_InitAttributes; | ||||
bool m_AllowCheats; | |||||
/** | /** | ||||
* Whether this match requires lobby authentication. | * Whether this match requires lobby authentication. | ||||
*/ | */ | ||||
const bool m_LobbyAuth; | const bool m_LobbyAuth; | ||||
ENetHost* m_Host; | ENetHost* m_Host; | ||||
std::vector<CNetServerSession*> m_Sessions; | std::vector<CNetServerSession*> m_Sessions; | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why is allowCheats not part of initAttribs?