Files
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
Archival snapshot of the Virtual World Entertainment Tesla cockpit
software, 1994-1996: MUNGA engine and L4 pod layer source (Borland
C++ 5.0), BT/RP game code, and game content (models, audio, maps,
gauges, Division renderer data). Includes third-party libraries:
Division dVS/DPL graphics, HMI SOS audio, WATTCP networking.

Files are preserved byte-for-byte (.gitattributes disables all
line-ending conversion). README.md documents the layout, target
hardware, and toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 13:21:58 -05:00

239 lines
6.0 KiB
C++

//===========================================================================//
// File: host.hpp //
// Project: MUNGA Brick: Connection Library //
// Contents: Interface specification for base Host class //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 10/28/94 ECH Initial coding. //
// 11/03/94 ECH Develop to munga spec //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#if !defined(HOST_HPP)
# define HOST_HPP
# if !defined(NODE_HPP)
# include <node.hpp>
# endif
# if !defined(HOSTID_HPP)
# include <hostid.hpp>
# endif
# if !defined(SCHAIN_HPP)
# include <schain.hpp>
# endif
# if !defined(NETWORK_HPP)
# include <network.hpp>
# endif
class Entity;
//##########################################################################
//####### Support types for entity identity and host manager #########
//##########################################################################
enum HostType
{
GameMachineHostType,
CameraShipHostType,
MissionReviewHostType,
ConsoleHostType
};
//##########################################################################
//############################ Host ##################################
//##########################################################################
class Host:
public Node
{
friend class HostManager;
friend class Host__AllEntityIterator;
friend class Host__DynamicMasterEntityIterator;
friend class Host__DynamicReplicantEntityIterator;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Public types
//
public:
typedef Host__AllEntityIterator
AllEntityIterator;
//
// NoNetworkConnectionStatus -
// Initial state, host just created with no net link
// OpeningConnectionStatus -
// Waiting for completion of an active open to this host
// ListeningConnectionStatus -
// Waiting for this host to connect to us
// OnLineConnectionStatus -
// Host is on-line and ready
//
enum ConnectionStatus
{
NoNetworkConnectionStatus,
OpeningConnectionStatus,
ListeningConnectionStatus,
OnLineConnectionStatus
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction, and testing
//
public:
Host(
HostID host_ID,
HostType host_type,
NetworkAddress network_address
);
~Host();
Logical
TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Accessors
//
public:
HostType
GetHostType();
HostID
GetHostID();
NetworkAddress
GetNetworkAddress();
void
SetNetworkAddress(NetworkAddress network_address);
ConnectionStatus
GetConnectStatus();
void
SetConnectStatus(ConnectionStatus new_status);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Host Manager support
//
private:
void
AddEntity(Entity *entity);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private data
//
private:
HostID
hostID;
HostType
hostType;
NetworkAddress
networkAddress;
ConnectionStatus
currentConnectStatus;
//
// The all entity socket contains all entities that are on this host.
//
SChainOf<Entity*>
allEntitySocket;
//
// The dynamic master entity socket contains all entities that are
// masters and dynamic
//
SChainOf<Entity*>
dynamicMasterEntitySocket;
//
// The dynamic replicant entity socket contains all entities that are
// replicants and dynamic
//
SChainOf<Entity*>
dynamicReplicantEntitySocket;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Host inlines ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
inline HostType
Host::GetHostType()
{
Check(this);
return hostType;
}
inline HostID
Host::GetHostID()
{
Check(this);
return hostID;
}
inline NetworkAddress
Host::GetNetworkAddress()
{
Check(this);
return networkAddress;
}
inline void
Host::SetNetworkAddress(NetworkAddress network_address)
{
Check(this);
Verify(networkAddress == NullNetworkAddress);
Verify(network_address != NullNetworkAddress);
networkAddress = network_address;
}
inline Host::ConnectionStatus
Host::GetConnectStatus()
{
Check(this);
return currentConnectStatus;
}
inline void
Host::SetConnectStatus(ConnectionStatus new_status)
{
Check(this);
currentConnectStatus = new_status;
}
//~~~~~~~~~~~~~~~~~~~~~~~~ Host__AllEntityIterator ~~~~~~~~~~~~~~~~~~~~~~~~~
class Host__AllEntityIterator:
public SChainIteratorOf<Entity*>
{
public:
Host__AllEntityIterator(Host *host);
~Host__AllEntityIterator();
};
//~~~~~~~~~~~~~~~~~~~~ Host__DynamicMasterEntityIterator ~~~~~~~~~~~~~~~~~~~
class Host__DynamicMasterEntityIterator:
public SChainIteratorOf<Entity*>
{
public:
Host__DynamicMasterEntityIterator(Host *host);
~Host__DynamicMasterEntityIterator();
};
//~~~~~~~~~~~~~~~~~~~ Host__DynamicReplicantEntityIterator ~~~~~~~~~~~~~~~~~
class Host__DynamicReplicantEntityIterator:
public SChainIteratorOf<Entity*>
{
public:
Host__DynamicReplicantEntityIterator(Host *host);
~Host__DynamicReplicantEntityIterator();
};
#endif