Started implementing broadcasting
This commit is contained in:
parent
708526a54b
commit
c718dc5a2b
|
@ -591,7 +591,7 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
|||
case protocol_Gameplay_ObjectDie: break; /** @todo TODO: implement */
|
||||
case protocol_Gameplay_ObjectDisconnectPlayer:
|
||||
{
|
||||
//Removes
|
||||
//Remove the disconnected player
|
||||
Protocol_ObjectDisconnectPlayer decoded(data);
|
||||
auto object = this->privData->dynamicObjects->find( decoded.objectID );
|
||||
if( object != this->privData->dynamicObjects->end() )
|
||||
|
|
|
@ -22,16 +22,16 @@ namespace Oyster
|
|||
{
|
||||
struct BroadcastOptions
|
||||
{
|
||||
//bool broadcast;
|
||||
//float broadcastInterval;
|
||||
//std::wstring subnetToBroadcast;
|
||||
//CustomNetProtocol broadcastMessage;
|
||||
//BroadcastOptions()
|
||||
//{
|
||||
// broadcast = true;
|
||||
// broadcastInterval = 1.0f;
|
||||
// subnetToBroadcast = L"192.168.0.1";
|
||||
//}
|
||||
bool broadcast;
|
||||
float broadcastInterval;
|
||||
std::wstring subnetToBroadcast;
|
||||
CustomNetProtocol broadcastMessage;
|
||||
BroadcastOptions()
|
||||
{
|
||||
broadcast = true;
|
||||
broadcastInterval = 1.0f;
|
||||
subnetToBroadcast = L"192.168.0.1";
|
||||
}
|
||||
} broadcastOptions;
|
||||
|
||||
struct MainOptions
|
||||
|
@ -117,6 +117,23 @@ namespace Oyster
|
|||
*/
|
||||
int NetworkServer::GetPort();
|
||||
|
||||
|
||||
|
||||
/***************************************
|
||||
Broadcast functions
|
||||
***************************************/
|
||||
//Set broadcast settings.
|
||||
void SetBroadcast(CustomNetProtocol& broadcastMessage, float interval = 1.0f, bool enable = true);
|
||||
|
||||
//Set broadcast settings.
|
||||
void SetBroadcastMessage(CustomNetProtocol& broadcastMessage);
|
||||
|
||||
//Enable/disable broadcast.
|
||||
void SetBroadcast(bool enable);
|
||||
|
||||
//Set interval between each broadcast message in seconds.
|
||||
void SetBroadcastInterval(float interval);
|
||||
|
||||
private:
|
||||
struct PrivateData;
|
||||
PrivateData* privateData;
|
||||
|
|
Loading…
Reference in New Issue