____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include "unit.h"
#include "net_lowlevel.h"
Go to the source code of this file.
Definition in file network.h.
| #define IsNetworkGame | ( | ) | (NetworkFildes != (Socket)-1) |
Definition at line 46 of file network.h.
Referenced by ButtonCheckNetwork(), ButtonCheckNoNetwork(), CreateGame(), DrawMenuButtonArea(), ExitNetwork1(), HandleMouseOn(), InputKey(), NetworkChatMessage(), NetworkCommands(), NetworkEvent(), SendCommandAttack(), SendCommandAttackGround(), SendCommandAutoRepair(), SendCommandAutoSpellCast(), SendCommandBoard(), SendCommandBuildBuilding(), SendCommandCancelTraining(), SendCommandDiplomacy(), SendCommandDismiss(), SendCommandFollow(), SendCommandMove(), SendCommandPatrol(), SendCommandRepair(), SendCommandResource(), SendCommandSharedVision(), SendCommandSpellCast(), SendCommandStandGround(), SendCommandStopUnit(), SendCommandTrainUnit(), SendCommandUnload(), tolua_stratagus_IsNetworkGame00(), UIHandleButtonUp(), UiTogglePause(), and WaitEventsOneFrame().
| #define MaxNetworkCommands 9 |
Max Commands In A Packet.
Definition at line 44 of file network.h.
Referenced by CNetworkPacket::Deserialize(), CNetworkPacketHeader::Deserialize(), InitNetwork2(), NetworkEvent(), NetworkExecCommands(), NetworkQuit(), NetworkRemovePlayer(), NetworkSendCommands(), NetworkSendPacket(), NetworkSendSelection(), CNetworkPacketHeader::Serialize(), and CNetworkPacketHeader::Size().
| typedef struct _network_selection_header_ NetworkSelectionHeader |
Network Selection Info
| enum _message_type_ |
Network message types.
| void ExitNetwork1 | ( | void | ) |
Cleanup network part 1 (ports).
Cleanup network part 1. (to be called _AFTER_ part 2 :)
Definition at line 573 of file network.cpp.
References _C_, DebugPrint, HostsCount, IsNetworkGame, NetCloseUDP(), NetExit(), NetPlayers, NetworkFildes, and NetworkInSync.
Referenced by ApplyReplaySettings(), Exit(), InitNetwork1(), and tolua_stratagus_ExitNetwork100().
| void InitNetwork1 | ( | void | ) |
Initialise network part 1 (ports).
Initialize network part 1.
Definition at line 498 of file network.cpp.
References _C_, CommandsIn, DebugPrint, ExitNetwork1(), MsgCommandsIn, NetExit(), NetInit(), NetLastPort, NetLocalAddrs, NetMsgBufLen, NetOpenUDP(), NetResolveHost(), NetSocketAddr(), NetworkFildes, NetworkInSync, NetworkLag, NetworkNumInterfaces, NetworkPort, NetworkUpdates, NIPQUAD, NumNCQs, and PlayerMax.
Referenced by tolua_stratagus_InitNetwork100().
| void InitNetwork2 | ( | void | ) |
Initialise network part 2.
Initialize network part 2.
Definition at line 599 of file network.cpp.
References _C_, DebugPrint, Hosts, HostsCount, MaxNetworkCommands, MessageSync, NetworkConnectSetupGame(), NetworkLag, NetworkLastFrame, NetworkStatus, NetworkSyncHashs, NetworkSyncSeeds, NetworkUpdates, PlayerQuit, CNetworkHost::PlyNr, CNetworkCommandQueue::Time, and CNetworkCommandQueue::Type.
Referenced by CreateGame().
| void NetworkChatMessage | ( | const std::string & | msg | ) |
Send network command.
Send chat message
Send chat message. (Message is sent with low priority)
| msg | Text message to send. |
Definition at line 1121 of file network.cpp.
References AllocNCQ(), CNetworkCommandQueue::Data, CPlayer::Index, IsNetworkGame, MessageChat, MessageChatTerm, MsgCommandsIn, CNetworkChat::Player, CNetworkChat::Text, ThisPlayer, and CNetworkCommandQueue::Type.
Referenced by InputKey().
| void NetworkCommands | ( | void | ) |
Get all network commands.
Handle network commands.
Definition at line 1360 of file network.cpp.
References GameCycle, IsNetworkGame, NetworkExecCommands(), NetworkSendCommands(), NetworkSyncCommands(), and NetworkUpdates.
Referenced by GameMainLoop().
| void NetworkEvent | ( | void | ) |
Handle network events.
Called if message for the network is ready. (by WaitEventsOneFrame)
Definition at line 895 of file network.cpp.
References _, _C_, CNetworkPacket::Command, CNetworkPacketHeader::Cycle, CNetworkCommandQueue::Data, DebugPrint, CNetworkPacket::Deserialize(), FrameCounter, GameCycle, CNetworkPacket::Header, Hosts, HostsCount, CPlayer::Index, IsNetworkGame, CPlayer::IsTeamed(), MaxNetworkCommands, MessageChat, MessageChatTerm, MessageCommandDismiss, MessageExtendedCommand, MessageNone, MessageQuit, MessageQuitAck, MessageResend, MessageSelection, MessageSync, NetConnectRunning, NetLastHost, NetLastPort, NetRecvUDP(), NetworkBroadcast(), NetworkFildes, NetworkInSync, NetworkLastFrame, NetworkParseSetupEvent(), NetworkProcessSelection(), NetworkSendPacket(), NetworkStatus, NetworkUpdates, NIPQUAD, NumPlayers, PlayerQuit, Players, CNetworkHost::PlyNr, SetMessage(), ThisPlayer, CNetworkCommandQueue::Time, CNetworkCommandQueue::Type, CNetworkPacketHeader::Type, CNetworkCommand::Unit, UnitSlotFree, UnitSlots, and CNetworkCommand::X.
Referenced by CEditor::Init(), InitCallbacks(), InitGameCallbacks(), initGuichan(), and PlayMovie().
| void NetworkQuit | ( | void | ) |
Quit game.
Quit the game.
Definition at line 1098 of file network.cpp.
References CNetworkCommandQueue::Data, GameCycle, CPlayer::Index, MaxNetworkCommands, MessageNone, MessageQuit, NetworkLag, NetworkSendPacket(), NetworkUpdates, ThisPlayer, CNetworkCommandQueue::Time, CNetworkCommandQueue::Type, and CNetworkCommand::X.
Referenced by Exit(), and GameMainLoop().
| void NetworkRecover | ( | void | ) |
Recover network.
Recover network.
Definition at line 1376 of file network.cpp.
References _, CNetworkPacketHeader::Cycle, CNetworkCommandQueue::Data, FrameCounter, FRAMES_PER_SECOND, GameCycle, CNetworkPacket::Header, Hosts, HostsCount, MessageNone, MessageQuit, NetworkBroadcast(), NetworkDelay, NetworkInSync, NetworkLastFrame, NetworkResendCommands(), NetworkSyncCommands(), NetworkTimeout, NetworkUpdates, PlayerQuit, CNetworkHost::PlyNr, SetMessage(), CNetworkCommandQueue::Time, CNetworkPacketHeader::Type, CNetworkCommandQueue::Type, VideoSyncSpeed, and CNetworkCommand::X.
Referenced by GameMainLoop().
| void NetworkSendCommand | ( | int | command, | |
| const CUnit * | unit, | |||
| int | x, | |||
| int | y, | |||
| const CUnit * | dest, | |||
| const CUnitType * | type, | |||
| int | status | |||
| ) |
Send extended 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. |
Definition at line 672 of file network.cpp.
References AllocNCQ(), Assert, CommandsIn, CNetworkCommandQueue::Data, CNetworkCommand::Dest, GameCycle, CUnitType::Slot, CUnit::Slot, CNetworkCommandQueue::Time, CNetworkCommandQueue::Type, CNetworkCommand::Unit, CNetworkCommand::X, and CNetworkCommand::Y.
Referenced by SendCommandAttack(), SendCommandAttackGround(), SendCommandAutoRepair(), SendCommandAutoSpellCast(), SendCommandBoard(), SendCommandBuildBuilding(), SendCommandCancelTraining(), SendCommandDismiss(), SendCommandFollow(), SendCommandMove(), SendCommandPatrol(), SendCommandRepair(), SendCommandResource(), SendCommandSpellCast(), SendCommandStandGround(), SendCommandStopUnit(), SendCommandTrainUnit(), and SendCommandUnload().
| void NetworkSendExtendedCommand | ( | int | command, | |
| int | arg1, | |||
| int | arg2, | |||
| int | arg3, | |||
| int | arg4, | |||
| int | status | |||
| ) |
Send Selections to Team.
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. |
Definition at line 729 of file network.cpp.
References AllocNCQ(), CNetworkExtendedCommand::Arg1, CNetworkExtendedCommand::Arg2, CNetworkExtendedCommand::Arg3, CNetworkExtendedCommand::Arg4, CommandsIn, CNetworkCommandQueue::Data, CNetworkExtendedCommand::ExtendedType, GameCycle, MessageExtendedCommand, CNetworkCommandQueue::Time, and CNetworkCommandQueue::Type.
Referenced by SendCommandDiplomacy(), and SendCommandSharedVision().
| void NetworkSendSelection | ( | CUnit ** | units, | |
| int | count | |||
| ) |
Sends my selections to teammates
| units | Units to send | |
| count | Number of units to send |
Definition at line 758 of file network.cpp.
References _network_selection_header_::Add, CNetworkPacket::Command, CNetworkPacket::Header, Hosts, HostsCount, MaxNetworkCommands, MessageNone, MessageSelection, NetSendUDP(), NetworkFildes, _network_selection_header_::NumberSent, PlayerMax, Players, _network_selection_header_::Remove, CNetworkPacket::Serialize(), CNetworkSelection::Size(), CNetworkPacketHeader::Size(), CPlayer::Team, ThisPlayer, CNetworkPacketHeader::Type, _network_selection_header_::Type, CNetworkSelection::Unit, and UnitNumber.
Referenced by ChangeSelectedUnits(), SelectUnitsByType(), ToggleUnitsByType(), and UiUnselectAll().
| void NetworkSync | ( | void | ) |
Hold in sync.
Network file descriptor.
Definition at line 259 of file network.cpp.
Referenced by ExitNetwork1(), InitNetwork1(), NetworkBroadcast(), NetworkEvent(), NetworkSendICMessage(), NetworkSendSelection(), NetworkServerStartGame(), and WaitEventsOneFrame().
| int NetworkInSync |
Network is in sync.
Definition at line 260 of file network.cpp.
Referenced by ExitNetwork1(), GameMainLoop(), InitNetwork1(), NetworkEvent(), NetworkRecover(), and NetworkSyncCommands().
| int NetworkLag |
Network lag (# game cycles).
Definition at line 262 of file network.cpp.
Referenced by ClientParseConnecting(), InitNetwork1(), InitNetwork2(), main(), NetworkQuit(), NetworkSendCommands(), and NetworkSendICMessage().
Network number of interfaces.
Definition at line 258 of file network.cpp.
Referenced by InitNetwork1().
| unsigned long NetworkStatus[PlayerMax] |
Network status.
Definition at line 263 of file network.cpp.
Referenced by InitNetwork2(), and NetworkEvent().
| int NetworkUpdates |
Network update each # game cycles.
Definition at line 261 of file network.cpp.
Referenced by ClientParseConnecting(), InitNetwork1(), InitNetwork2(), main(), NetworkCommands(), NetworkEvent(), NetworkQuit(), NetworkRecover(), NetworkResendCommands(), NetworkSendICMessage(), and NetworkSyncCommands().
Removes randomization of player placements.
Definition at line 76 of file script.cpp.
Referenced by CclNoRandomPlacementMultiplayer(), and NetworkServerStartGame().
1.5.6