void CTilegenLayoutSystemPage::OnAddToP4( KeyValues *pKV ) { const char *pPath = pKV->GetString( "file", NULL ); if ( pPath != NULL ) { if ( !p4->OpenFileForAdd( pPath ) ) { VGUIMessageBox( this, "P4 Error!", "Failed to add '%s' to Perforce.", pPath ); } } }
void CTilegenKVEditorPage::OnCheckOutFromP4( KeyValues *pKV ) { const char *pPath = pKV->GetString( "file", NULL ); if ( pPath != NULL ) { if ( p4->OpenFileForEdit( pPath ) ) { KeyValues *pKV = GetKeyValues(); if ( !pKV->SaveToFile( g_pFullFileSystem, m_szFilename, "GAME" ) ) { VGUIMessageBox( this, "Save Error!", "Checked out '%s' from Perforce, but failed to save file.", pPath ); } } else { VGUIMessageBox( this, "P4 Error!", "Failed to check out '%s' from Perforce.", pPath ); } } UpdateList(); }
void CTilegenLayoutSystemPage::OnFileSelected( const char *pFullPath ) { if ( g_pFullFileSystem->FileExists( pFullPath ) ) { VGUIMessageBox( this, "Save Error", "A layout system already exists with filename %s.", pFullPath ); return; } // create new keys KeyValues *pNewKeys = new KeyValues( "Mission" ); // save them at the full path if ( !pNewKeys->SaveToFile( g_pFullFileSystem, pFullPath ) ) { VGUIMessageBox( this, "Save Error", "Failed to save new file %s.", pFullPath ); return; } m_pEditor->SetMissionData( pNewKeys ); m_pReloadMissionButton->SetVisible( true ); m_pSaveButton->SetVisible( true ); m_pGenerateButton->SetVisible( true ); bool bConverted = g_pFullFileSystem->FullPathToRelativePath( pFullPath, m_szFilename, MAX_PATH ); if ( !bConverted ) { Warning( "Failed to convert this to a relative path: %s\n", pFullPath ); return; } m_pFilenameLabel->SetText( m_szFilename + Q_strlen( "tilegen/" ) ); m_pNewMissionDatabase->AddFile( pNewKeys, m_szFilename ); UpdateList(); if ( p4 ) { MessageBox *pMessage = new MessageBox( "Add to P4?", "Would you like to add this mission to perforce?", this ); pMessage->SetCancelButtonVisible( true ); pMessage->SetOKButtonText( "#MessageBox_Yes" ); pMessage->SetCancelButtonText( "#MessageBox_No" ); pMessage->SetCommand( new KeyValues( "AddToP4", "file", pFullPath ) ); pMessage->DoModal(); } }
bool VMFExporter::ShowExportErrors() { if ( m_ExportErrors.Count() <= 0 ) return false; char msg[4096]; msg[0] = 0; for ( int i=0; i<m_ExportErrors.Count(); i++ ) { Q_snprintf( msg, sizeof( msg ), "%s\n%s", msg, m_ExportErrors[i] ); } VGUIMessageBox( g_pTileGenDialog, "Export problems:", msg ); return true; }
void CTilegenKVEditorPage::OnCommand( const char *command ) { if ( !Q_stricmp( command, "Save" ) ) { KeyValues *pKV = GetKeyValues(); char fullFilePathBuffer [512]; Q_snprintf(fullFilePathBuffer, sizeof(fullFilePathBuffer),"C:\\Program Files\\Steam\\steamapps\\sourcemods\\alienswarmdirectormod\\%s", m_szFilename); Msg("Saving to [%s]", fullFilePathBuffer); //if ( pKV != NULL && !pKV->SaveToFile( g_pFullFileSystem, m_szFilename, "GAME" ) ) if ( pKV != NULL && !pKV->SaveToFile( g_pFullFileSystem, fullFilePathBuffer ) ) { if ( p4 ) { char fullPath[MAX_PATH]; g_pFullFileSystem->RelativePathToFullPath( m_szFilename, "GAME", fullPath, MAX_PATH ); if ( p4->IsFileInPerforce( fullPath ) ) { MessageBox *pMessage = new MessageBox( "Check Out?", "File is not writeable. Would you like to check it out from Perforce?", this ); pMessage->SetCancelButtonVisible( true ); pMessage->SetOKButtonText( "#MessageBox_Yes" ); pMessage->SetCancelButtonText( "#MessageBox_No" ); pMessage->SetCommand( new KeyValues( "CheckOutFromP4", "file", fullPath ) ); pMessage->DoModal(); return; } } else { VGUIMessageBox( this, "Save Error", "Failed to save %s. Make sure file is checked out from Perforce.", m_szFilename ); } } UpdateList(); return; } else if ( !Q_stricmp( command, "New" ) ) { SaveNew(); return; } BaseClass::OnCommand( command ); }
void CTilegenKVEditorPage::OnCommand( const char *command ) { if ( !Q_stricmp( command, "Save" ) ) { KeyValues *pKV = GetKeyValues(); if ( pKV != NULL && !pKV->SaveToFile( g_pFullFileSystem, m_szFilename, "MOD" ) ) { if ( p4 ) { char fullPath[MAX_PATH]; g_pFullFileSystem->RelativePathToFullPath( m_szFilename, "MOD", fullPath, MAX_PATH ); if ( p4->IsFileInPerforce( fullPath ) ) { MessageBox *pMessage = new MessageBox( "Check Out?", "File is not writeable. Would you like to check it out from Perforce?", this ); pMessage->SetCancelButtonVisible( true ); pMessage->SetOKButtonText( "#MessageBox_Yes" ); pMessage->SetCancelButtonText( "#MessageBox_No" ); pMessage->SetCommand( new KeyValues( "CheckOutFromP4", "file", fullPath ) ); pMessage->DoModal(); return; } } else { VGUIMessageBox( this, "Save Error", "Failed to save %s. Make sure file is checked out from Perforce.", m_szFilename ); } } UpdateList(); return; } else if ( !Q_stricmp( command, "New" ) ) { SaveNew(); return; } BaseClass::OnCommand( command ); }