本文整理汇总了C++中Directory::GetDataInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::GetDataInt方法的具体用法?C++ Directory::GetDataInt怎么用?C++ Directory::GetDataInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::GetDataInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDataDArray
void Directory::GetDataDArray ( const char *dataName, DArray<int> *darray ) const
{
AppAssert( dataName );
AppAssert( darray );
//
// First try to find a directory representing this DArray
Directory *dir = GetDirectory( dataName );
if ( !dir )
{
AppReleaseAssert(false, "Failed to find DArray named %s", dataName );
return;
}
//
// Get info about the DArray
char *tID = dir->GetDataString("tID");
int size = dir->GetDataInt("Size");
if ( strcmp(tID, "DArray<int>") != 0 || size == DIRECTORY_SAFEINT)
{
AppDebugOut("Found object %s but it doesn't appear to be a DArray\n" );
}
//
// Iterate through it, loading data
darray->SetSize( size );
for ( int i = 0; i < size; ++i )
{
char indexName[16];
sprintf ( indexName, "[i %d]", i );
Directory *thisIndex = dir->GetDirectory( indexName );
if ( !thisIndex )
{
AppDebugOut("Error loading DArray %s : index %d is missing\n", dataName, i );
}
else
{
bool used = thisIndex->GetDataBool("[Used]");
if ( !used )
{
if ( darray->ValidIndex(i) )
darray->RemoveData(i);
}
else
{
int theData = thisIndex->GetDataInt("[Data]");
darray->PutData( theData, i );
}
}
}
}
示例2: GetDataLList
void Directory::GetDataLList ( const char *dataName, LList<Directory *> *llist ) const
{
AppAssert( dataName );
AppAssert( llist );
//
// First try to find a directory representing this LList
Directory *dir = GetDirectory( dataName );
if ( !dir )
{
AppDebugOut("Failed to find LList named %s\n", dataName);
return;
}
//
// Get info about the LList
char *tID = dir->GetDataString("tID");
int size = dir->GetDataInt("Size");
if ( strcmp(tID, "LList<Directory *>") != 0 || size == DIRECTORY_SAFEINT)
{
AppDebugOut("Found object %s but it doesn't appear to be a LList\n");
}
//
// Iterate through it, loading data
for ( int i = 0; i < size; ++i )
{
char indexName[16];
sprintf ( indexName, "[i %d]", i );
Directory *thisIndex = dir->GetDirectory( indexName );
if ( !thisIndex )
{
AppDebugOut("Error loading LList %s : index %d is missing\n", dataName, i);
}
else
{
if( thisIndex->m_subDirectories.ValidIndex(0) )
{
Directory *theDir = thisIndex->m_subDirectories[0];
llist->PutData( theDir );
}
else
{
AppDebugOut("Error loading LList %s : could not find directory in index %d\n", dataName, i);
}
}
}
}
示例3: DefconMain
//.........这里部分代码省略.........
sprintf( notes, "SYNC ERROR at %s", g_app->GetWorld()->m_theDate.GetTheDate() );
RestartTestBed(-1, notes );
}
if( g_app->m_gameRunning &&
g_app->GetWorld()->m_theDate.m_theDate > 10 )
{
float estimatedLatency = g_app->GetClientToServer()->GetEstimatedLatency();
if( estimatedLatency > 60.0f )
{
RestartTestBed(-1, "Connection lost" );
}
if( g_app->GetServer() &&
g_app->GetServer()->m_clients.NumUsed() < g_app->GetGame()->GetOptionValue("MaxTeams") )
{
RestartTestBed(-1, "Client lost connection" );
}
}
#endif
//
// Read latest update from Server
Directory *letter = g_app->GetClientToServer()->GetNextLetter();
if( letter )
{
if( !strcmp(letter->m_name, NET_DEFCON_MESSAGE) == 0 ||
!letter->HasData(NET_DEFCON_SEQID, DIRECTORY_TYPE_INT) )
{
AppDebugOut( "Client received bogus message, discarded (5)\n" );
delete letter;
}
else
{
int seqId = letter->GetDataInt( NET_DEFCON_SEQID );
if( seqId == -1 )
{
// This letter is just for us
ProcessServerLetters( letter );
delete letter;
}
else
{
AppReleaseAssert( seqId == g_lastProcessedSequenceId + 1, "Networking broken!" );
bool handled = ProcessServerLetters(letter);
if(!handled)
{
g_app->GetClientToServer()->ProcessServerUpdates( letter );
}
if( g_app->m_gameRunning )
{
g_app->GetWorld()->Update();
}
else
{
HandleGameStart();
}
g_lastServerAdvance = (float)seqId * SERVER_ADVANCE_PERIOD.DoubleValue() + g_startTime;
g_lastProcessedSequenceId = seqId;
delete letter;
if( seqId == 0 && g_app->GetClientToServer()->m_resynchronising > 0.0f )
{
AppDebugOut( "Client successfully began Resynchronising\n" );
g_app->GetClientToServer()->m_resynchronising = -1.0f;
}
unsigned char sync = GenerateSyncValue();
SyncRandLog( "Sync %d = %d", g_lastProcessedSequenceId, sync );
g_app->GetClientToServer()->SendSyncronisation( g_lastProcessedSequenceId, sync );
}
}
}
END_PROFILE("Client Main Loop");
}
//
// Render
UpdateAdvanceTime();
if( TimeToRender(lastRenderTime) )
{
lastRenderTime = GetHighResTime();
g_app->Update();
g_app->Render();
g_soundSystem->Advance();
if( g_profiler ) g_profiler->Advance();
}
}
delete g_app;
g_app = NULL;
}