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

227 lines
5.5 KiB
C++

//===========================================================================//
// File: entity2.cc //
// Project: MUNGA Brick: Entity Manager //
// Contents: Implementation details of the entity class //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 11/29/94 JMA Initial coding. //
//---------------------------------------------------------------------------//
// 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(ENTITYID_HPP)
# include <entityid.hpp>
#endif
//#############################################################################
//############################# EntityID ################################
//#############################################################################
EntityID
EntityID::Null;
EntityID::LocalID
EntityID::LocalNull = 0;
#if defined(USE_SIGNATURE)
int
Is_Signature_Bad(const volatile EntityID *)
{
return False;
}
#endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID::EntityID():
hostID(NullHostID),
localID(LocalNull)
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID::EntityID(const EntityID &entityID):
hostID(entityID.hostID),
localID(entityID.localID)
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID::EntityID(HostID hostID)
{
this->hostID = hostID;
this->localID = LocalNull;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID::EntityID(
HostID hostID,
LocalID localID
)
{
this->hostID = hostID;
this->localID = localID;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::TestInstance() const
{
return True;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID&
EntityID::operator=(const EntityID &entityID)
{
hostID = entityID.hostID;
localID = entityID.localID;
return *this;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID&
EntityID::operator+=(const EntityID &entityID)
{
Check(this);
Check(&entityID);
hostID += entityID.hostID;
localID += entityID.localID;
return *this;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID
EntityID::operator-(const EntityID &entityID) const
{
Check(this);
Check(&entityID);
return EntityID(
(HostID)(hostID - entityID.hostID),
(HostID)(localID - entityID.localID)
);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID&
EntityID::operator-=(const EntityID &entityID)
{
Check(this);
Check(&entityID);
hostID -= entityID.hostID;
localID -= entityID.localID;
return *this;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID&
EntityID::operator+=(LocalID i)
{
Check(this);
localID += i;
return *this;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID&
EntityID::operator-=(LocalID i)
{
Check(this);
localID -= i;
return *this;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator<(const EntityID &entityID) const
{
return
(hostID == entityID.hostID) ?
(localID < entityID.localID) :
(hostID < entityID.hostID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator<=(const EntityID &entityID) const
{
return
(hostID == entityID.hostID) ?
(localID <= entityID.localID) :
(hostID < entityID.hostID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator>(const EntityID &entityID) const
{
return
(hostID == entityID.hostID) ?
(localID > entityID.localID) :
(hostID > entityID.hostID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator>=(const EntityID &entityID) const
{
return
(hostID == entityID.hostID) ?
(localID >= entityID.localID) :
(hostID > entityID.hostID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator==(const EntityID &entityID) const
{
return
(hostID == entityID.hostID &&
localID == entityID.localID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
Logical
EntityID::operator!=(const EntityID &entityID) const
{
return
(hostID != entityID.hostID ||
localID != entityID.localID);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
EntityID::operator int() const
{
return int(localID);
}