本文整理汇总了C++中CVehicle::GetTowedVehicle方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetTowedVehicle方法的具体用法?C++ CVehicle::GetTowedVehicle怎么用?C++ CVehicle::GetTowedVehicle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVehicle
的用法示例。
在下文中一共展示了CVehicle::GetTowedVehicle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
//.........这里部分代码省略.........
// Trailer chain
CVehicle* pTowedByVehicle = pVehicle;
CVehicle* pTrailer = NULL;
ElementID TrailerID;
bool bHasTrailer;
if ( !BitStream.ReadBit ( bHasTrailer ) )
return false;
while ( bHasTrailer )
{
BitStream.ReadCompressed ( TrailerID );
CElement* pElement = CElementIDs::GetElement ( TrailerID );
if ( pElement )
pTrailer = static_cast < CVehicle* > ( pElement );
// Read out the trailer position and rotation
SPositionSync trailerPosition ( false );
if ( !BitStream.Read ( &trailerPosition ) )
return false;
SRotationDegreesSync trailerRotation;
if ( !BitStream.Read ( &trailerRotation ) )
return false;
// If we found the trailer
if ( pTrailer )
{
// Set its position and rotation
pTrailer->SetPosition ( trailerPosition.data.vecPosition );
pTrailer->SetRotationDegrees ( trailerRotation.data.vecRotation );
// Is this a new trailer, attached?
CVehicle* pCurrentTrailer = pTowedByVehicle->GetTowedVehicle ();
if ( pCurrentTrailer != pTrailer )
{
// If theres a trailer already attached
if ( pCurrentTrailer )
{
pTowedByVehicle->SetTowedVehicle ( NULL );
pCurrentTrailer->SetTowedByVehicle ( NULL );
// Tell everyone to detach them
CVehicleTrailerPacket AttachPacket ( pTowedByVehicle, pCurrentTrailer, false );
g_pGame->GetPlayerManager ()->BroadcastOnlyJoined ( AttachPacket );
// Execute the attach trailer script function
CLuaArguments Arguments;
Arguments.PushElement ( pTowedByVehicle );
pCurrentTrailer->CallEvent ( "onTrailerDetach", Arguments );
}
// If something else is towing this trailer
CVehicle* pCurrentVehicle = pTrailer->GetTowedByVehicle ();
if ( pCurrentVehicle )
{
pCurrentVehicle->SetTowedVehicle ( NULL );
pTrailer->SetTowedByVehicle ( NULL );
// Tell everyone to detach them
CVehicleTrailerPacket AttachPacket ( pCurrentVehicle, pTrailer, false );
g_pGame->GetPlayerManager ()->BroadcastOnlyJoined ( AttachPacket );
// Execute the attach trailer script function
CLuaArguments Arguments;
Arguments.PushElement ( pCurrentVehicle );
示例2: SendMapInformation
void CMapManager::SendMapInformation ( CPlayer& Player )
{
// Start an entity list packet
CEntityAddPacket EntityPacket;
// Add the dummys to the packet
list < CDummy* > ::const_iterator iterDummys = m_pGroups->IterBegin ();
for ( ; iterDummys != m_pGroups->IterEnd () ; iterDummys++ )
{
CDummy* pDummy = *iterDummys;
if ( pDummy != m_pRootElement )
{
EntityPacket.Add ( pDummy );
}
}
// Add the objects to the packet
CObjectListType::const_iterator iterObjects = m_pObjectManager->IterBegin ();
for ( ; iterObjects != m_pObjectManager->IterEnd (); iterObjects++ )
{
EntityPacket.Add ( *iterObjects );
}
// Add the pickups to the packet
list < CPickup* > ::const_iterator iterPickups = m_pPickupManager->IterBegin ();
for ( ; iterPickups != m_pPickupManager->IterEnd (); iterPickups++ )
{
EntityPacket.Add ( *iterPickups );
}
// Add the vehicles to the packet
list < CVehicle* > ::const_iterator iterVehicles = m_pVehicleManager->IterBegin ();
for ( ; iterVehicles != m_pVehicleManager->IterEnd (); iterVehicles++ )
{
EntityPacket.Add ( *iterVehicles );
}
// Add the teams to the packet
list < CTeam* > ::const_iterator iterTeams = m_pTeamManager->IterBegin ();
for ( ; iterTeams != m_pTeamManager->IterEnd (); iterTeams++ )
{
EntityPacket.Add ( *iterTeams );
}
// Add the peds to the packet
list < CPed* > ::const_iterator iterPeds = m_pPedManager->IterBegin ();
for ( ; iterPeds != m_pPedManager->IterEnd (); iterPeds++ )
{
EntityPacket.Add ( *iterPeds );
}
// Add the colshapes to the packet
vector < CColShape* > ::const_iterator iterColShapes = m_pColManager->IterBegin ();
for ( ; iterColShapes != m_pColManager->IterEnd (); iterColShapes++ )
{
CColShape * pColShape = *iterColShapes;
if ( !pColShape->IsPartnered () )
{
EntityPacket.Add ( *iterColShapes );
}
}
// Add the water polys to the packet
CWaterManager* pWaterManager = g_pGame->GetWaterManager ();
list < CWater* > ::const_iterator iterWater = pWaterManager->IterBegin ();
for ( ; iterWater != pWaterManager->IterEnd (); iterWater++ )
{
CWater* pWater = *iterWater;
EntityPacket.Add ( pWater );
}
// Send it
Player.Send ( EntityPacket );
// Send per-player entities
SendPerPlayerEntities ( Player );
// Send the trailer attachments
CVehicle* pVehicle;
CVehicle* pTowedVehicle;
iterVehicles = m_pVehicleManager->IterBegin ();
for ( ; iterVehicles != m_pVehicleManager->IterEnd (); iterVehicles++ )
{
pVehicle = *iterVehicles;
pTowedVehicle = pVehicle->GetTowedVehicle ( );
if ( pTowedVehicle )
{
CVehicleTrailerPacket AttachPacket ( pVehicle, pTowedVehicle, true );
Player.Send ( AttachPacket );
}
}
}
示例3: cheat_panic
int cheat_panic ( void )
{
traceLastFunc( "cheat_panic()" );
static int pstate_map = 0, // m0d's map
pstate_d3dtext_hud = 0, // hud bar
pstate_actor_hp_nSP = 0, // "Extra actor invincibility" patch (invulnerable single player enemies)
pstate_actor_hp_SP = 0, // "Extra actor invincibility2" patch (no problems in SP)
pstate_vehicle_hp = 0, // vehicle hp patch
pstate_generic_menu = 0, // m0d's menu
pstate_infnos = 0, // infinite NOS
pstate_ini[INI_PATCHES_MAX],
pstate_dummy_aligner; // this should all be a structure, static = DOING IT WRONG
int i;
// sa-mp related
static int pstate_chat = 0, // chat
pstate_deathlist = 0; // deathlist
if ( KEY_PRESSED(set.key_panic) )
{
// toggle panic
cheat_state->_generic.cheat_panic_enabled ^= 1;
if ( cheat_state->_generic.cheat_panic_enabled )
{
struct actor_info *actor_info = actor_info_get( ACTOR_SELF, ACTOR_ALIVE );
if ( actor_info )
{
actor_info->flags &= ~ACTOR_FLAGS_INVULNERABLE;
actor_info->weapon_slot = 0;
}
// remove infinite NOS
pstate_infnos = cheat_state->vehicle.infNOS_toggle_on;
cheat_state->vehicle.infNOS_toggle_on = false;
patcher_remove( &patch_vehicle_inf_NOS );
if ( pPedSelf->GetVehicle() )
{
CVehicle *pVehicleSelf = pPedSelf->GetVehicle();
CVehicle *pVehicleTemp = NULL;
for ( pVehicleTemp = pVehicleSelf; pVehicleTemp != NULL; pVehicleTemp = pVehicleTemp->GetTowedVehicle() )
{
pVehicleTemp->SetGravity( &CVector(0.0, 0.0, -1.0) );
pVehicleTemp->SetCanBeDamaged( true );
if ( !set.trailer_support )
break;
}
// remove inf NOS
if ( pstate_infnos )
{
pVehicleSelf->RemoveVehicleUpgrade( 1010 );
//pVehicleSelf->AddVehicleUpgrade( 1010 );
}
// reset overrideLights, pstate not needed, will be reactivated on demand
if ( set.enable_car_lights_at_day_time )
pVehicleSelf->SetOverrideLights( 0 );
}
// hud bar, this should probably become a cheat_state
pstate_d3dtext_hud = set.d3dtext_hud;
set.d3dtext_hud = 0;
// m0d's map
pstate_map = cheat_state->_generic.map;
cheat_state->_generic.map = 0;
// m0d's menu
pstate_generic_menu = cheat_state->_generic.menu;
cheat_state->_generic.menu = 0;
// remove "Extra actor invincibility" patch
pstate_actor_hp_nSP = patch_actor_hp_extraInv.installed;
patcher_remove( &patch_actor_hp_extraInv );
pstate_actor_hp_SP = patch_actor_hp.installed;
patcher_remove( &patch_actor_hp );
// remove vehicle hp patch
pstate_vehicle_hp = patch_vehicle_hp.installed;
patcher_remove( &patch_vehicle_hp );
// just call with null vehicle info to disable
cheat_handle_vehicle_fly( NULL, 0.0f );
for ( i = 0; i < INI_PATCHES_MAX; i++ )
{
// added to not remove volatile patches
if ( !set.patch[i].has_volatile )
{
pstate_ini[i] = set.patch[i].installed;
patcher_remove( &set.patch[i] );
}
}
//.........这里部分代码省略.........
示例4: SendMapInformation
//.........这里部分代码省略.........
CObjectListType::const_iterator iterObjects = m_pObjectManager->IterBegin ();
for ( ; iterObjects != m_pObjectManager->IterEnd (); iterObjects++ )
{
EntityPacket.Add ( *iterObjects );
}
marker.Set ( "Objects" );
// Add the pickups to the packet
list < CPickup* > ::const_iterator iterPickups = m_pPickupManager->IterBegin ();
for ( ; iterPickups != m_pPickupManager->IterEnd (); iterPickups++ )
{
EntityPacket.Add ( *iterPickups );
}
marker.Set ( "Pickups" );
// Add the vehicles to the packet
list < CVehicle* > ::const_iterator iterVehicles = m_pVehicleManager->IterBegin ();
for ( ; iterVehicles != m_pVehicleManager->IterEnd (); iterVehicles++ )
{
EntityPacket.Add ( *iterVehicles );
}
marker.Set ( "Vehicles" );
// Add the teams to the packet
list < CTeam* > ::const_iterator iterTeams = m_pTeamManager->IterBegin ();
for ( ; iterTeams != m_pTeamManager->IterEnd (); iterTeams++ )
{
EntityPacket.Add ( *iterTeams );
}
marker.Set ( "Teams" );
// Add the peds to the packet
list < CPed* > ::const_iterator iterPeds = m_pPedManager->IterBegin ();
for ( ; iterPeds != m_pPedManager->IterEnd (); iterPeds++ )
{
EntityPacket.Add ( *iterPeds );
}
marker.Set ( "Peds" );
// Add the colshapes to the packet
vector < CColShape* > ::const_iterator iterColShapes = m_pColManager->IterBegin ();
for ( ; iterColShapes != m_pColManager->IterEnd (); iterColShapes++ )
{
CColShape * pColShape = *iterColShapes;
if ( !pColShape->IsPartnered () )
{
EntityPacket.Add ( *iterColShapes );
}
}
marker.Set ( "ColShapes" );
// Add the water polys to the packet
CWaterManager* pWaterManager = g_pGame->GetWaterManager ();
list < CWater* > ::const_iterator iterWater = pWaterManager->IterBegin ();
for ( ; iterWater != pWaterManager->IterEnd (); iterWater++ )
{
CWater* pWater = *iterWater;
EntityPacket.Add ( pWater );
}
marker.Set ( "Water" );
// Send it
Player.Send ( EntityPacket );
marker.Set ( "SendEntityPacket" );
// Send per-player entities
SendPerPlayerEntities ( Player );
marker.Set ( "SendPerPlayerEntities" );
// Send the trailer attachments
CVehicle* pVehicle;
CVehicle* pTowedVehicle;
iterVehicles = m_pVehicleManager->IterBegin ();
for ( ; iterVehicles != m_pVehicleManager->IterEnd (); iterVehicles++ )
{
pVehicle = *iterVehicles;
pTowedVehicle = pVehicle->GetTowedVehicle ( );
if ( pTowedVehicle )
{
CVehicleTrailerPacket AttachPacket ( pVehicle, pTowedVehicle, true );
Player.Send ( AttachPacket );
}
}
marker.Set ( "SendAttachPackets" );
// Add debug info if wanted
if ( CPerfStatDebugInfo::GetSingleton ()->IsActive ( "SendMapInformation" ) )
CPerfStatDebugInfo::GetSingleton ()->AddLine ( "SendMapInformation", marker.GetString () );
}