本文整理汇总了C++中Num函数的典型用法代码示例。如果您正苦于以下问题:C++ Num函数的具体用法?C++ Num怎么用?C++ Num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Num函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: UE_LOG
EBTNodeResult::Type UChooseNextWaypoint::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
// Get the patrol route
auto ControlledPawn = OwnerComp.GetAIOwner()->GetPawn();
auto PatrolRoute = ControlledPawn->FindComponentByClass<UPatrolRoute>();
if (!ensure(PatrolRoute)) { return EBTNodeResult::Failed; }
// Warn about empty patrol routes
auto PatrolPoints = PatrolRoute->GetPatrolPoints();
if (PatrolPoints.Num() == 0)
{
UE_LOG(LogTemp, Warning, TEXT("A guard is missing patrol points."));
return EBTNodeResult::Failed;
}
// Set the next waypoint
auto BlackboardComp = OwnerComp.GetBlackboardComponent();
auto Index = BlackboardComp->GetValueAsInt(IndexKey.SelectedKeyName);
BlackboardComp->SetValueAsObject(WaypointKey.SelectedKeyName, PatrolPoints[Index]);
// Cycle the index
auto NextIndex = (Index + 1) % PatrolPoints.Num();
BlackboardComp->SetValueAsInt(IndexKey.SelectedKeyName, NextIndex);
// UE_LOG(LogTemp, Warning, TEXT("Waypoint index: %i"), Index);
return EBTNodeResult::Succeeded;
}
开发者ID:spire8989,项目名称:TestingGrounds,代码行数:28,代码来源:ChooseNextWaypoint.cpp
示例2: Sys_NetAdrToString
/*
================
idServerScan::InfoResponse
================
*/
int idServerScan::InfoResponse( networkServer_t &server ) {
if ( scan_state == IDLE ) {
return false;
}
idStr serv = Sys_NetAdrToString( server.adr );
if ( server.challenge != challenge ) {
common->DPrintf( "idServerScan::InfoResponse - ignoring response from %s, wrong challenge %d.", serv.c_str(), server.challenge );
return false;
}
if ( scan_state == NET_SCAN ) {
const idKeyValue *info = net_info.FindKey( serv.c_str() );
if ( !info ) {
common->DPrintf( "idServerScan::InfoResponse NET_SCAN: reply from unknown %s\n", serv.c_str() );
return false;
}
int id = atoi( info->GetValue() );
net_info.Delete( serv.c_str() );
inServer_t iserv = net_servers[ id ];
server.ping = Sys_Milliseconds() - iserv.time;
server.id = iserv.id;
} else {
server.ping = Sys_Milliseconds() - lan_pingtime;
server.id = 0;
// check for duplicate servers
for ( int i = 0; i < Num() ; i++ ) {
if ( memcmp( &(*this)[ i ].adr, &server.adr, sizeof(netadr_t) ) == 0 ) {
common->DPrintf( "idServerScan::InfoResponse LAN_SCAN: duplicate server %s\n", serv.c_str() );
return true;
}
}
}
const char *si_map = server.serverInfo.GetString( "si_map" );
const idDecl *mapDecl = declManager->FindType( DECL_MAPDEF, si_map, false );
const idDeclEntityDef *mapDef = static_cast< const idDeclEntityDef * >( mapDecl );
if ( mapDef ) {
const char *mapName = common->GetLanguageDict()->GetString( mapDef->dict.GetString( "name", si_map ) );
server.serverInfo.Set( "si_mapName", mapName );
} else {
server.serverInfo.Set( "si_mapName", si_map );
}
int index = Append( server );
// for now, don't maintain sorting when adding new info response servers
m_sortedServers.Append( Num()-1 );
if ( listGUI->IsConfigured( ) && !IsFiltered( server ) ) {
GUIAdd( Num()-1, server );
}
if ( listGUI->GetSelection( NULL, 0 ) == ( Num()-1 ) ) {
GUIUpdateSelected();
}
return index;
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:63,代码来源:ServerScan.cpp
示例3: GetEditingObjects
FText FSimpleAssetEditor::GetToolkitName() const
{
const auto EditingObjects = GetEditingObjects();
check( EditingObjects.Num() > 0 );
FFormatNamedArguments Args;
Args.Add( TEXT("ToolkitName"), GetBaseToolkitName() );
if( EditingObjects.Num() == 1 )
{
const UObject* EditingObject = EditingObjects[ 0 ];
const bool bDirtyState = EditingObject->GetOutermost()->IsDirty();
Args.Add( TEXT("ObjectName"), FText::FromString( EditingObject->GetName() ) );
Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
return FText::Format( LOCTEXT("ToolkitTitle", "{ObjectName}{DirtyState} - {ToolkitName}"), Args );
}
else
{
bool bDirtyState = false;
UClass* SharedBaseClass = NULL;
for( int32 x = 0; x < EditingObjects.Num(); ++x )
{
UObject* Obj = EditingObjects[ x ];
check( Obj );
UClass* ObjClass = Cast<UClass>(Obj);
if (ObjClass == NULL)
{
ObjClass = Obj->GetClass();
}
check( ObjClass );
// Initialize with the class of the first object we encounter.
if( SharedBaseClass == NULL )
{
SharedBaseClass = ObjClass;
}
// If we've encountered an object that's not a subclass of the current best baseclass,
// climb up a step in the class hierarchy.
while( !ObjClass->IsChildOf( SharedBaseClass ) )
{
SharedBaseClass = SharedBaseClass->GetSuperClass();
}
// If any of the objects are dirty, flag the label
bDirtyState |= Obj->GetOutermost()->IsDirty();
}
Args.Add( TEXT("NumberOfObjects"), EditingObjects.Num() );
Args.Add( TEXT("ClassName"), FText::FromString( SharedBaseClass->GetName() ) );
Args.Add( TEXT("DirtyState"), bDirtyState ? FText::FromString( TEXT( "*" ) ) : FText::GetEmpty() );
return FText::Format( LOCTEXT("ToolkitTitle_EditingMultiple", "{NumberOfObjects} {ClassName}{DirtyState} - {ToolkitName}"), Args );
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:58,代码来源:SimpleAssetEditor.cpp
示例4: forn
forn(i, N){
int j = (N - i) & (N - 1);
Num a1 = (ta[i] + conj(ta[j])) * Num(0.5, 0);
Num a2 = (ta[i] - conj(ta[j])) * Num(0, -0.5);
Num b1 = (tb[i] + conj(tb[j])) * Num(0.5 / N, 0);
Num b2 = (tb[i] - conj(tb[j])) * Num(0, -0.5 / N);
tf[j] = a1 * b1 + a2 * b2 * Num(0, 1);
tg[j] = a1 * b2 + a2 * b1;
}
开发者ID:Nikitosh,项目名称:SPbAU-Generation-Z-Team-Reference,代码行数:9,代码来源:FFT_mod_ll_ns.cpp
示例5: GetPreviewActor
void FSCSEditorViewportClient::DrawCanvas( FViewport& InViewport, FSceneView& View, FCanvas& Canvas )
{
AActor* PreviewActor = GetPreviewActor();
if(PreviewActor)
{
TGuardValue<bool> AutoRestore(GAllowActorScriptExecutionInEditor, true);
const int32 HalfX = 0.5f * Viewport->GetSizeXY().X;
const int32 HalfY = 0.5f * Viewport->GetSizeXY().Y;
auto SelectedNodes = BlueprintEditorPtr.Pin()->GetSelectedSCSEditorTreeNodes();
if(bIsManipulating && SelectedNodes.Num() > 0)
{
USceneComponent* SceneComp = Cast<USceneComponent>(SelectedNodes[0]->FindComponentInstanceInActor(PreviewActor, true));
if(SceneComp)
{
const FVector WidgetLocation = GetWidgetLocation();
const FPlane Proj = View.Project(WidgetLocation);
if(Proj.W > 0.0f)
{
const int32 XPos = HalfX + (HalfX * Proj.X);
const int32 YPos = HalfY + (HalfY * (Proj.Y * -1));
DrawAngles(&Canvas, XPos, YPos, GetCurrentWidgetAxis(), GetWidgetMode(), GetWidgetCoordSystem().Rotator(), WidgetLocation);
}
}
}
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:28,代码来源:SCSEditorViewportClient.cpp
示例6: Add
void FActionQueue::Add(ECharMoveState Action)
{
GLog->Log("Adding: " + FString::FromInt((int32)Action));
if (MoveList.Num() == 3)
{
auto Last = MoveList.Last();
MoveList.Remove(Last);
}
// This is no longer reverse.
auto Reverse = TArray<ECharMoveState>();
for (int32 i = 0; i < MoveList.Num(); ++i)
{
Reverse.Add(MoveList[i]);
}
MoveList.Empty();
MoveList.Add(Action);
for (int32 i = 0; i < Reverse.Num(); ++i)
{
GLog->Log(FString::FromInt((int32)Reverse[i]));
MoveList.Add(Reverse[i]);
}
}
开发者ID:krazzei,项目名称:ggj16_slamjam,代码行数:28,代码来源:ActionQueue.cpp
示例7: main
int main()
{
Num ft = Num(42);
Base<Num>* bp= new Base<Num>(ft);
std::cout << bp->get().x << std::endl;
return 0;
}
开发者ID:UCSD-PL,项目名称:ivt,代码行数:7,代码来源:main.cpp
示例8: Set
void idMultiWinVar::Set( const char* val )
{
for( int i = 0; i < Num(); i++ )
{
( *this )[i]->Set( val );
}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:7,代码来源:Winvar.cpp
示例9: GUIUpdateSelected
/*
================
idServerScan::GUIUpdateSelected
================
*/
void idServerScan::GUIUpdateSelected( void )
{
char screenshot[MAX_STRING_CHARS];
if( !m_pGUI )
{
return;
}
int i = listGUI->GetSelection( NULL, 0 );
if( i == -1 || i >= Num() )
{
m_pGUI->SetStateString( "server_name", "" );
m_pGUI->SetStateString( "player1", "" );
m_pGUI->SetStateString( "player2", "" );
m_pGUI->SetStateString( "player3", "" );
m_pGUI->SetStateString( "player4", "" );
m_pGUI->SetStateString( "player5", "" );
m_pGUI->SetStateString( "player6", "" );
m_pGUI->SetStateString( "player7", "" );
m_pGUI->SetStateString( "player8", "" );
m_pGUI->SetStateString( "server_map", "" );
m_pGUI->SetStateString( "browser_levelshot", "" );
m_pGUI->SetStateString( "server_gameType", "" );
m_pGUI->SetStateString( "server_IP", "" );
m_pGUI->SetStateString( "server_passworded", "" );
}
else
{
m_pGUI->SetStateString( "server_name", ( *this ) [i].serverInfo.GetString( "si_name" ) );
for( int j = 0; j < 8; j++ )
{
if( ( *this ) [i].clients > j )
{
m_pGUI->SetStateString( va( "player%i", j + 1 ) , ( *this ) [i].nickname[j] );
}
else
{
m_pGUI->SetStateString( va( "player%i", j + 1 ) , "" );
}
}
m_pGUI->SetStateString( "server_map", ( *this ) [i].serverInfo.GetString( "si_mapName" ) );
fileSystem->FindMapScreenshot( ( *this ) [i].serverInfo.GetString( "si_map" ), screenshot, MAX_STRING_CHARS );
m_pGUI->SetStateString( "browser_levelshot", screenshot );
m_pGUI->SetStateString( "server_gameType", ( *this ) [i].serverInfo.GetString( "si_gameType" ) );
m_pGUI->SetStateString( "server_IP", Sys_NetAdrToString( ( *this ) [i].adr ) );
if( ( *this ) [i].serverInfo.GetBool( "si_usePass" ) )
{
m_pGUI->SetStateString( "server_passworded", "PASSWORD REQUIRED" );
}
else
{
m_pGUI->SetStateString( "server_passworded", "" );
}
}
}
开发者ID:revelator,项目名称:MHDoom,代码行数:65,代码来源:ServerScan.cpp
示例10: SetGuiInfo
void idMultiWinVar::SetGuiInfo( idDict* dict )
{
for( int i = 0; i < Num(); i++ )
{
( *this )[i]->SetGuiInfo( dict, ( *this )[i]->c_str() );
}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:7,代码来源:Winvar.cpp
示例11: Get
bool CTuningParams::Get(int Index, float *pValue)
{
if(Index < 0 || Index >= Num())
return false;
*pValue = (float)((CTuneParam *)this)[Index];
return true;
}
开发者ID:CytraL,项目名称:MineTee,代码行数:7,代码来源:gamecore.cpp
示例12: Set
bool CTuningParams::Set(int Index, float Value)
{
if(Index < 0 || Index >= Num())
return false;
((CTuneParam *)this)[Index] = Value;
return true;
}
开发者ID:CytraL,项目名称:MineTee,代码行数:7,代码来源:gamecore.cpp
示例13: GetWorld
void ACVehicleSpawner::OnTimer() {
FTimerHandle Handle;
if (!Active || Paused) {
GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, GetTimeWait(), false);
return;
}
if (Bucket.Num() == 0) {
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("You need to add Vehicle Types to the Vehicle Spawner"));
}
FVector StartTrace = GetActorLocation() - GetActorForwardVector() * 400 + FVector(0, 0, 100);
FVector EndTrace = GetActorLocation() + GetActorForwardVector() * 400 + FVector(0, 0, 100);
if (GetWorld()->LineTraceTest(
StartTrace,
EndTrace,
ECollisionChannel::ECC_Vehicle,
FCollisionQueryParams(),
FCollisionResponseParams()
)) {
GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, 0.1f, false);
return;
}
FActorSpawnParameters spawnParameters;
spawnParameters.bNoCollisionFail = true;
spawnParameters.Owner = this;
spawnParameters.Instigator = NULL;
spawnParameters.bDeferConstruction = false;
int32 BucketIndex = FMath::RandRange(0, Bucket.Num() - 1);
EVehicleType VehicleType = Bucket[BucketIndex];
Bucket.RemoveAtSwap(BucketIndex);
if (Bucket.Num() == 0) {
TurnBucket();
}
TSubclassOf<class AFlockingVehicle> Type = VehicleTypeClass[(uint8)VehicleType];
AFlockingVehicle* NewVehicle = GetWorld()->SpawnActor<AFlockingVehicle>(Type, GetActorLocation(), GetActorRotation(), spawnParameters);
NewVehicle->SetFlockingState(FlockingState);
NewVehicle->SpawnDefaultController();
NewVehicle->GetMesh()->SetAllPhysicsLinearVelocity(GetActorForwardVector() * StartSpeed / 0.036);
if (NewVehicle->VehicleType != VehicleType) {
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("Vehicle Type is not correct."));
}
GetWorld()->GetTimerManager().SetTimer(Handle, this, &ACVehicleSpawner::OnTimer, GetTimeWait(), false);
if (VehicleTypeMaterials.Contains((uint8)VehicleType)) {
auto Materials = VehicleTypeMaterials[(uint8)VehicleType];
int32 Index = FMath::RandRange(0, Materials.Num() - 1);
UMaterial* Material = Materials[Index];
NewVehicle->GetMesh()->SetMaterial(2, Material);
NewVehicle->ColorMaterialIndex = Index;
}
}
开发者ID:HighwayFlocking,项目名称:HighwayFlocking,代码行数:60,代码来源:CVehicleSpawner.cpp
示例14: main
int main()
{
int ret = Num(5, 1);
printf("%d\n", ret);
return 0;
}
开发者ID:Fireplusplus,项目名称:Code_C,代码行数:7,代码来源:AddAndOr.c
示例15: Num
void MyZKbMain::Probabilidad(int valor)
{
int valx1=valor; int valx2=valor+1; int valx3=valor+3; int valx4=valor+4;
ZConfig Num(QString("numeros.cfg"), true);
int val1= Num.readNumEntry(QString("NUMEROS"), QString("%1").arg(valx1), 0);
int val2= Num.readNumEntry(QString("NUMEROS"), QString("%1").arg(valx2), 0);
int val3= Num.readNumEntry(QString("NUMEROS"), QString("%1").arg(valx3), 0);
int val4= Num.readNumEntry(QString("NUMEROS"), QString("%1").arg(valx4), 0);
QPixmap pm; pm.load("ruleta_usr.png");
QString agregar="SI";
if (( val1 == 0 ) && ( val2 > 0 ) && (val3 > 0) && (val4 > 0))
{ for ( int j=0 ; j < lista.count(); ++j ) { if ( QString("%1").arg(valx1) == QString("%1").arg(lista[j]) ) { agregar="NO"; } }
if ( agregar == "SI" ) { system(QString("echo \"Probable: %1\"").arg(valx1)); lista += QString("%1").arg(valx1); }
} else { }
if (( val1 > 0 ) && ( val2 == 0 ) && (val3 > 0) && (val4 > 0))
{ for ( int j=0 ; j < lista.count(); ++j ) { if ( QString("%1").arg(valx2) == QString("%1").arg(lista[j]) ) { agregar="NO"; } }
if ( agregar == "SI" ) { system(QString("echo \"Probable: %1\"").arg(valx2)); lista += QString("%1").arg(valx2); }
} else { }
if (( val1 > 0 ) && ( val2 > 0 ) && (val3 == 0) && (val4 > 0))
{ for ( int j=0 ; j < lista.count(); ++j ) { if ( QString("%1").arg(valx3) == QString("%1").arg(lista[j]) ) { agregar="NO"; } }
if ( agregar == "SI" ) { system(QString("echo \"Probable: %1\"").arg(valx3)); lista += QString("%1").arg(valx3); }
} else { }
if (( val1 > 0 ) && ( val2 > 0 ) && (val3 > 0) && (val4 == 0))
{ for ( int j=0 ; j < lista.count(); ++j ) { if ( QString("%1").arg(valx4) == QString("%1").arg(lista[j]) ) { agregar="NO"; } }
if ( agregar == "SI" ) { system(QString("echo \"Probable: %1\"").arg(valx4)); lista += QString("%1").arg(valx4); }
} else { }
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:34,代码来源:MyZKbMain.cpp
示例16: Update
void idMultiWinVar::Update()
{
for( int i = 0; i < Num(); i++ )
{
( *this )[i]->Update();
}
}
开发者ID:BielBdeLuna,项目名称:RBDoom3BFG-mirrored,代码行数:7,代码来源:Winvar.cpp
示例17:
inline bool
Message::operator<(const Message& rhv) const
{
if(Num() < rhv.Num())
return true;
return false;
}
开发者ID:hoxnox,项目名称:csio,代码行数:7,代码来源:Messages.hpp
示例18: UpdateTrack
void UInterpTrackAkAudioEvent::UpdateTrack(float NewPosition, UInterpTrackInst* TrInst, bool bJump)
{
if (Events.Num() <= 0)
{
//UE_LOG(LogMatinee, Warning,TEXT("No sounds for sound track %s"),*GetName());
return;
}
UInterpTrackInstAkAudioEvent* EventInst = CastChecked<UInterpTrackInstAkAudioEvent>(TrInst);
// Only play AkEvents if we are playing Matinee forwards, and
if(NewPosition > EventInst->LastUpdatePosition && !bJump)
{
// Find which sound we are starting in. -1 Means before first sound.
int32 StartEventIdx = -1;
for( StartEventIdx = -1; StartEventIdx<Events.Num()-1 && Events[StartEventIdx+1].Time < EventInst->LastUpdatePosition; StartEventIdx++);
// Find which sound we are ending in. -1 Means before first sound.
int32 EndEventIdx = -1;
for( EndEventIdx = -1; EndEventIdx<Events.Num()-1 && Events[EndEventIdx+1].Time < NewPosition; EndEventIdx++);
// If we have moved into a new sound, we should start playing it now.
if(StartEventIdx != EndEventIdx)
{
FAkAudioEventTrackKey & AkEvenTrackKey = GetAkEventTrackKeyAtPosition(NewPosition);
UAkAudioEvent* AkEvent = AkEvenTrackKey.AkAudioEvent;
AActor* Actor = TrInst->GetGroupActor();
FAkAudioDevice * AudioDevice = FAkAudioDevice::Get();
if (AudioDevice)
{
if (AkEvent)
{
AudioDevice->PostEvent(AkEvent, Actor);
}
else
{
AudioDevice->PostEvent(AkEvenTrackKey.EventName, Actor);
}
}
}
}
// Finally update the current position as the last one.
EventInst->LastUpdatePosition = NewPosition;
}
开发者ID:audiokinetic,项目名称:WwiseUE4Plugin,代码行数:46,代码来源:InterpTrackAkAudioEvent.cpp
示例19: Num
/**--------------------------------------------------------------------------<BR>
CRandomNumber::GetInt
\brief Gets an integer based on the settings. Sets up temporary new boundaries so that an interval
of e.g. 0.8 to 3.7 will become 1.0 to 3.0 allowing integers 1 and 2 only.
<P>---------------------------------------------------------------------------*/
int CRandomNumber::GetInt(void) const
{
CRandomNumber Num(ceil(m_dMin), floor(m_dMax) + 1.0);
double dRes = Num.Get();
if (dRes == (int)Num.GetMax())
return (int) (dRes - 1);
else
return (int) dRes;
}
开发者ID:Ic3C0ld,项目名称:QtGeometry7316,代码行数:14,代码来源:RandomNumber.cpp
示例20: GetEditingObjects
UBlueprint* FGameplayAbilitiesEditor::GetBlueprintObj() const
{
auto EditingObjects = GetEditingObjects();
for (int32 i = 0; i < EditingObjects.Num(); ++i)
{
if (EditingObjects[i]->IsA<UGameplayAbilityBlueprint>()) { return (UBlueprint*)EditingObjects[i]; }
}
return NULL;
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:9,代码来源:GameplayAbilitiesEditor.cpp
注:本文中的Num函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论