$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ 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 <stddef.h>
#include <list>
#include "network.h"
#include "actions.h"
#include "commands.h"
#include "interface.h"
#include "map.h"
#include "master.h"
#include "netconnect.h"
#include "net_lowlevel.h"
#include "player.h"
#include "replay.h"
#include "sound.h"
#include "translate.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "video.h"
Classes | |
class | CNetworkCommandQueue |
network.cpp - The network. | |
#define | MAX_NCQS 100 |
Player quit. | |
int | NetworkNumInterfaces |
Socket | NetworkFildes = static_cast<Socket>(-1) |
Network number of interfaces. | |
int | NetworkInSync = 1 |
Network file descriptor. | |
int | NetworkUpdates = 5 |
Network is in sync. | |
int | NetworkLag = 10 |
Network update each # game cycles. | |
unsigned long | NetworkStatus [PlayerMax] |
Network lag in # game cycles. | |
unsigned long | NetworkLastFrame [PlayerMax] |
Network status. | |
int | NetworkTimeout = 45 |
Last frame received packet. | |
static char | NetMsgBuf [PlayerMax][128] |
Number of seconds until player times out. | |
static int | NetMsgBufLen [PlayerMax] |
Chat message buffers. | |
static unsigned long | NetworkDelay |
Stored chat message length. | |
static int | NetworkSyncSeeds [256] |
Delay counter for recover. | |
static int | NetworkSyncHashs [256] |
Network sync seeds. | |
static CNetworkCommandQueue | NetworkIn [256][PlayerMax][MaxNetworkCommands] |
Network sync hashs. | |
std::list< CNetworkCommandQueue * > | CommandsIn |
Per-player network packet input queue. | |
std::list< CNetworkCommandQueue * > | MsgCommandsIn |
Network command input queue. | |
static int | PlayerQuit [PlayerMax] |
Network message input queue. | |
static CNetworkCommandQueue | NCQs [MAX_NCQS] |
static int | NumNCQs |
CNetworkCommandQueues. | |
static void | NetworkBroadcast (const CNetworkPacket &packet, int numcommands) |
static void | NetworkSendPacket (const CNetworkCommandQueue ncq[]) |
void | InitNetwork1 () |
Network status. | |
void | ExitNetwork1 () |
Initialise network part 2. | |
void | InitNetwork2 () |
Initialise network part 1 (ports). | |
static CNetworkCommandQueue * | AllocNCQ () |
static void | FreeNCQ (CNetworkCommandQueue *ncq) |
void | NetworkSendCommand (int command, const CUnit &unit, int x, int y, const CUnit *dest, const CUnitType *type, int status) |
Send network command. | |
void | NetworkSendExtendedCommand (int command, int arg1, int arg2, int arg3, int arg4, int status) |
Send extended network command. | |
void | NetworkSendSelection (CUnit **units, int count) |
Send Selections to Team. | |
static void | NetworkProcessSelection (CNetworkPacket *packet, int player) |
static void | NetworkRemovePlayer (int player) |
void | NetworkEvent () |
Cleanup network part 1 (ports). | |
void | NetworkQuit () |
Hold in sync. | |
void | NetworkChatMessage (const std::string &msg) |
Get all network commands. | |
static void | ParseNetworkCommand (const CNetworkCommandQueue *ncq) |
static void | NetworkResendCommands () |
static void | NetworkSendCommands () |
static void | NetworkExecCommands () |
static void | NetworkSyncCommands () |
void | NetworkCommands () |
Recover network. | |
void | NetworkRecover () |
Quit game. |
#define MAX_NCQS 100 |
Player quit.
static CNetworkCommandQueue* AllocNCQ | ( | ) | [static] |
void ExitNetwork1 | ( | ) |
Initialise network part 2.
Cleanup network part 1. (to be called _AFTER_ part 2 :)
static void FreeNCQ | ( | CNetworkCommandQueue * | ncq | ) | [static] |
void InitNetwork1 | ( | ) |
Network status.
Initialize network part 1.
void InitNetwork2 | ( | ) |
Initialise network part 1 (ports).
Initialize network part 2.
static void NetworkBroadcast | ( | const CNetworkPacket & | packet, | |
int | numcommands | |||
) | [static] |
Send message to all clients.
packet | Packet to send. | |
numcommands | Number of commands. |
void NetworkChatMessage | ( | const std::string & | msg | ) |
Get all network commands.
Send chat message. (Message is sent with low priority)
msg | Text message to send. |
void NetworkCommands | ( | ) |
Recover network.
Handle network commands.
void NetworkEvent | ( | ) |
Cleanup network part 1 (ports).
Called if message for the network is ready. (by WaitEventsOneFrame)
static void NetworkExecCommands | ( | ) | [static] |
Network excecute commands.
static void NetworkProcessSelection | ( | CNetworkPacket * | packet, | |
int | player | |||
) | [static] |
Process Received Unit Selection
packet | Network Packet to Process | |
player | Player number |
void NetworkQuit | ( | ) |
Hold in sync.
Quit the game.
void NetworkRecover | ( | ) |
Quit game.
Recover network.
static void NetworkRemovePlayer | ( | int | player | ) | [static] |
Remove a player from the game.
player | Player number |
static void NetworkResendCommands | ( | ) | [static] |
Network resend commands, we have a missing packet send to all clients what packet we are missing.
void NetworkSendCommand | ( | int | command, | |
const CUnit & | unit, | |||
int | x, | |||
int | y, | |||
const CUnit * | dest, | |||
const CUnitType * | type, | |||
int | status | |||
) |
Send network command.
Prepare send of command message.
Convert arguments into network format and place it into output queue.
command | Command (Move,Attack,...). | |
unit | Unit that receive the command. | |
x | optional X map position. | |
y | optional y map position. | |
dest | optional destination unit. | |
type | optional unit-type argument. | |
status | Append command or flush old commands. |
static void NetworkSendCommands | ( | ) | [static] |
Network send commands.
void NetworkSendExtendedCommand | ( | int | command, | |
int | arg1, | |||
int | arg2, | |||
int | arg3, | |||
int | arg4, | |||
int | status | |||
) |
Send extended network command.
Prepare send of extended command message.
Convert arguments into network format and place it into output queue.
command | Command (Move,Attack,...). | |
arg1 | optional argument #1 | |
arg2 | optional argument #2 | |
arg3 | optional argument #3 | |
arg4 | optional argument #4 | |
status | Append command or flush old commands. |
static void NetworkSendPacket | ( | const CNetworkCommandQueue | ncq[] | ) | [static] |
Network send packet. Build it from queue and broadcast.
ncq | Outgoing network queue start. |
void NetworkSendSelection | ( | CUnit ** | units, | |
int | count | |||
) |
Send Selections to Team.
Sends my selections to teammates
units | Units to send | |
count | Number of units to send |
static void NetworkSyncCommands | ( | ) | [static] |
Network synchronize commands.
static void ParseNetworkCommand | ( | const CNetworkCommandQueue * | ncq | ) | [static] |
Parse a network command.
ncq | Network command from queue |
std::list<CNetworkCommandQueue *> CommandsIn |
Per-player network packet input queue.
std::list<CNetworkCommandQueue *> MsgCommandsIn |
Network command input queue.
CNetworkCommandQueue NCQs[MAX_NCQS] [static] |
char NetMsgBuf[PlayerMax][128] [static] |
Number of seconds until player times out.
int NetMsgBufLen[PlayerMax] [static] |
Chat message buffers.
unsigned long NetworkDelay [static] |
Stored chat message length.
Socket NetworkFildes = static_cast<Socket>(-1) |
Network number of interfaces.
CNetworkCommandQueue NetworkIn[256][PlayerMax][MaxNetworkCommands] [static] |
Network sync hashs.
int NetworkInSync = 1 |
Network file descriptor.
int NetworkLag = 10 |
Network update each # game cycles.
unsigned long NetworkLastFrame[PlayerMax] |
Network status.
unsigned long NetworkStatus[PlayerMax] |
Network lag in # game cycles.
Network lag (# game cycles).
int NetworkSyncHashs[256] [static] |
Network sync seeds.
int NetworkSyncSeeds[256] [static] |
Delay counter for recover.
int NetworkTimeout = 45 |
Last frame received packet.
int NetworkUpdates = 5 |
Network is in sync.
int NumNCQs [static] |
CNetworkCommandQueues.
int PlayerQuit[PlayerMax] [static] |
Network message input queue.