#include "pch.hpp"
//
//============================================================
//
// Contents:  Network Global variables
//
// Owner   :  AndyG
// Created :  Aug 3 1999
//
// All Rights reserved worldwide (c) Microsoft
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL
//============================================================
//
#include "Net_Header.hpp"




//
// Interfaces
//
IDirectPlayLobby3*		dplobby3;				// Lobby interface
IDirectPlay4*			dplay4;					// Direct Play interface



//
// Debugging variables
//
PacketLogging*	pPacketLog;
//
// Exact time network stats were grabbed
//
double NetworkDebugTime;
//
// Pointer to log at start of frame
//
PacketLogging*	pDebugPacketLog;


//
// Last time that games and players were enumerated
//
double LastEnumTime;
bool WaitingForEnum;


//
// True if protocol exists
//
bool hasTCP=0;
bool hasIPX=0;
bool hasModem=0;
bool hasSerial=0;
bool hasZoneMatch=0;

//
// False when not connected, protocol type when connected
//
int Connected=NP_NOT;

//
// Result from the last enumeration
//
HRESULT EnumResult=0;

//
// True when a game created or joined
//
bool InNetworkGame;

//
// True when created the game
//
bool IAmTheServer;

//
// Current players ID
//
DWORD MyDirectPlayID;

//
// String containing my address (when TCPIP)
//
char* MyIPAddress;

//
// Valid serial ports
//
ListOfNames* SerialPortNames=0;

//
// Valid modem names (maximum of 8)
//
ListOfNames* ModemNames=0;

//
// Points to a list of the current game names found on the network
//
ListOfGames* GameNames=0;

//
// Points to a list of the current game names found on the network being enumerated
//
ListOfGames* EnumNames=0;

//
// Current session description for joined/created games
//
DPSESSIONDESC2 CurrentSession;

//
// List of players in the current game
//
ListOfNames* CurrentPlayers=0;

//
// Buffer used while receiving messages
//
BYTE* MessageBuffer=0;
DWORD MessageBufferSize=0;

//
// Points to a list of messages that the Application will pull message from
//
Messages*	pMessages=0;
//
// Points to the last message read by the Application (will be freed)
//
Messages*	pLastMessage=0;

//
// Variables for receive packet thread
//
unsigned int NetworkThreadID=0;
HANDLE HandleNetworkThread;
CRITICAL_SECTION NetworkCriticalSection;
HANDLE NetworkEvent;
HANDLE KillNetworkEvent;

//
// Variables for the enumeration thread
//
unsigned int EnumThreadID=0;
HANDLE HandleEnumThread;
CRITICAL_SECTION EnumCriticalSection;
HANDLE EnumEvent;
HANDLE KillEnumEvent;

//
// Used to pass data between threads
//
PacketBuffer* pEmptyList;		// List of spare blocks
PacketBuffer* pPackets;			// List of received packets
PacketBuffer* pLastPacket;		// End of list of received packets




