_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
#include "online_service.h"#include "stratagus.h"#include <stddef.h>#include <list>#include "network.h"#include "actions.h"#include "commands.h"#include "interface.h"#include "map.h"#include "net_lowlevel.h"#include "net_message.h"#include "netconnect.h"#include "parameters.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"#include <deque>Classes | |
| class | CNetworkCommandQueue |
| Save game. More... | |
network.cpp - The network. | |
| bool | NetworkInSync = true |
| Network file descriptor. More... | |
| CUDPSocket | NetworkFildes |
| Network is in sync. More... | |
| static unsigned long | NetworkLastFrame [PlayerMax] |
| Network file descriptor. More... | |
| static unsigned long | NetworkLastCycle [PlayerMax] |
| Last frame received packet. More... | |
| static unsigned int | NetworkSyncSeeds [256] |
| Last cycle received packet. More... | |
| static unsigned int | NetworkSyncHashs [256] |
| Network sync seeds. More... | |
| static CNetworkCommandQueue | NetworkIn [256][PlayerMax][MaxNetworkCommands] |
| Network sync hashs. More... | |
| static std::deque< CNetworkCommandQueue > | CommandsIn |
| Per-player network packet input queue. More... | |
| static std::deque< CNetworkCommandQueue > | MsgCommandsIn |
| Network command input queue. More... | |
| static int | PlayerQuit [PlayerMax] |
| Network message input queue. More... | |
| int | SaveGame (const std::string &filename) |
| Load saved game. More... | |
| static void | NetworkBroadcast (const CNetworkPacket &packet, int numcommands, int player=255) |
| Player quit. More... | |
| static void | NetworkSendPacket (const CNetworkCommandQueue(&ncq)[MaxNetworkCommands]) |
| void | InitNetwork1 () |
| void | ExitNetwork1 () |
| Initialise network. More... | |
| void | NetworkOnStartGame () |
| Cleanup network (port) More... | |
| void | NetworkSendCommand (int command, const CUnit &unit, int x, int y, const CUnit *dest, const CUnitType *type, int status) |
| Send network command. More... | |
| void | NetworkSendExtendedCommand (int command, int arg1, int arg2, int arg3, int arg4, int status) |
| Send extended network command. More... | |
| void | NetworkSendSelection (CUnit **units, int count) |
| Send Selections to Team. More... | |
| void | NetworkSendChatMessage (const std::string &msg) |
| Get all network commands. More... | |
| static void | NetworkRemovePlayer (int player) |
| static bool | IsNetworkCommandReady (int hostIndex, unsigned long gameNetCycle) |
| static bool | IsNetworkCommandReady (unsigned long gameNetCycle) |
| static void | ParseResendCommand (const CNetworkPacket &packet) |
| static bool | IsAValidCommand_Command (const CNetworkPacket &packet, int index, const int player) |
| static bool | IsAValidCommand_Dismiss (const CNetworkPacket &packet, int index, const int player) |
| static bool | IsAValidCommand (const CNetworkPacket &packet, int index, const int player) |
| static void | NetworkParseInGameEvent (const unsigned char *buf, int len, const CHost &host) |
| void | NetworkEvent () |
| Initialise network data for ingame communication. More... | |
| void | NetworkQuitGame () |
| Hold in sync. More... | |
| static void | NetworkExecCommand_Sync (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand_Selection (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand_Chat (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand_Quit (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand_ExtendedCommand (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand_Command (const CNetworkCommandQueue &ncq) |
| static void | NetworkExecCommand (const CNetworkCommandQueue &ncq) |
| static void | NetworkSendCommands (unsigned long gameNetCycle) |
| static void | NetworkExecCommands (unsigned long gameNetCycle) |
| void | NetworkCommands () |
| Recover network. More... | |
| static void | CheckPlayerThatTimeOut (int hostIndex) |
| static void | NetworkResendCommands () |
| void | NetworkRecover () |
| Quit game: warn other users. More... | |
|
static |
| void ExitNetwork1 | ( | ) |
Initialise network.
Cleanup network.
| void InitNetwork1 | ( | ) |
Initialize network port.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Player quit.
Send message to all clients.
| packet | Packet to send. |
| numcommands | Number of commands. |
| void NetworkCommands | ( | ) |
Recover network.
Handle network commands.
| void NetworkEvent | ( | ) |
Initialise network data for ingame communication.
Called if message for the network is ready. (by WaitEventsOneFrame)
|
static |
Execute a network command.
| ncq | Network command from queue |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Network execute commands.
| void NetworkOnStartGame | ( | ) |
Cleanup network (port)
Game will start now. (This function runs on all clients.)
|
static |
| void NetworkQuitGame | ( | ) |
Hold in sync.
Quit the game.
| void NetworkRecover | ( | ) |
Quit game: warn other users.
Recover network.
|
static |
Remove a player from the game.
| player | Player number |
|
static |
Network resend commands, we have a missing packet send to all clients what packet we are missing.
| void NetworkSendChatMessage | ( | const std::string & | msg | ) |
Get all network commands.
Send chat message. (Message is sent with low priority)
| msg | Text message to send. |
| 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 |
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 |
Network send packet. Build it from queue and broadcast.
| ncq | Outgoing network queue start. |
Send Selections to Team.
Sends my selections to teammates
| units | Units to send |
| count | Number of units to send |
|
static |
| int SaveGame | ( | const std::string & | filename | ) |
Load saved game.
Save a game to file.
| filename | File name to be stored. |
|
static |
Per-player network packet input queue.
|
static |
Network command input queue.
| CUDPSocket NetworkFildes |
Network is in sync.
|
static |
Network sync hashs.
| bool NetworkInSync = true |
Network file descriptor.
|
static |
Last frame received packet.
|
static |
Network file descriptor.
|
static |
Network sync seeds.
|
static |
Last cycle received packet.
|
static |
Network message input queue.
1.8.17
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.