src/include/network.h File Reference
#include <SDL_stdinc.h>
#include "net_lowlevel.h"
Go to the source code of this file.
|
Classes |
class | CNetworkCommand |
class | CNetworkExtendedCommand |
class | CNetworkChat |
struct | _network_selection_header_ |
class | CNetworkSelection |
class | CNetworkPacketHeader |
class | CNetworkPacket |
network.h - The network header file. |
#define | MaxNetworkCommands 9 |
#define | IsNetworkGame() (NetworkFildes != (Socket)-1) |
enum | _message_type_ {
MessageNone,
MessageInitHello,
MessageInitReply,
MessageInitConfig,
MessageSync,
MessageSelection,
MessageQuit,
MessageQuitAck,
MessageResend,
MessageChat,
MessageChatTerm,
MessageCommandStop,
MessageCommandStand,
MessageCommandFollow,
MessageCommandMove,
MessageCommandRepair,
MessageCommandAutoRepair,
MessageCommandAttack,
MessageCommandGround,
MessageCommandPatrol,
MessageCommandBoard,
MessageCommandUnload,
MessageCommandBuild,
MessageCommandDismiss,
MessageCommandResourceLoc,
MessageCommandResource,
MessageCommandReturn,
MessageCommandTrain,
MessageCommandCancelTrain,
MessageCommandUpgrade,
MessageCommandCancelUpgrade,
MessageCommandResearch,
MessageCommandCancelResearch,
MessageExtendedCommand,
MessageCommandSpellCast
} |
enum | _extended_message_type_ { ExtendedMessageDiplomacy,
ExtendedMessageSharedVision,
ExtendedMessageSetResource
} |
typedef struct
_network_selection_header_ | NetworkSelectionHeader |
int | NetworkNumInterfaces |
Socket | NetworkFildes |
| Network number of interfaces.
|
int | NetworkInSync |
| Network file descriptor.
|
int | NetworkUpdates |
| Network is in sync.
|
int | NetworkLag |
| Network update each # game cycles.
|
unsigned long | NetworkStatus [PlayerMax] |
| Network lag (# game cycles).
|
int | NoRandomPlacementMultiplayer |
| Network status.
|
void | InitNetwork1 () |
| Removes randomization of player placements.
|
void | InitNetwork2 () |
| Initialise network part 1 (ports).
|
void | ExitNetwork1 () |
| Initialise network part 2.
|
void | NetworkEvent () |
| Cleanup network part 1 (ports).
|
void | NetworkSync () |
| Handle network events.
|
void | NetworkQuit () |
| Hold in sync.
|
void | NetworkRecover () |
| Quit game.
|
void | NetworkCommands () |
| Recover network.
|
void | NetworkChatMessage (const std::string &msg) |
| Get all network commands.
|
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.
|
Define Documentation
#define MaxNetworkCommands 9 |
Typedef Documentation
Enumeration Type Documentation
Network extended message types.
- Enumerator:
-
ExtendedMessageDiplomacy |
|
ExtendedMessageSharedVision |
Change diplomacy. |
ExtendedMessageSetResource |
Change shared vision.
Change resource count |
Network message types.
- Todo:
- cleanup the message types.
- Enumerator:
-
MessageNone |
|
MessageInitHello |
When Nothing Is Happening. |
MessageInitReply |
Start connection. |
MessageInitConfig |
Connection reply. |
MessageSync |
Setup message configure clients. |
MessageSelection |
Heart beat. |
MessageQuit |
Update a Selection from Team Player. |
MessageQuitAck |
Quit game. |
MessageResend |
Quit reply - UNUSED YET - Protocol Version 2 - Reserved for menus. |
MessageChat |
Resend message. |
MessageChatTerm |
Chat message. |
MessageCommandStop |
Chat message termination - Protocol Version 2. |
MessageCommandStand |
Unit command stop. |
MessageCommandFollow |
Unit command stand ground. |
MessageCommandMove |
Unit command follow. |
MessageCommandRepair |
Unit command move. |
MessageCommandAutoRepair |
Unit command repair. |
MessageCommandAttack |
Unit command autorepair. |
MessageCommandGround |
Unit command attack. |
MessageCommandPatrol |
Unit command attack ground. |
MessageCommandBoard |
Unit command patrol. |
MessageCommandUnload |
Unit command borad. |
MessageCommandBuild |
Unit command unload. |
MessageCommandDismiss |
Unit command build building. |
MessageCommandResourceLoc |
Unit command dismiss unit. |
MessageCommandResource |
Unit command resource location. |
MessageCommandReturn |
Unit command resource. |
MessageCommandTrain |
Unit command return goods. |
MessageCommandCancelTrain |
Unit command train. |
MessageCommandUpgrade |
Unit command cancel training. |
MessageCommandCancelUpgrade |
Unit command upgrade. |
MessageCommandResearch |
Unit command cancel upgrade. |
MessageCommandCancelResearch |
Unit command research. |
MessageExtendedCommand |
Unit command cancel research. |
MessageCommandSpellCast |
Command is the next byte.
Unit command spell cast |
Function Documentation
Initialise network part 2.
Cleanup network part 1. (to be called _AFTER_ part 2 :)
Removes randomization of player placements.
Initialize network part 1.
Initialise network part 1 (ports).
Initialize network part 2.
void NetworkChatMessage |
( |
const std::string & |
msg |
) |
|
Get all network commands.
Send chat message. (Message is sent with low priority)
- Parameters:
-
| msg | Text message to send. |
Recover network.
Handle network commands.
Cleanup network part 1 (ports).
Called if message for the network is ready. (by WaitEventsOneFrame)
- Todo:
- NetworkReceivedEarly NetworkReceivedLate NetworkReceivedDups Must be calculated.
Hold in sync.
Quit the game.
Quit game.
Recover network.
void NetworkSendCommand |
( |
int |
command, |
|
|
const CUnit & |
unit, |
|
|
int |
x, |
|
|
int |
y, |
|
|
const CUnit * |
dest, |
|
|
const CUnitType * |
type, |
|
|
int |
status | |
|
) |
| | |
Send network command.
Send chat message
Prepare send of command message.
Convert arguments into network format and place it into output queue.
- Parameters:
-
| 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. |
- Warning:
- Destination and unit-type shares the same network slot.
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.
- Parameters:
-
| 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. |
void NetworkSendSelection |
( |
CUnit ** |
units, |
|
|
int |
count | |
|
) |
| | |
Send Selections to Team.
Sends my selections to teammates
- Parameters:
-
| units | Units to send |
| count | Number of units to send |
Variable Documentation
Network number of interfaces.
Network update each # game cycles.
Network lag (# game cycles).