本文整理汇总了C++中Event::AddInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::AddInteger方法的具体用法?C++ Event::AddInteger怎么用?C++ Event::AddInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::AddInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Event
//
// Name: ItemPickup()
// Class: Armor
//
// Description: Handles Sentients Picking up armor... In this case, however,
// Only Actors are allowed to actually pick up armor
//
// Parameters: Entity *other - The entity doing the picking up
// qboolean add_to_inventory - Here to make parameters match
//
// Returns: NULL -- This function doesn't actually return the armor, instead
// it has the entity picking it up process and armor event
//
Item *Armor::ItemPickup( Entity *other, qboolean add_to_inventory, qboolean )
{
Sentient *sent;
str realname;
Q_UNUSED(add_to_inventory);
// For right now, we only want players to pick up armor
if ( !other->isSubclassOf( Player ) )
return NULL;
if ( !Pickupable( other ) )
return NULL;
sent = (Sentient*)other;
// Check if we NEED to pick up the armor, if the armor we are about to pick up is
// less than the armor we have, we don't want to pick it up
if ( !_needThisArmor(sent) )
return NULL;
// Handle the actual "Picking Up"
_pickupArmor(sent);
// Give the Sentient the Armor
Event *armorEvent;
armorEvent = new Event(EV_Sentient_GiveArmor);
armorEvent->AddString( item_name.c_str() );
armorEvent->AddFloat( amount );
armorEvent->AddInteger( true );
sent->ProcessEvent(armorEvent);
return NULL; // This doesn't create any items
}
示例2: SetBehaviorPackage
//--------------------------------------------------------------
// Name: SetBehaviorPackage()
// Class: DefaultStrategos
//
// Description: Sets the actor's statemap to the specified behavior package
//
// Parameters: const str &packageName
//
// Returns: None
//--------------------------------------------------------------
void DefaultStrategos::SetBehaviorPackage( const str &packageName )
{
int index;
BehaviorPackageType_t* package;
index = act->packageManager->GetPackageIndex( packageName );
if ( index == -1 )
{
assert ( index != -1 );
gi.WDPrintf( "Actor %s, Does not have package %s registered\n" , act->targetname.c_str() , packageName.c_str() );
}
package = PackageList.ObjectAt( index );
// If we have a package AND our current statemap name is NOT the same as our selected package name
if ( package && stricmp( act->statemap_name.c_str(), package->stateFile.c_str() ) )
{
Event *event;
event = new Event( EV_Actor_Statemap );
event->AddString( package->stateFile.c_str() ); //FileName
event->AddString( "START" ); //IdleState
event->AddInteger( 0 ); //Loading( false )
event->AddInteger( 1 ); //packageChanged ( true )
act->ProcessEvent( event );
act->packageManager->UpdateCurrentPackageIndex( index );
act->statemap_name = package->stateFile;
}
}
示例3: _EvaluatePackages
//
// Name: _EvaluatePackages
// Parameters: None
// Description: Determines which behavior package to execute
//
void DefaultStrategos::_EvaluatePackages()
{
if ( !act->fuzzyEngine || !act->fuzzyEngine_active )
return;
if ( PackageList.NumObjects() < 1 )
return;
act->packageManager->EvaluatePackages(act->fuzzyEngine );
int newPackageIndex;
newPackageIndex = act->packageManager->GetHighestScoringPackage();
BehaviorPackageType_t* package;
package = PackageList.ObjectAt( newPackageIndex );
// If we have a package AND our current statemap name is NOT the same as our selected package name
if ( package && Q_stricmp( act->statemap_name.c_str(), package->stateFile.c_str() ) )
{
Event *event;
event = new Event( EV_Actor_Statemap );
event->AddString( package->stateFile.c_str() ); //FileName
event->AddString( "START" ); //IdleState
event->AddInteger( 0 ); //Loading( false )
event->AddInteger( 1 ); //packageChanged ( true )
act->ProcessEvent( event );
//act->packageManager->SetLastExecutionTime(newPackageIndex);
act->packageManager->UpdateCurrentPackageIndex( newPackageIndex );
act->statemap_name = package->stateFile;
}
}
示例4: Archive
//--------------------------------------------------------------
// Name: Archive()
// Class: PostureController
//
// Description: Archives the class
//
// Parameters: Archiver &arc
//
// Returns: None
//--------------------------------------------------------------
void PostureController::Archive( Archiver &arc )
{
arc.ArchiveString( &_postureStateMap_Name );
arc.ArchiveString( &_currentPostureState_Name );
arc.ArchiveString( &_requestedPostureState_Name );
arc.ArchiveSafePointer ( &_requestor );
if ( !arc.Saving() )
{
if ( _postureStateMap_Name.length() )
{
Event *event;
event = new Event( EV_Actor_SetPostureStateMap );
event->AddString( _postureStateMap_Name );
event->AddInteger( 1 );
act->ProcessEvent ( event );
_currentPostureState = _postureStateMap->FindState( _currentPostureState_Name.c_str() );
_requestedPostureState = _postureStateMap->FindState(_requestedPostureState_Name.c_str() );
}
}
}
示例5: ExecuteCommand
void ClientServerCommandManager::ExecuteCommand( char *arguments[], int num_arguments )
{
const char *command = arguments[ 0 ];
const char *formatspec;
int k;
char **args = arguments + 1;
Event *ev = new Event( command, EV_NORMAL );
if( ev->eventnum == 0 )
{
delete ev;
return;
}
formatspec = ev->GetFormat();
for( int i = 0, k = 0; k < num_arguments - 1; k++ )
{
const char *argument = args[ i ];
str vec;
if( formatspec[ k ] == '\0' ) {
break;
}
if( argument == NULL || *argument == '\0' ) {
continue;
}
switch( formatspec[ k ] )
{
case 'b':
case 'B':
ev->AddInteger( atoi( argument ) );
i++;
break;
case 's':
case 'S':
ev->AddString( argument );
i++;
break;
case 'i':
case 'I':
ev->AddInteger( atoi( argument ) );
i++;
break;
case 'f':
case 'F':
ev->AddFloat( ( float )atof( argument ) );
i++;
break;
case 'v':
case 'V':
vec = args[ i ];
vec += str( " " ) + args[ i + 1 ];
vec += str( " " ) + args[ i + 2 ];
ev->AddVector( Vector( vec.c_str() ) );
i += 3;
break;
default:
ev->AddString( argument );
i++;
}
}
try
{
ProcessEvent( ev );
}
catch( ScriptException exc )
{
cgi.Printf( exc.string );
}
}