]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/preferences.cpp
move old gtk runtime code back to trunk
[xonotic/netradiant.git] / radiant / preferences.cpp
index 9608fbb981737ff33dfa130623b4e5934c31e4e8..03486fd861b4abc81997dd36b48f88f59e3e7613 100644 (file)
@@ -39,6 +39,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "missing.h"
 #include "gtkmisc.h"
 
+#ifdef _WIN32
+       // sanity check - some gtk2 win32 runtimes replace sprintf
+       #if defined( sprintf )
+               #error sprintf is a macro. are you sure?
+       #endif
+#endif
+
 #ifdef _WIN32
 #include <io.h>
 #define X_OK 0
@@ -2218,7 +2225,7 @@ void PrefsDlg::BuildDialog ()
 
 #ifdef _WIN32
   // win32 file dialog
-  check = gtk_check_button_new_with_label (_("Use win32 file load dialog"));
+  check = gtk_check_button_new_with_label (_("Use win32 file dialog (hacky)"));
   gtk_widget_show (check);
   // gtk_container_add (GTK_CONTAINER (vbox), check);
   gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
@@ -3295,6 +3302,9 @@ void CGameInstall::BuildDialog() {
                case GAME_TREMULOUS:
                        gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") );
                        break;
+               case GAME_JA:
+                       gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Jedi Academy and mods") );
+                       break;
                }
                iGame++;
        }
@@ -3356,6 +3366,9 @@ void CGameInstall::BuildDialog() {
 
 void CGameInstall::Run() {
        ScanGames();
+       if ( m_availGames[0] == GAME_NONE ) {
+               return;
+       }
        if ( DoModal() == IDCANCEL ) {
                Sys_Printf( "game dialog cancelled\n" );
                return;
@@ -3369,8 +3382,8 @@ void CGameInstall::Run() {
        gameFilePath += ".game";
        Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
 
-       FILE *fg = fopen( gameFilePath.GetBuffer(), "w" );
-       if ( fg == NULL || ferror( fg ) ) {
+       FILE * fg = fopen( gameFilePath.GetBuffer(), "w" );
+       if ( fg == NULL ) {
                Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
        }
        fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
@@ -3473,6 +3486,18 @@ void CGameInstall::Run() {
                fprintf( fg, "  basegame=\"base\"\n" );
                break;
        }
+       case GAME_JA: {
+               fprintf( fg, "  "TOOLS_ATTRIBUTE"=\"%sinstalls/JAPack/game\"\n", g_strAppPath.GetBuffer() );
+               fprintf( fg, "  prefix=\".ja\"\n" );
+               Str source = g_strAppPath.GetBuffer();
+               source += "installs/";
+               source += JA_PACK;
+               source += "/install/";
+               Str dest = m_strEngine.GetBuffer();
+               CopyTree( source.GetBuffer(), dest.GetBuffer() );
+               fprintf( fg, "  basegame=\"base\"\n" );
+               break;
+       }
        }
        fprintf( fg, "/>\n" );
        fclose( fg );
@@ -3516,6 +3541,11 @@ void CGameInstall::ScanGames() {
                if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) {
                        m_availGames[ iGame++ ] = GAME_TREMULOUS;
                }
+               if ( stricmp( dirname, JA_PACK ) == 0 ) {
+                       m_availGames[ iGame++ ] = GAME_JA;
+               }
        }
+       Sys_Printf("No installable games found in: %s\n",
+               pakPaths.GetBuffer() );
 }