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


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

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


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

示例1: ForceAddUpgrade

void CVehicleUpgrades::ForceAddUpgrade ( unsigned short usUpgrade )
{
    unsigned char ucSlot;
    if ( GetSlotFromUpgrade ( usUpgrade, ucSlot ) )
    {
        CVehicle* pVehicle = m_pVehicle->GetGameVehicle ();
        if ( pVehicle )
        {
            // Grab the upgrade model
            CModelInfo* pModelInfo = g_pGame->GetModelInfo ( usUpgrade );
            if ( pModelInfo )
            {
                if ( !g_pGame->IsASyncLoadingEnabled () || !pModelInfo->IsLoaded () )
                {
                    // Request and load now
                    pModelInfo->RequestVehicleUpgrade ();

                    g_pGame->GetStreaming()->LoadAllRequestedModels ();
                }
                // Add the upgrade
                pVehicle->AddVehicleUpgrade ( usUpgrade );
            }
        }

        // Add it to the slot
        m_SlotStates [ ucSlot ] = usUpgrade;
    }
}
开发者ID:EagleShen,项目名称:MTA,代码行数:28,代码来源:CVehicleUpgrades.cpp

示例2: cheat_panic


//.........这里部分代码省略.........
			// 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] );
				}
			}

			// turn off kill & chat
			if ( g_DeathList != NULL )
			{
				pstate_deathlist = g_DeathList->iEnabled;
				g_DeathList->iEnabled = 1;
			}
			if ( g_Chat != NULL )
			{
				pstate_chat = g_Chat->iChatWindowMode;
				g_Chat->iChatWindowMode = 2;
			}
		}
		else
		{
			// restore infinite NOS
			if ( pstate_infnos )
			{
				cheat_state->vehicle.infNOS_toggle_on = true;
				patcher_install( &patch_vehicle_inf_NOS );
			}

			// vehicle stuff
			CPed	*pPedSelf = pPools->GetPedFromRef( CPOOLS_PED_SELF_REF );
			if ( pPedSelf->GetVehicle() )
			{
				CVehicle	*pVehicleSelf = pPedSelf->GetVehicle();
				// restore inf NOS
				if ( pstate_infnos )
				{
					pVehicleSelf->AddVehicleUpgrade( 1010 );
				}
			}


			// restore "Extra actor invincibility" patch
			if ( pstate_actor_hp_nSP )
				patcher_install( &patch_actor_hp_extraInv );
			if ( pstate_actor_hp_SP )
				patcher_install( &patch_actor_hp );

			// restore vehicle hp patch
			if ( pstate_vehicle_hp )
				patcher_install( &patch_vehicle_hp );

			// restore some cheat_states
			set.d3dtext_hud = pstate_d3dtext_hud;
			cheat_state->_generic.map = pstate_map;
			cheat_state->_generic.menu = pstate_generic_menu;

			// restore patches
			for ( i = 0; i < INI_PATCHES_MAX; i++ )
			{
				if ( pstate_ini[i] )
					patcher_install( &set.patch[i] );
			}

			// restore kill & chat
			if ( g_DeathList != NULL )
			{
				g_DeathList->iEnabled = pstate_deathlist;
			}
			if ( g_Chat != NULL )
			{
				g_Chat->iChatWindowMode = pstate_chat;
			}

			// clear cheat state text
			cheat_state_text( NULL );
		}
	}

	return cheat_state->_generic.cheat_panic_enabled;
}
开发者ID:iBelow,项目名称:modsa_sobeit,代码行数:101,代码来源:cheat_generic.cpp


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