Reformat all C files.

I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
This commit is contained in:
Sean Hunt
2015-05-09 13:43:16 -04:00
parent 167800afdf
commit 97d6fade74
270 changed files with 182649 additions and 173878 deletions
+37 -43
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 gnyesno.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.6 gnyesno.c $NHDT-Date: 1431192773 2015/05/09 17:32:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* NetHack 3.6 gnyesno.c $Date: 2009/05/06 10:58:06 $ $Revision: 1.4 $ */
/* SCCS Id: @(#)gnyesno.c 3.5 2000/07/16 */
/* Copyright (C) 1998 by Erik Andersen <andersee@debian.org> */
@@ -7,47 +7,42 @@
#include "gnbind.h"
#include "gnyesno.h"
int ghack_yes_no_dialog( const char *question,
const char *choices, int def)
int
ghack_yes_no_dialog(const char *question, const char *choices, int def)
{
int i=0, ret;
int i = 0, ret;
gchar button_name[BUFSZ];
GtkWidget *box;
GtkWidget* mainWnd=NULL;
GtkWidget *mainWnd = NULL;
box = gnome_message_box_new ( question, GNOME_MESSAGE_BOX_QUESTION, NULL);
box = gnome_message_box_new(question, GNOME_MESSAGE_BOX_QUESTION, NULL);
/* add buttons for each choice */
if (!strcmp(GNOME_STOCK_BUTTON_OK, choices)) {
gnome_dialog_append_button ( GNOME_DIALOG(box), GNOME_STOCK_BUTTON_OK);
gnome_dialog_set_default( GNOME_DIALOG(box), 0);
gnome_dialog_set_accelerator( GNOME_DIALOG(box), 0, 'o', 0);
gnome_dialog_append_button(GNOME_DIALOG(box), GNOME_STOCK_BUTTON_OK);
gnome_dialog_set_default(GNOME_DIALOG(box), 0);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), 0, 'o', 0);
#if 0
g_print("Setting accelerator '%c' for button %d\n", 'o', 0);
#endif
}
else {
for( ; choices[i]!='\0'; i++) {
if (choices[i]=='y') {
sprintf( button_name, GNOME_STOCK_BUTTON_YES);
}
else if (choices[i]=='n') {
sprintf( button_name, GNOME_STOCK_BUTTON_NO);
}
else if (choices[i] == 'q') {
sprintf( button_name, "Quit");
} else {
sprintf( button_name, "%c", choices[i]);
}
if (def==choices[i])
gnome_dialog_set_default( GNOME_DIALOG(box), i);
gnome_dialog_append_button ( GNOME_DIALOG(box), button_name);
gnome_dialog_set_accelerator( GNOME_DIALOG(box), i, choices[i], 0);
} else {
for (; choices[i] != '\0'; i++) {
if (choices[i] == 'y') {
sprintf(button_name, GNOME_STOCK_BUTTON_YES);
} else if (choices[i] == 'n') {
sprintf(button_name, GNOME_STOCK_BUTTON_NO);
} else if (choices[i] == 'q') {
sprintf(button_name, "Quit");
} else {
sprintf(button_name, "%c", choices[i]);
}
if (def == choices[i])
gnome_dialog_set_default(GNOME_DIALOG(box), i);
gnome_dialog_append_button(GNOME_DIALOG(box), button_name);
gnome_dialog_set_accelerator(GNOME_DIALOG(box), i, choices[i], 0);
#if 0
g_print("Setting accelerator '%c' for button %d\n", choices[i], i);
#endif
}
}
}
#if 0
/* Perhaps add in a quit game button, like this... */
@@ -56,23 +51,22 @@ int ghack_yes_no_dialog( const char *question,
g_print("Setting accelerator '%c' for button %d\n", 'Q', i);
#endif
gnome_dialog_set_close(GNOME_DIALOG (box), TRUE);
mainWnd = ghack_get_main_window ();
gtk_window_set_modal( GTK_WINDOW(box), TRUE);
gtk_window_set_title( GTK_WINDOW(box), "GnomeHack");
if ( mainWnd != NULL ) {
gnome_dialog_set_parent (GNOME_DIALOG (box),
GTK_WINDOW ( mainWnd) );
gnome_dialog_set_close(GNOME_DIALOG(box), TRUE);
mainWnd = ghack_get_main_window();
gtk_window_set_modal(GTK_WINDOW(box), TRUE);
gtk_window_set_title(GTK_WINDOW(box), "GnomeHack");
if (mainWnd != NULL) {
gnome_dialog_set_parent(GNOME_DIALOG(box), GTK_WINDOW(mainWnd));
}
ret=gnome_dialog_run_and_close ( GNOME_DIALOG (box));
ret = gnome_dialog_run_and_close(GNOME_DIALOG(box));
#if 0
g_print("You selected button %d\n", ret);
#endif
if (ret==-1)
return( '\033');
if (ret == -1)
return ('\033');
else
return( choices[ret]);
return (choices[ret]);
}