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

193 lines
5.0 KiB
C++

//===========================================================================//
// File: slot.cc //
// Project: MUNGA Brick: Connection Library //
// Contents: Implementation details for the slot class //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 10/20/94 ECH Initial coding. //
// 10/28/94 JMA Made compatible with SGI CC //
// 11/03/94 ECH Made compatible with BC4.0 //
// 12/12/94 ECH Changed release handling //
//---------------------------------------------------------------------------//
// 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(SLOT_HPP)
#include <slot.hpp>
#endif
#if !defined(NODE_HPP)
#include <node.hpp>
#endif
MemoryBlock
SlotLink::AllocatedMemory(
sizeof(SlotLink),
SLOTLINK_MEMORYBLOCK_ALLOCATION,
SLOTLINK_MEMORYBLOCK_ALLOCATION,
"SlotLink"
);
//
//###########################################################################
// SlotLink
//###########################################################################
//
SlotLink::SlotLink(
Slot *slot,
Plug *plug
):
Link(slot, plug)
{
}
//
//###########################################################################
// ~SlotLink
//###########################################################################
//
SlotLink::~SlotLink()
{
Slot *slot = Cast_Object(Slot*, socket);
//
//-------------------------------------------------
// Make sure the link is not referenced by the slot
//-------------------------------------------------
//
Check(slot);
Verify(slot->slotLink == this);
slot->slotLink = NULL;
//
//------------------------------------------
// Remove this link from any plug references
//------------------------------------------
//
ReleaseFromPlug();
//
//-------------------------------------------------------------
// Tell the node to release this link. Note that this link
// is not referenced by the plug or the slot at this point in
// time.
//-------------------------------------------------------------
//
if (slot->GetReleaseNode() != NULL)
{
Check(slot->GetReleaseNode());
slot->GetReleaseNode()->ReleaseLinkHandler(slot, plug);
}
}
//
//###########################################################################
// TestInstance
//###########################################################################
//
Logical
SlotLink::TestInstance() const
{
Link::TestInstance();
return True;
}
//
//###########################################################################
// Slot
//###########################################################################
//
Slot::Slot(
Node *node
):
Socket(node)
{
slotLink = NULL;
}
//
//###########################################################################
// ~Slot
//###########################################################################
//
Slot::~Slot()
{
SetReleaseNode(NULL);
if (slotLink != NULL)
{
Unregister_Object(slotLink);
delete slotLink;
}
}
//
//###########################################################################
// TestInstance
//###########################################################################
//
Logical
Slot::TestInstance() const
{
Socket::TestInstance();
if (slotLink != NULL)
{
Check(slotLink);
}
return True;
}
//
//###########################################################################
// Remove
//###########################################################################
//
void
Slot::Remove()
{
if (slotLink != NULL)
{
Unregister_Object(slotLink);
delete slotLink;
slotLink = NULL;
}
}
//
//###########################################################################
// AddImplementation
//###########################################################################
//
void
Slot::AddImplementation(
Plug *plug
)
{
Verify(slotLink == NULL);
slotLink = new SlotLink(this, plug);
Register_Object(slotLink);
}
//
//###########################################################################
// GetCurrentPlug
//###########################################################################
//
Plug*
Slot::GetCurrentPlug() const
{
if (slotLink != NULL)
{
Check(slotLink);
return slotLink->GetPlug();
}
return NULL;
}