Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+167
@@ -0,0 +1,167 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "slot.h"
|
||||
#include "node.h"
|
||||
|
||||
MemoryBlock *SlotLink::GetAllocatedMemory()
|
||||
{
|
||||
static MemoryBlock allocatedMemory(sizeof(SlotLink), SLOTLINK_MEMORYBLOCK_ALLOCATION, SLOTLINK_MEMORYBLOCK_ALLOCATION, "SlotLink");
|
||||
return &allocatedMemory;
|
||||
}
|
||||
|
||||
//
|
||||
//###########################################################################
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user