本文整理汇总了C++中SimObject::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ SimObject::getId方法的具体用法?C++ SimObject::getId怎么用?C++ SimObject::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimObject
的用法示例。
在下文中一共展示了SimObject::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: script_simobject_find
S32 script_simobject_find(const char* classname, const char* name)
{
SimObject *object;
if( Sim::findObject( name, object ) )
{
// if we specified a classname do type checking
if (classname && dStrlen(classname))
{
AbstractClassRep* ocr = object->getClassRep();
while (ocr)
{
if (!dStricmp(ocr->getClassName(), classname))
return object->getId();
ocr = ocr->getParentClass();
}
}
// invalid type
return 0;
}
// didn't find object
return 0;
}
示例2: dumpToConsole
void ProcessList::dumpToConsole()
{
for (ProcessObject * pobj = mHead.mProcessLink.next; pobj != &mHead; pobj = pobj->mProcessLink.next)
{
SimObject * obj = dynamic_cast<SimObject*>(pobj);
if (obj)
Con::printf("id %i, order guid %i, type %s", obj->getId(), pobj->mOrderGUID, obj->getClassName());
else
Con::printf("---unknown object type, order guid %i", pobj->mOrderGUID);
}
}
示例3: handleItemNameChange
char* SimTreeView::handleItemNameChange( HTREEITEM hItem, char *name )
{
lockManager();
SimObject *obj = getObject( hItem );
if ( !obj )
return NULL;
obj->assignName( name );
unlockManager();
return ( (char*)avar("%4i,\"%s\", %s",obj->getId(),obj->getName(),obj->getClassName()) );
}
示例4: find
SimObject* SimIdDictionary::find(S32 id)
{
Mutex::lockMutex(mutex);
#ifdef USE_CLASSIC_SIMDICTIONARY
S32 idx = id & TableBitMask;
SimObject *walk = table[idx];
while(walk)
{
if(walk->getId() == U32(id))
{
Mutex::unlockMutex(mutex);
return walk;
}
walk = walk->nextIdObject;
}
Mutex::unlockMutex(mutex);
return NULL;
#else
SimObject* f = root[id];
Mutex::unlockMutex(mutex);
return f;
#endif
}
示例5: return
//.........这里部分代码省略.........
Persistent::Base * obj = reinterpret_cast< Persistent::Base* >
( Persistent::create( argv[2] ) );
SimObject *simObj;
if( obj )
{
simObj = dynamic_cast<SimObject *>( obj );
if(simObj)
{
if(!serverManager->addObject( simObj ))
{
console->printf("MissionCreateObject: failed on addObject");
break;
}
serverManager->assignName( simObj, strname );
if( !simObj->processArguments( argc - 3, argv + 3 ) )
{
simObj->deleteObject();
console->printf("MissionCreateObject: failed argument list");
}
else
{
// add to the mission editor
if( !me->addObject( simObj ) )
simObj->deleteObject();
// grab the centroid for 'DropToSelectedObj'
me->mSelection.calcCentroid();
// make this the only selection
console->evaluatef( "MissionObjectList::ClearSelection();" );
console->evaluatef( "MissionObjectList::SelectObject( %d, %d );",
me->getWorldId( simObj ), simObj->getId() );
// move the item where we want it...
me->onDrop( simObj, me->mDropType );
// re-select to get inspect...
console->evaluatef( "MissionObjectList::Inspect( %d, %d );",
me->getWorldId( simObj ), simObj->getId() );
// check if should drop to ground
if( me->mFlags.test( FearMissionEditor::DropToGround ) )
me->dropObjectDown( simObj );
serverManager->unlock();
return(avar("%d", simObj->getId()));
}
}
}
else
console->printf(avar("MissionCreateObject: Unable to instantiate object of class type: %s",argv[2]));
}
else
console->printf("MissionCreateObject: Must call MissionCreate first");
}
else
console->printf("MissionCreateObject objtypename className arglist");
serverManager->unlock();
return("0");
}
case onSelected:
{
示例6: renameField
void GuiInspectorDynamicField::renameField( const char* newFieldName )
{
newFieldName = StringTable->insert( newFieldName );
if ( mDynField == NULL || mParent == NULL || mEdit == NULL )
{
Con::warnf("GuiInspectorDynamicField::renameField - No target object or dynamic field data found!" );
return;
}
if ( !newFieldName )
{
Con::warnf("GuiInspectorDynamicField::renameField - Invalid field name specified!" );
return;
}
// Only proceed if the name has changed
if ( dStricmp( newFieldName, getFieldName() ) == 0 )
return;
// Grab a pointer to our parent and cast it to GuiInspectorDynamicGroup
GuiInspectorDynamicGroup *group = dynamic_cast<GuiInspectorDynamicGroup*>(mParent);
if ( group == NULL )
{
Con::warnf("GuiInspectorDynamicField::renameField - Unable to locate GuiInspectorDynamicGroup parent!" );
return;
}
const U32 numTargets = mInspector->getNumInspectObjects();
if( numTargets > 1 )
{ mInspector->onBeginCompoundEdit_callback(); }
const char* oldFieldName = getFieldName();
SimFieldDictionary::Entry* newEntry = NULL;
for( U32 i = 0; i < numTargets; ++ i )
{
SimObject* target = mInspector->getInspectObject( i );
// Make sure the new field is not already defined as a static field
// on the object.
if( target->isField( newFieldName ) )
{
// New field is already defined. If we can, let the scripts handle
// the error. Otherwise, just emit an error on the console and proceed.
if( numTargets == 1 )
{ mInspector->onFieldRenameAlreadyDefined_callback( target->getIdString(), oldFieldName, newFieldName ); }
else
{
Con::errorf( "GuiInspectorDynamicField::renameField - field '%s' is already defined on %i:%s (%s)",
newFieldName, target->getId(), target->getClassName(), target->getName() );
}
// Reset the text entry.
if( mRenameCtrl )
mRenameCtrl->setText( oldFieldName );
continue;
}
char currentValue[1024] = {0};
// Grab our current dynamic field value (we use a temporary buffer as this gets corrupted upon Con::eval)
dSprintf( currentValue, sizeof( currentValue ), "%s", target->getDataField( oldFieldName, NULL ) );
// Unset the old field and set the new field.
target->setDataField( oldFieldName, NULL, "" );
target->setDataField( newFieldName, NULL, currentValue );
// Notify script.
mInspector->onFieldRenamed_callback( target->getIdString(), oldFieldName, newFieldName );
// Look up the new SimFieldDictionary entry.
if( !newEntry )
{
newEntry = target->getFieldDictionary()->findDynamicField( newFieldName );
if( !newEntry )
{
Con::warnf( "GuiInspectorDynamicField::renameField - could not find new field '%s' on object %i:%s (%s)",
newFieldName, target->getId(), target->getClassName(), target->getName() );
}
mDynField = newEntry;
}
}
if( numTargets > 1 )
{ mInspector->onEndCompoundEdit_callback(); }
// Lastly we need to reassign our validate field for our value edit control
char szBuffer[1024];
dSprintf( szBuffer, sizeof( szBuffer ), "%d.apply(%d.getText());", getId(), mEdit->getId() );
mEdit->setField("validate", szBuffer );
if( mDeleteButton )
//.........这里部分代码省略.........