Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
227 lines
5.8 KiB
C++
227 lines
5.8 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 "StuffHeaders.hpp"
|
|
|
|
MemoryBlock*
|
|
SlotLink::s_AllocatedMemory = NULL;
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
void
|
|
SlotLink::InitializeClass(size_t block_count)
|
|
{
|
|
Verify(!s_AllocatedMemory);
|
|
s_AllocatedMemory =
|
|
new MemoryBlock(
|
|
sizeof(SlotLink),
|
|
block_count,
|
|
block_count>>2,
|
|
"Stuff::SlotLink",
|
|
g_ConnectionEngineHeap
|
|
);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
void
|
|
SlotLink::TerminateClass()
|
|
{
|
|
delete s_AllocatedMemory;
|
|
s_AllocatedMemory = NULL;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// SlotLink
|
|
//###########################################################################
|
|
//
|
|
SlotLink::SlotLink(
|
|
Slot *slot,
|
|
Plug *m_plug
|
|
):
|
|
Link(slot, m_plug)
|
|
{
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// ~SlotLink
|
|
//###########################################################################
|
|
//
|
|
SlotLink::~SlotLink()
|
|
{
|
|
Check_Object(this);
|
|
Slot *slot = Cast_Object(Slot*, m_socket);
|
|
|
|
//
|
|
//-------------------------------------------------
|
|
// Make sure the link is not referenced by the slot
|
|
//-------------------------------------------------
|
|
//
|
|
Check_Object(slot);
|
|
Verify(slot->m_slotLink == this);
|
|
slot->m_slotLink = NULL;
|
|
|
|
//
|
|
//------------------------------------------
|
|
// Remove this link from any m_plug references
|
|
//------------------------------------------
|
|
//
|
|
ReleaseFromPlug();
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// Slot
|
|
//###########################################################################
|
|
//
|
|
Slot::Slot(void *)
|
|
{
|
|
m_slotLink = NULL;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// ~Slot
|
|
//###########################################################################
|
|
//
|
|
Slot::~Slot()
|
|
{
|
|
Check_Object(this);
|
|
if (m_slotLink != NULL)
|
|
{
|
|
Check_Object(m_slotLink);
|
|
delete m_slotLink;
|
|
}
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// TestInstance
|
|
//###########################################################################
|
|
//
|
|
void
|
|
Slot::TestInstance()
|
|
{
|
|
Socket::TestInstance();
|
|
if (m_slotLink != NULL)
|
|
{
|
|
Check_Object(m_slotLink);
|
|
}
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// Remove
|
|
//###########################################################################
|
|
//
|
|
void
|
|
Slot::Remove()
|
|
{
|
|
Check_Object(this);
|
|
if (m_slotLink != NULL)
|
|
{
|
|
Check_Object(m_slotLink);
|
|
delete m_slotLink;
|
|
m_slotLink = NULL;
|
|
}
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// AddPlug
|
|
//###########################################################################
|
|
//
|
|
void
|
|
Slot::AddPlug(Plug *m_plug)
|
|
{
|
|
Check_Object(this);
|
|
Verify(m_slotLink == NULL);
|
|
m_slotLink = new SlotLink(this, m_plug);
|
|
Check_Object(m_slotLink);
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// DeletePlugs
|
|
//###########################################################################
|
|
//
|
|
void
|
|
Slot::DeletePlugs()
|
|
{
|
|
STOP(("Not legal"));
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// GetNthItem
|
|
//###########################################################################
|
|
//
|
|
void*
|
|
Slot::GetNthItem(unsigned index)
|
|
{
|
|
STOP(("Not legal"));
|
|
return NULL;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// GetSize
|
|
//###########################################################################
|
|
//
|
|
unsigned
|
|
Slot::GetSize()
|
|
{
|
|
STOP(("Not legal"));
|
|
return NULL;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// IsEmpty
|
|
//###########################################################################
|
|
//
|
|
bool
|
|
Slot::IsEmpty()
|
|
{
|
|
STOP(("Not legal"));
|
|
return false;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
// GetCurrentPlug
|
|
//###########################################################################
|
|
//
|
|
Plug*
|
|
Slot::GetCurrentPlug() const
|
|
{
|
|
Check_Object((Slot*)this);
|
|
if (m_slotLink != NULL)
|
|
{
|
|
Check_Object(m_slotLink);
|
|
return m_slotLink->GetPlug();
|
|
}
|
|
return NULL;
|
|
}
|
|
|