本文整理汇总了C++中LList::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::GetData方法的具体用法?C++ LList::GetData怎么用?C++ LList::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newStr
const char *FindCaseInsensitive ( const char *_fullPath )
{
if ( !_fullPath )
return NULL;
static char retval[PATH_MAX];
char *dir = NULL, *file = NULL;
if ( (dir = GetDirectoryPart(_fullPath)) != NULL )
{
// Make our own copy of the result, since GetDirectoryPart
// and GetFilenamePart use the same variable for temp
// storage.
dir = newStr(dir);
}
if ( !dir )
{
// No directory provided. Assume working directory.
file = newStr(_fullPath);
} else {
// Kill the last slash
dir[strlen(dir) - 1] = '\0';
file = newStr(GetFilenamePart(_fullPath));
}
LList <char *> *files = ListDirectory(dir, file);
delete [] dir; delete [] file; dir = file = NULL;
// We shouldn't have found more than one match.
AppAssert(files->Size() <= 1);
// No results, so maybe the file does not exist.
if ( files->Size() == 0 )
return _fullPath;
// Copy the corrected path back, and prepare to return it.
memset ( retval, 0, sizeof ( retval ) );
AppAssert ( strlen ( files->GetData(0) ) < PATH_MAX );
strcpy ( retval, files->GetData(0) );
// Negate the possibility of a memory access violation.
// This way, we can simply strcpy the result inline without
// worrying about a buffer overflow.
AppAssert(strlen(retval) == strlen(_fullPath));
while ( files->Size() )
{
char *data = files->GetData(0);
files->RemoveData(0);
delete [] data;
}
delete files;
return retval;
}
示例2: EclRender
void EclRender ()
{
bool maximiseRender = false;
//
// Render any maximised Window?
if( strcmp( maximisedWindow, "None" ) != 0 )
{
EclWindow *maximised = EclGetWindow( maximisedWindow );
if( maximised )
{
clearDraw ( maximised->m_x, maximised->m_y, maximised->m_w, maximised->m_h );
maximised->Render( true );
maximiseRender = true;
}
else
{
EclUnMaximise();
}
}
if( !maximiseRender )
{
//
// Clear all dirty rectangle areas
if ( clearDraw )
{
for( int i = 0; i < dirtyrects.Size(); ++i )
{
DirtyRect *dr = dirtyrects.GetData(i);
clearDraw ( dr->m_x, dr->m_y, dr->m_width, dr->m_height );
}
}
//
// Draw all dirty buttons
for ( int i = windows.Size() - 1; i >= 0; --i )
{
EclWindow *window = windows.GetData(i);
if ( window->m_dirty ) {
bool hasFocus = ( strcmp ( window->m_name, windowFocus ) == 0 );
window->Render( hasFocus );
//window->m_dirty = false;
}
}
}
}
示例3: EclResetDirtyRectangles
void EclResetDirtyRectangles ()
{
while ( dirtyrects.GetData(0) )
{
DirtyRect *dr = dirtyrects.GetData(0);
delete dr;
dirtyrects.RemoveData(0);
}
for ( int i = 0; i < windows.Size(); ++i )
{
EclWindow *window = windows.GetData(i);
window->m_dirty = false;
}
}
示例4: RenderModeCameraMount
void LocationEditor::RenderModeCameraMount()
{
RGBAColour bright(255,255,0);
RGBAColour dim(90,90,0);
LList <CameraAnimation*> *list = &g_app->m_location->m_levelFile->m_cameraAnimations;
for (int i = 0; i < list->Size(); ++i)
{
CameraAnimation *anim = list->GetData(i);
CamAnimNode *lastNode = anim->m_nodes.GetData(0);
for (int j = 1; j < anim->m_nodes.Size(); ++j)
{
CamAnimNode *node = anim->m_nodes.GetData(j);
if (stricmp(node->m_mountName, MAGIC_MOUNT_NAME_START_POS) == 0 ||
stricmp(lastNode->m_mountName, MAGIC_MOUNT_NAME_START_POS) == 0)
{
continue;
}
CameraMount *mount1 = g_app->m_location->m_levelFile->GetCameraMount(lastNode->m_mountName);
CameraMount *mount2 = g_app->m_location->m_levelFile->GetCameraMount(node->m_mountName);
if (i == m_selectionId)
{
RenderArrow(mount1->m_pos, mount2->m_pos, 1.0, bright);
}
else
{
RenderArrow(mount1->m_pos, mount2->m_pos, 1.0, dim);
}
lastNode = node;
}
}
}
示例5:
int LocationEditor::IsPosInLandTile(Vector3 const &pos)
{
Landscape *land = &g_app->m_location->m_landscape;
LList<LandscapeTile *> *tiles = &g_app->m_location->m_levelFile->m_landscape.m_tiles;
int smallestId = -1;
int smallestSize = INT_MAX;
for (int i = 0; i < tiles->Size(); ++i)
{
LandscapeTile *tile = tiles->GetData(i);
float worldX = tile->m_posX;
float worldZ = tile->m_posZ;
float sizeX = tile->m_size;
float sizeZ = tile->m_size;
if (pos.x > worldX &&
pos.x < worldX + sizeX &&
pos.z > worldZ &&
pos.z < worldZ + sizeZ)
{
if (tile->m_size < smallestSize)
{
smallestId = i;
smallestSize = tile->m_size;
}
}
}
return smallestId;
}
示例6: SetWaypoint
void Officer::SetWaypoint( Vector3 const &_wayPoint )
{
m_wayPoint = _wayPoint;
m_state = StateToWaypoint;
//
// If we clicked near a teleport, tell the officer to go into it
m_wayPointTeleportId = -1;
LList<int> *nearbyBuildings = g_app->m_location->m_obstructionGrid->GetBuildings( _wayPoint.x, _wayPoint.z );
for( int i = 0; i < nearbyBuildings->Size(); ++i )
{
int buildingId = nearbyBuildings->GetData(i);
Building *building = g_app->m_location->GetBuilding( buildingId );
if( building->m_type == Building::TypeRadarDish ||
building->m_type == Building::TypeBridge )
{
float distance = ( building->m_pos - _wayPoint ).Mag();
Teleport *teleport = (Teleport *) building;
if( distance < 5.0f && teleport->Connected() )
{
m_wayPointTeleportId = building->m_id.GetUniqueId();
Vector3 entrancePos, entranceFront;
teleport->GetEntrance( entrancePos, entranceFront );
m_wayPoint = entrancePos;
break;
}
}
}
}
示例7: EclRemoveWindow
void EclRemoveWindow ( char *name )
{
int index = EclGetWindowIndex(name);
if ( index != -1 )
{
EclWindow *window = windows.GetData(index);
if( strcmp( mouseDownWindow, name ) == 0 )
{
strcpy( mouseDownWindow, "None" );
}
if( strcmp( windowFocus, name ) == 0 )
{
strcpy( windowFocus, "None" );
}
window->Remove();
windows.RemoveData(index);
delete window;
}
else
{
AppDebugOut( "EclRemoveWindow failed on window %s\n", name );
}
}
示例8: EclRemoveWindow
void EclRemoveWindow ( char *name )
{
int index = EclGetWindowIndex(name);
if ( index != -1 )
{
EclWindow *window = windows.GetData(index);
EclDirtyRectangle ( window->m_x, window->m_y, window->m_w, window->m_h );
windows.RemoveData(index);
if( strcmp( mouseDownWindow, name ) == 0 )
{
strcpy( mouseDownWindow, "None" );
}
if( strcmp( windowFocus, name ) == 0 )
{
strcpy( windowFocus, "None" );
}
delete window;
}
else
{
}
}
示例9: ClickNewsButton
void NewsScreenInterface::ClickNewsButton ( Button *button )
{
int index;
sscanf ( button->name, "news_story %d", &index );
index += baseoffset;
// Dirty the old button
char oldname [128];
UplinkSnprintf ( oldname, sizeof ( oldname ), "news_story %d", currentselect - baseoffset );
EclDirtyButton ( oldname );
CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" );
UplinkAssert ( cu );
if ( cu->GetNews (index) ) {
currentselect = index;
// Reset the offset so the player can read it from line 1
ScrollBox *scrollBox = ScrollBox::GetScrollBox( "news_details" );
if ( scrollBox ) {
scrollBox->SetCurrentIndex( 0 );
char *newDetails = cu->GetNews (index)->GetDetails();
Button *detailsButton = EclGetButton ( "news_details box" );
UplinkAssert (detailsButton);
LList <char *> *wrappedtext = wordwraptext ( newDetails, detailsButton->width );
if ( wrappedtext ) {
scrollBox->SetNumItems( wrappedtext->Size() );
if ( wrappedtext->ValidIndex (0) && wrappedtext->GetData (0) )
delete [] wrappedtext->GetData(0);
delete wrappedtext;
}
else {
scrollBox->SetNumItems( 0 );
}
}
EclRegisterCaptionChange ( "news_details box", cu->GetNews (index)->GetDetails (), 2000 );
}
}
示例10: LoadLanguages
void LanguageTable::LoadLanguages()
{
//
// Clear out all known languages
m_languages.EmptyAndDelete();
//
// Explore the data/language directory, looking for languages
LList<char *> *files = g_fileSystem->ListArchive( "data/language/", "*.txt", false );
for( int i = 0; i < files->Size(); ++i )
{
char *thisFile = files->GetData(i);
Language *lang = new Language();
snprintf( lang->m_name, sizeof(lang->m_name), thisFile );
lang->m_name[ sizeof(lang->m_name) - 1 ] = '\0';
for( char *curName = lang->m_name; *curName; curName++ )
{
if( *curName == '.' )
{
*curName = '\0';
break;
}
}
strcpy( lang->m_caption, lang->m_name );
snprintf( lang->m_path, sizeof(lang->m_path), "data/language/%s", thisFile );
lang->m_path[ sizeof(lang->m_path) - 1 ] = '\0';
LoadLanguageCaption( lang );
if( m_onlyDefaultLanguageSelectable && stricmp( m_defaultLanguage, lang->m_name ) != 0 )
{
lang->m_selectable = false;
}
else
{
lang->m_selectable = true;
}
m_languages.PutData( lang );
AppDebugOut( "Found language '%s' with caption '%s' in '%s'\n",
lang->m_name,
lang->m_caption,
lang->m_path );
}
files->EmptyAndDelete();
delete files;
}
示例11: EclRender
void EclRender ()
{
bool maximiseRender = false;
//
// Render any maximised Window?
if( strcmp( maximisedWindow, "None" ) != 0 )
{
EclWindow *maximised = EclGetWindow( maximisedWindow );
if( maximised )
{
maximised->Render( true );
maximiseRender = true;
}
else
{
EclUnMaximise();
}
}
if( !maximiseRender )
{
for ( int i = windows.Size() - 1; i >= 0; --i )
{
EclWindow *window = windows.GetData(i);
bool hasFocus = ( strcmp ( window->m_name, windowFocus ) == 0 );
START_PROFILE( window->m_name );
window->Render( hasFocus );
END_PROFILE( window->m_name );
}
}
//
// Render the tooltip
if( tooltipTimer > 0.0f && tooltipCallback )
{
EclWindow *window = EclGetWindow();
if( window )
{
EclButton *button = window->GetButton( EclGetCurrentButton() );
{
if( button )
{
float timer = GetHighResTime() - tooltipTimer;
tooltipCallback( window, button, timer );
}
}
}
}
}
示例12: EclGetWindowIndex
int EclGetWindowIndex ( char *name )
{
for ( int i = 0; i < windows.Size(); ++i )
{
EclWindow *window = windows.GetData(i);
if ( strcmp ( window->m_name, name ) == 0 )
return i;
}
return -1;
}
示例13: EnterTeleports
int Entity::EnterTeleports( int _requiredId )
{
LList<int> *buildings = g_app->m_location->m_obstructionGrid->GetBuildings( m_pos.x, m_pos.z );
for( int i = 0; i < buildings->Size(); ++i )
{
int buildingId = buildings->GetData(i);
if( _requiredId != -1 && _requiredId != buildingId )
{
// We are only permitted to enter building with id _requiredId
continue;
}
Building *building = g_app->m_location->GetBuilding( buildingId );
AppDebugAssert( building );
if( building->m_type == Building::TypeRadarDish )
{
RadarDish *radarDish = (RadarDish *) building;
Vector3 entrancePos, entranceFront;
radarDish->GetEntrance( entrancePos, entranceFront );
double range = ( m_pos - entrancePos ).Mag();
if( radarDish->ReadyToSend() &&
range < 15.0 &&
m_front * entranceFront < 0.0 )
{
WorldObjectId id(m_id);
radarDish->EnterTeleport( id );
g_app->m_soundSystem->TriggerEntityEvent( this, "EnterTeleport" );
return buildingId;
}
}
else if( building->m_type == Building::TypeBridge )
{
Bridge *bridge = (Bridge *) building;
Vector3 entrancePos, entranceFront;
if( bridge->GetEntrance( entrancePos, entranceFront ) )
{
double range = ( m_pos - bridge->m_pos ).Mag();
if( bridge->ReadyToSend() &&
range < 25.0 &&
m_front * entranceFront < 0.0 )
{
WorldObjectId id( m_id );
bridge->EnterTeleport( id );
g_app->m_soundSystem->TriggerEntityEvent( this, "EnterTeleport" );
return buildingId;
}
}
}
}
return -1;
}
示例14: EclDirtyRectangle
void EclDirtyRectangle ( int x, int y, int w, int h )
{
DirtyRect *dr = new DirtyRect(x, y, w, h);
dirtyrects.PutData( dr );
for ( int i = 0; i < windows.Size(); ++i )
{
EclWindow *window = windows.GetData(i);
if ( EclRectangleOverlap( x, y, w, h, window->m_x, window->m_y, window->m_w, window->m_h ) )
EclDirtyWindow ( window );
}
}
示例15: EclUpdate
void EclUpdate ()
{
//
// Update all windows
for ( int i = 0; i < windows.Size(); ++i )
{
EclWindow *window = windows.GetData(i);
window->Update();
}
}