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:
+139
@@ -0,0 +1,139 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "host.h"
|
||||
#include "entity.h"
|
||||
|
||||
//#############################################################################
|
||||
//################################ Host #################################
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
Host::Host(
|
||||
HostID host_ID,
|
||||
HostType host_type,
|
||||
const SOCKADDR_IN *network_address
|
||||
):
|
||||
hostType(host_type),
|
||||
allEntitySocket(NULL),
|
||||
dynamicMasterEntitySocket(NULL),
|
||||
dynamicReplicantEntitySocket(NULL)
|
||||
{
|
||||
Verify(host_ID >= FirstLegalHostID);
|
||||
hostID = host_ID;
|
||||
if (network_address)
|
||||
networkAddress = *network_address;
|
||||
else
|
||||
memset(&networkAddress, 0, sizeof(networkAddress));
|
||||
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()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user