_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"#include "netconnect.h"#include "interface.h"#include "map.h"#include "master.h"#include "network.h"#include "parameters.h"#include "player.h"#include "script.h"#include "settings.h"#include "version.h"#include "video.h"Classes | |
| struct | NetworkState |
| class | CServer |
| class | CClient |
netconnect.cpp - The network high level connection code. | |
| #define | CLIENT_LIVE_BEAT 60 |
| #define | CLIENT_IS_DEAD 300 |
| int | HostsCount |
| Network players. More... | |
| CNetworkHost | Hosts [PlayerMax] |
| Number of hosts. More... | |
| int | NetConnectRunning = 0 |
| Host and ports of all players. More... | |
| int | NetConnectType = 0 |
| Network menu: Setup mode active. More... | |
| int | NetLocalHostsSlot |
| Network menu: Setup mode active. More... | |
| int | NetLocalPlayerNumber |
| Network menu: Slot # in Hosts array of local client. More... | |
| int | NetPlayers |
| Player number of local client. More... | |
| std::string | NetworkMapName |
| How many network players. More... | |
| static int | NoRandomPlacementMultiplayer = 0 |
| Name of the map received with ICMMap. More... | |
| CServerSetup | ServerSetupState |
| Disable the random placement of players in muliplayer mode. More... | |
| CServerSetup | LocalSetupState |
| Network menu: Multiplayer Server Menu selections state. More... | |
| static CServer | Server |
| static CClient | Client |
| static const char * | ncconstatenames [] |
| static const char * | icmsgsubtypenames [] |
| template<typename T > | |
| static void | NetworkSendICMessage (CUDPSocket &socket, const CHost &host, const T &msg) |
| void | NetworkSendICMessage (CUDPSocket &socket, const CHost &host, const CInitMessage_Header &msg) |
| template<typename T > | |
| static void | NetworkSendICMessage_Log (CUDPSocket &socket, const CHost &host, const T &msg) |
| static void | NetworkSendICMessage_Log (CUDPSocket &socket, const CHost &host, const CInitMessage_Header &msg) |
| static bool | IsLocalSetupInSync (const CServerSetup &state1, const CServerSetup &state2, int index) |
| static bool | IsSafeMapName (const char *mapname) |
| static int | CheckVersions (const CInitMessage_Hello &msg, CUDPSocket &socket, const CHost &host) |
| int | NetworkParseSetupEvent (const unsigned char *buf, int size, const CHost &host) |
| Setup network connect state machine for the server. More... | |
| void | NetworkProcessClientRequest () |
| Menu: Setup the server IP. More... | |
| int | GetNetworkState () |
| int | FindHostIndexBy (const CHost &host) |
| Network menu: Multiplayer Client Menu selections local state. More... | |
| void | NetworkProcessServerRequest () |
| Menu Loop: Send out client request messages. More... | |
| void | NetworkInitClientConnect () |
| void | NetworkServerStartGame () |
| int | NetworkSetupServerAddress (const std::string &serveraddr, int port) |
| Parse a network connect event. More... | |
| void | NetworkDetachFromServer () |
| Menu Loop: Server: Mark clients state to send stateinfo message. More... | |
| void | NetworkInitServerConnect (int openslots) |
| Setup network connect state machine for clients. More... | |
| void | NetworkServerResyncClients () |
| Menu Loop: Send out server request messages. More... | |
| void | NetworkGamePrepareGameSettings () |
| Server user has finally hit the start game button. More... | |
| static int | CclNoRandomPlacementMultiplayer (lua_State *l) |
| void | NetworkCclRegister () |
| #define CLIENT_IS_DEAD 300 |
| #define CLIENT_LIVE_BEAT 60 |
|
static |
Removes Randomization of Player position in Multiplayer mode
| l | Lua state. |
|
static |
Check if the Stratagus version and Network Protocol match
| msg | message received |
| host | host which send the message |
| int FindHostIndexBy | ( | const CHost & | host | ) |
Network menu: Multiplayer Client Menu selections local state.
| int GetNetworkState | ( | ) |
|
static |
|
static |
Check if the map name looks safe.
A map name looks safe when there are no special characters and no .. or // sequences. This way only real valid maps from the map directory will be loaded.
| void NetworkCclRegister | ( | ) |
| void NetworkDetachFromServer | ( | ) |
Menu Loop: Server: Mark clients state to send stateinfo message.
Terminate and detach Network connect state machine for the client
| void NetworkGamePrepareGameSettings | ( | void | ) |
Server user has finally hit the start game button.
Multiplayer network game final race and player type setup.
| void NetworkInitClientConnect | ( | ) |
Setup Network connect state machine for clients
| void NetworkInitServerConnect | ( | int | openslots | ) |
Setup network connect state machine for clients.
Setup Network connect state machine for the server
| int NetworkParseSetupEvent | ( | const unsigned char * | buf, |
| int | size, | ||
| const CHost & | host | ||
| ) |
Setup network connect state machine for the server.
Parse a setup event. (Command type <= MessageInitEvent)
| buf | Packet received |
| size | size of the received packet. |
| host | host which send the message |
| void NetworkProcessClientRequest | ( | ) |
Menu: Setup the server IP.
Client Menu Loop: Send out client request messages
| void NetworkProcessServerRequest | ( | ) |
Menu Loop: Send out client request messages.
Server Menu Loop: Send out server request messages
|
static |
Send an InitConfig message across the Network
| host | Host to send to (network byte order). |
| port | Port of host to send to (network byte order). |
| msg | The message to send |
| void NetworkSendICMessage | ( | CUDPSocket & | socket, |
| const CHost & | host, | ||
| const CInitMessage_Header & | msg | ||
| ) |
|
static |
|
static |
| void NetworkServerResyncClients | ( | ) |
Menu Loop: Send out server request messages.
Notify state change by menu user to connected clients
| void NetworkServerStartGame | ( | ) |
Server user has finally hit the start game button
| int NetworkSetupServerAddress | ( | const std::string & | serveraddr, |
| int | port | ||
| ) |
Parse a network connect event.
Setup the IP-Address of the network server to connect to
| serveraddr | the serveraddress the user has entered |
|
static |
| CNetworkHost Hosts[PlayerMax] |
Number of hosts.
| int HostsCount |
Network players.
|
static |
| CServerSetup LocalSetupState |
Network menu: Multiplayer Server Menu selections state.
|
static |
| int NetConnectRunning = 0 |
Host and ports of all players.
Host, port, and number of all players.
| int NetConnectType = 0 |
Network menu: Setup mode active.
| int NetLocalHostsSlot |
Network menu: Setup mode active.
| int NetLocalPlayerNumber |
Network menu: Slot # in Hosts array of local client.
| int NetPlayers |
Player number of local client.
| std::string NetworkMapName |
How many network players.
|
static |
Name of the map received with ICMMap.
|
static |
| CServerSetup ServerSetupState |
Disable the random placement of players in muliplayer mode.
Player number of local client.
1.8.9.1
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.