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>
210 lines
4.2 KiB
C++
210 lines
4.2 KiB
C++
#include "munga.h"
|
|
#pragma hdrstop
|
|
|
|
#include "entityid.h"
|
|
|
|
//#############################################################################
|
|
//############################# 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);
|
|
}
|