//===========================================================================// // File: host.cc // // Project: MUNGA Brick: Connection Library // // Contents: Interface specification for base Host class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 10/28/94 ECH Initial coding. // // 11/03/94 ECH Develop to munga spec // // 11/29/94 JMA Moved EntityID to entity.cc // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(HOST_HPP) #include #endif #if !defined(ENTITY_HPP) #include #endif //############################################################################# //################################ Host ################################# //############################################################################# // //############################################################################# //############################################################################# // Host::Host( HostID host_ID, HostType host_type, NetworkAddress network_address ): hostType(host_type), allEntitySocket(NULL), dynamicMasterEntitySocket(NULL), dynamicReplicantEntitySocket(NULL) { Verify(host_ID >= FirstLegalHostID); hostID = host_ID; networkAddress = network_address; 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(&host->allEntitySocket) { } Host__AllEntityIterator::~Host__AllEntityIterator() { } //~~~~~~~~~~~~~~~~~~~~~ Host__DynamicMasterEntityIterator ~~~~~~~~~~~~~~~~~~~~~ Host__DynamicMasterEntityIterator:: Host__DynamicMasterEntityIterator(Host *host): SChainIteratorOf(&host->dynamicMasterEntitySocket) { } Host__DynamicMasterEntityIterator::~Host__DynamicMasterEntityIterator() { } //~~~~~~~~~~~~~~~~~~~~ Host__DynamicReplicantEntityIterator ~~~~~~~~~~~~~~~~~~~ Host__DynamicReplicantEntityIterator:: Host__DynamicReplicantEntityIterator(Host *host): SChainIteratorOf(&host->dynamicReplicantEntitySocket) { } Host__DynamicReplicantEntityIterator::~Host__DynamicReplicantEntityIterator() { }