static bool SrcPyPathIsInGameFolder( const char *pPath ) { #if 0 if( SrcPySystem()->IsPathProtected() ) { // Verify the file is in the gamefolder char searchPaths[MAX_PATH]; filesystem->GetSearchPath( "MOD", true, searchPaths, sizeof( searchPaths ) ); V_StripTrailingSlash( searchPaths ); if( V_IsAbsolutePath( pPath ) ) { if( V_strnicmp( pPath, searchPaths, V_strlen( searchPaths ) ) != 0 ) return false; } else { char pFullPath[MAX_PATH]; char moddir[MAX_PATH]; filesystem->RelativePathToFullPath( ".", "MOD", moddir, sizeof( moddir ) ); V_MakeAbsolutePath( pFullPath, sizeof( pFullPath ), pPath, moddir ); if( V_strnicmp( pFullPath, searchPaths, V_strlen(searchPaths) ) != 0 ) return false; } } #endif // 0 return true; }
//----------------------------------------------------------------------------- // Remove entry from dictionary, Returns TRUE if removed. //----------------------------------------------------------------------------- bool RemoveFileFromResourceList( const char *pFilename, CUtlRBTree< CUtlString, int > *pTree ) { char szOutName[MAX_PATH]; char *pOutName; V_strncpy( szOutName, pFilename, sizeof( szOutName ) ); V_FixSlashes( szOutName ); V_RemoveDotSlashes( szOutName ); V_strlower( szOutName ); pOutName = szOutName; // strip any prefixed game name for ( int i = 0; g_GameNames[i] != NULL; i++ ) { size_t len = strlen( g_GameNames[i] ); if ( !V_strnicmp( pOutName, g_GameNames[i], len ) && pOutName[len] == '\\' ) { // skip past game name and slash pOutName += len+1; break; } } if ( pTree->Find( pOutName ) != pTree->InvalidIndex() ) { pTree->Remove( pOutName ); return true; } return false; }
//----------------------------------------------------------------------------- // Button click handlers //----------------------------------------------------------------------------- void CResourcePumpControlPanel::OnCommand( const char *command ) { if (!V_strnicmp(command, "Upgrade", 7)) { Upgrade(); return; } BaseClass::OnCommand(command); }
void CReplayBrowserBasePage::OnCommand( const char *pCommand ) { // User wants details on a replay? if ( !V_strnicmp( pCommand, "details", 7 ) ) { // Get rid of preview panel m_pReplayList->ClearPreviewPanel(); QueryableReplayItemHandle_t hReplayItem = (QueryableReplayItemHandle_t)atoi( pCommand + 7 ); IReplayItemManager *pItemManager; IQueryableReplayItem *pReplayItem = FindReplayItem( hReplayItem, &pItemManager ); Assert( pReplayItem ); if ( pReplayItem ) { // Get performance int iPerformance = -1; const char *pPerformanceStr = V_strstr( pCommand + 8, "_" ); if ( pPerformanceStr ) { iPerformance = atoi( pPerformanceStr + 1 ); } m_hReplayDetailsPanel = vgui::SETUP_PANEL( new CReplayDetailsPanel( this, hReplayItem, iPerformance, pItemManager ) ); m_hReplayDetailsPanel->SetVisible( true ); m_hReplayDetailsPanel->MoveToFront(); m_pReplayList->SetVisible( false ); surface()->PlaySound( "replay\\showdetails.wav" ); } } // "back" button was hit in details panel? else if ( FStrEq( pCommand, "back" ) ) { GoBack(); } BaseClass::OnCommand( pCommand ); }