当前位置: 首页>>代码示例>>C++>>正文


C++ CVehicle::GetLocked方法代码示例

本文整理汇总了C++中CVehicle::GetLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetLocked方法的具体用法?C++ CVehicle::GetLocked怎么用?C++ CVehicle::GetLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVehicle的用法示例。


在下文中一共展示了CVehicle::GetLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetLocked

// getVehicleLocked(vehicleid)
int CVehicleModuleNatives::GetLocked(EntityId vehicleId)
{
    CVehicle * pVehicle = g_pVehicleManager->GetAt(vehicleId);

    if(pVehicle)
    {
        return pVehicle->GetLocked();
    }

    return -1;
}
开发者ID:mat27,项目名称:ivmultiplayer,代码行数:12,代码来源:VehicleModuleNatives.cpp

示例2: VehicleEnterExit

void CServerRPCHandler::VehicleEnterExit(CBitStream * pBitStream, CPlayerSocket * pSenderSocket)
{
	// Ensure we have a valid bit stream
	if(!pBitStream)
		return;

	EntityId playerId;
	if(!pBitStream->ReadCompressed(playerId))
		return;

	// Check the host
	if(playerId != pSenderSocket->GetPlayerId())
		return;

	// Get the player pointer
	CPlayer * pPlayer = g_pPlayerManager->GetAt(playerId);

	// Is the player pointer valid?
	if(pPlayer)
	{
		// Read the vehicle entry/exit type
		BYTE byteVehicleEntryExitType;

		if(!pBitStream->Read(byteVehicleEntryExitType))
			return;

		// Read the vehicle id
		EntityId vehicleId;

		if(!pBitStream->ReadCompressed(vehicleId))
			return;

		// Get the vehicle
		CVehicle * pVehicle = g_pVehicleManager->GetAt(vehicleId);

		// Does the vehicle not exist?
		if(!pVehicle)
			return;

		// Is this an entry request?
		if(byteVehicleEntryExitType == VEHICLE_ENTRY_REQUEST)
		{
			// Read the seat id
			BYTE byteSeatId;

			if(!pBitStream->Read(byteSeatId))
				return;

			bool bReply = true;

			// Is the vehicle fully locked?
			if(pVehicle->GetLocked() == 1)
				bReply = false;
			else
			{
				// Get the reply
				CSquirrelArguments arguments;
				arguments.push(playerId);
				arguments.push(vehicleId);
				arguments.push(byteSeatId);
				bReply = (g_pEvents->Call("vehicleEntryRequest", &arguments).GetInteger() == 1);
			}

			// Reply to the vehicle entry request
			CBitStream bitStream;
			bitStream.WriteCompressed(playerId);
			bitStream.WriteBit(bReply);

			//-Was the reply ok?
			if(bReply)
			{
				bitStream.Write((BYTE)VEHICLE_ENTRY_RETURN);
				bitStream.Write(vehicleId);
				bitStream.Write(byteSeatId);

				// Set the player state
				pPlayer->SetState(STATE_TYPE_ENTERVEHICLE);
			}

			g_pNetworkManager->RPC(RPC_VehicleEnterExit, &bitStream, PRIORITY_HIGH, RELIABILITY_RELIABLE, INVALID_ENTITY_ID, true);
		}
		// Is this an entry cancellation?
		if(byteVehicleEntryExitType == VEHICLE_ENTRY_CANCELLED)
		{
			// Read the seat id
			BYTE byteSeatId;

			if(!pBitStream->Read(byteSeatId))
				return;

			// Call the event
			CSquirrelArguments arguments;
			arguments.push(playerId);
			arguments.push(vehicleId);
			arguments.push(byteSeatId);
			g_pEvents->Call("vehicleEntryCancelled", &arguments);

			CBitStream bitStream;
			bitStream.WriteCompressed(playerId);
			bitStream.WriteBit(true);
//.........这里部分代码省略.........
开发者ID:JamesConway69,项目名称:ivmultiplayer,代码行数:101,代码来源:CServerRPCHandler.cpp


注:本文中的CVehicle::GetLocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。