Files
TeslaRel410/CODE/RP/MUNGA/HOST.CPP
T
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

160 lines
4.5 KiB
C++

//===========================================================================//
// File: host.cc //
// 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 //
// 11/29/94 JMA Moved EntityID to entity.cc //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <munga.hpp>
#pragma hdrstop
#if !defined(HOST_HPP)
#include <host.hpp>
#endif
#if !defined(ENTITY_HPP)
#include <entity.hpp>
#endif
//#############################################################################
//################################ Host #################################
//#############################################################################
//
//#############################################################################
//#############################################################################
//
Host::Host(
HostID host_ID,
HostType host_type,
NetworkAddress network_address
):
hostType(host_type),
allEntitySocket(NULL),
dynamicMasterEntitySocket(NULL),
dynamicReplicantEntitySocket(NULL)
{
Verify(host_ID >= FirstLegalHostID);
hostID = host_ID;
networkAddress = network_address;
currentConnectStatus = NoNetworkConnectionStatus;
}
//
//#############################################################################
//#############################################################################
//
Host::~Host()
{
}
//
//#############################################################################
//#############################################################################
//
Logical
Host::TestInstance() const
{
Node::TestInstance();
Verify(hostID >= FirstLegalHostID);
Verify(
hostType == GameMachineHostType ||
hostType == MissionReviewHostType ||
hostType == ConsoleHostType
);
Check(&allEntitySocket);
Check(&dynamicMasterEntitySocket);
Check(&dynamicReplicantEntitySocket);
return True;
}
//
//#############################################################################
//#############################################################################
//
void
Host::AddEntity(Entity *entity)
{
Check(this);
Check(entity);
//
// Add entity to all socket
//
allEntitySocket.Add(entity);
//
// Conditionally add entity to aux sockets
//
switch (entity->GetInstance())
{
case Entity::MasterInstance:
case Entity::IndependantInstance:
case Entity::HermitInstance:
if (entity->IsDynamic())
{
dynamicMasterEntitySocket.Add(entity);
}
break;
case Entity::ReplicantInstance:
if (entity->IsDynamic())
{
dynamicReplicantEntitySocket.Add(entity);
}
break;
default:
Fail("Host::AddEntity - Should never reach here");
break;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~ Host__AllEntityIterator ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Host__AllEntityIterator::Host__AllEntityIterator(Host *host):
SChainIteratorOf<Entity*>(&host->allEntitySocket)
{
}
Host__AllEntityIterator::~Host__AllEntityIterator()
{
}
//~~~~~~~~~~~~~~~~~~~~~ Host__DynamicMasterEntityIterator ~~~~~~~~~~~~~~~~~~~~~
Host__DynamicMasterEntityIterator::
Host__DynamicMasterEntityIterator(Host *host):
SChainIteratorOf<Entity*>(&host->dynamicMasterEntitySocket)
{
}
Host__DynamicMasterEntityIterator::~Host__DynamicMasterEntityIterator()
{
}
//~~~~~~~~~~~~~~~~~~~~ Host__DynamicReplicantEntityIterator ~~~~~~~~~~~~~~~~~~~
Host__DynamicReplicantEntityIterator::
Host__DynamicReplicantEntityIterator(Host *host):
SChainIteratorOf<Entity*>(&host->dynamicReplicantEntitySocket)
{
}
Host__DynamicReplicantEntityIterator::~Host__DynamicReplicantEntityIterator()
{
}