Esempio n. 1
0
CasterTrunkContainer::~CasterTrunkContainer(void)
{
	PlayerBranchMap& map = m_mapGateBranches;
	while ( map.size() > 0)
	{
		PlayerBranchMap::iterator itr = map.begin();
		RemoveBranch( itr->second );
	}
}
Esempio n. 2
0
void CasterTrunkContainer::RemovePlayer(AvatarSrv* pPlayer, int32 nBranchID)
{
	PlayerBranchContainer* pBranch = GetBranch( nBranchID, true);
	if( pBranch )
	{
		int32 nID = m_bByNode ? pPlayer->GetAvatarID() : pPlayer->GetGateChannelID();
		if( pBranch->RemovePlayer( nID, pPlayer) )
		{
			if( pBranch->m_mapPlayers.size() == 0)
				RemoveBranch( pBranch );
		}
	}
}
void COutboundRouteInSim::AddTaxiwayInfoToOutboundRouteBranchInSim(CInOutboundRouteBranchInSim *pOutboundRouteBranchInSim, 
																   Taxiway *pTaxiway, int nTaxiwayIntersectNodeID, COutboundRouteItem *pOutboundRouteItem)
{
	ASSERT(pOutboundRouteBranchInSim);
	ASSERT(pTaxiway);
	ASSERT(pOutboundRouteItem);

	CInOutboundRouteBranchInSim *pCurrentOutboundRouteBranchInSim = new CInOutboundRouteBranchInSim(*pOutboundRouteBranchInSim);

	//if the taxiway is intersect with stand out node ,set stand id
	SetTaxiwayIntersectStandID(pTaxiway, nTaxiwayIntersectNodeID, pOutboundRouteBranchInSim);

	//this taxiway is intersect with runway
	if (0 == (int)pOutboundRouteItem->GetElementCount())
	{
		RunwayExit runwayExit;
		runwayExit.ReadData(m_pOutboundRoute->GetRunwayExitID());
		IntersectionNode rwINode = runwayExit.GetIntesectionNode();

		ALTObject *pALTObj = ALTObject::ReadObjectByID(m_pOutboundRoute->GetRunwayID());
		ASSERT(pALTObj);

		//the taxiway isn't intersect with runway
		if (ALT_RUNWAY != pALTObj->GetType())
		{
			BOOL bRet = RemoveBranch(pOutboundRouteBranchInSim);
			ASSERT(bRet);
			return;
		}
		Runway *pRunway = (Runway*)pALTObj;

		AddTaxiwaySegmentToOutboundRouteBranchInSim(pOutboundRouteBranchInSim, pTaxiway->getID(), nTaxiwayIntersectNodeID, rwINode.GetID());

		delete pALTObj;		
	}
	else
	{
		for (int i=0; i<(int)pOutboundRouteItem->GetElementCount(); i++)
		{
			COutboundRouteItem *pChildItem = pOutboundRouteItem->GetItem(i);
			int nChildItemINodeID = pChildItem->GetIntersectNodeID();
			int nChildItemObjID = pChildItem->GetALTObjectID();


			IntersectionNode iNode;
			iNode.ReadData(nChildItemINodeID);

			//int nNodeParentALTObjID = iNode.GetParentObjectID();

			//IntersectNode equalNode;

			//ALTObject *pChildObj = ALTObject::ReadObjectByID(nNodeParentALTObjID);
			//ASSERT(pChildObj);
			//switch(pChildObj->GetType())
			//{
			//case ALT_TAXIWAY:
			//	{
			//		Taxiway* pChildTw = (Taxiway*)pChildObj;
			//		BOOL bExist = m_pAirportGroundNetWork->FindEqualNode(pChildTw, &iNode, equalNode);
			//		ASSERT(bExist);
			//		ASSERT(equalNode.GetParentObjectID() == pTaxiway->getID());
			//	}
			//	break;

			//case ALT_RUNWAY: 
			//	ASSERT(FALSE);
			//	break;

			//default:
			//	ASSERT(FALSE);
			//	break;
			//}

			//More than one branch
			if (0<i)
			{
				CInOutboundRouteBranchInSim *pNewBranchInSim = new CInOutboundRouteBranchInSim(*pCurrentOutboundRouteBranchInSim);
				m_OutboundRouteBranchInSimList.push_back(pNewBranchInSim);

				AddTaxiwaySegmentToOutboundRouteBranchInSim(pNewBranchInSim, pTaxiway->getID(), nTaxiwayIntersectNodeID, iNode.GetID());
				InitOutboundRouteBranchInSimList(pNewBranchInSim, pChildItem);
			}
			else
			{
				AddTaxiwaySegmentToOutboundRouteBranchInSim(pOutboundRouteBranchInSim, pTaxiway->getID(), nTaxiwayIntersectNodeID, iNode.GetID());

				InitOutboundRouteBranchInSimList(pOutboundRouteBranchInSim, pChildItem);
			}
			
		}
	}

	delete pCurrentOutboundRouteBranchInSim;
}