Exemplo n.º 1
0
Arquivo: Space.cpp Projeto: GMIS/GMIS
void ROOM_SPACE::DeleteOwner(People& p)
{

	ePipeline& OwnerInfo = GetOwnerInfo();
    ePipeline& OwnerList = *(ePipeline*)OwnerInfo.GetData(REG_OWNER_LIST);

	for (int i=0; i<OwnerInfo.Size();i++)
	{
		ePipeline* Owner = (ePipeline*)OwnerList.GetData(i);
		tstring& Cryptograph = *(tstring*)Owner->GetData(2);
		if (Cryptograph == p.m_Cryptograhp)
		{
			OwnerList.EraseEnergy(i,1);
			return ;
		}
	}

	if(p.GetParentID() == GetSpaceID()){
		p.GoOut();
		
		//这里应该有更多处理,p被赶出此空间,那么应该退回到上一个空间
		assert(0);
		return;
	}

}
Exemplo n.º 2
0
Arquivo: Space.cpp Projeto: GMIS/GMIS
bool  ROOM_SPACE::AllowInto(People& p){
	if (!IsValid())
	{
		return false;
	}

    //如果已经在此空间则直接返回
	if(p.GetParentID() == m_ID)return true;
    
	int64 ChildID = 0;


	ePipeline& OwnerInfo = GetOwnerInfo();
	SPACE_RIGHT RoomRight = *(SPACE_RIGHT*)OwnerInfo.GetData(REG_RIGHT);

	ePipeline& OwnerList = *(ePipeline*)OwnerInfo.GetData(REG_OWNER_LIST);

	for (int i=0; i<OwnerList.Size();i++)
	{
		ePipeline* Owner = (ePipeline*)OwnerList.GetData(i);
		tstring& Cryptograph = *(tstring*)Owner->GetData(2);
		if (Cryptograph == p.m_Cryptograhp)
		{
			SPACE_RIGHT Right = *(SPACE_RIGHT*)Owner->GetData(1);
			if(Right >= RoomRight){
				return true;
			}
			break;
		}
	}

    //访问者不是固定注册的拥有者,但只要当前空间不禁止参观也可以进入
	bool Allow = false;

	switch(RoomRight)
	{
	case NO_RIGHT:
		{   //能够访问,robot的访问权限保持不变
			Allow = true;	
		}
		break;
	case VISIT_ONLY:
		{
			Allow = true;
		}
		break;
	case VISIT_NOTIFY:
		{
			//通知其它人,暂时没有实现
			assert(0);
		}
		break;
	case VISIT_APPLY:
		{
			//提出申请,暂时没有实现
			assert(0);
		}
	case USABLE:
		{
			Allow = true;
		}
		break;
	case USABLE_NOTIFY:
		{
			//通知其它人,暂时没有实现
			assert(0);
		}
		break;
	case USABLE_APPLY:
		{
			//提出申请,暂时没有实现
			assert(0);
		}
		break;
	case HOLD_NOTIFY:
		{
			//通知其它人,暂时没有实现
			assert(0);
		}
		break;
	case HOLD_APPLY:
		{
			//提出申请,暂时没有实现
			assert(0);
		}
		break;
	case RIGHT_HOLD:
		{
			//显然不允许
		}
		break;
	}
	return Allow;
}