From: mattn Date: Sun, 16 Mar 2008 19:10:26 +0000 (+0000) Subject: * cleanup - use GINT_TO_POINTER and GPOINTER_TO_INT X-Git-Tag: xonotic-v0.7.0~16^2~12^2~112^2~36 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=71b0f48eee46516917cf7316724cb55d62299093;p=xonotic%2Fnetradiant.git * cleanup - use GINT_TO_POINTER and GPOINTER_TO_INT git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@219 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- diff --git a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp b/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp index 687af055..86872e6b 100644 --- a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp +++ b/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp @@ -212,14 +212,14 @@ inline void change_contentflag (GtkWidget *togglebutton, int content_flag, gbool // Surface Flags Callbacks void on_surface_button_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - int flag = *(int*)user_data; + int flag = GPOINTER_TO_INT(user_data); change_surfaceflag(GTK_WIDGET (togglebutton), flag, (GTK_TOGGLE_BUTTON (togglebutton)->active)); } // Content Flags Callbacks void on_content_button_toggled (GtkToggleButton *togglebutton, gpointer user_data) { - int flag = *(int*)user_data; + int flag = GPOINTER_TO_INT(user_data); change_contentflag(GTK_WIDGET (togglebutton), flag, (GTK_TOGGLE_BUTTON (togglebutton)->active)); } @@ -340,41 +340,6 @@ static const char *contentFlags[] = { "" }; -static const int flagBitMasks[] = { - 1<<0, - 1<<1, - 1<<2, - 1<<3, - 1<<4, - 1<<5, - 1<<6, - 1<<7, - 1<<8, - 1<<9, - 1<<10, - 1<<11, - 1<<12, - 1<<13, - 1<<14, - 1<<15, - 1<<16, - 1<<17, - 1<<18, - 1<<19, - 1<<20, - 1<<21, - 1<<22, - 1<<23, - 1<<24, - 1<<25, - 1<<26, - 1<<27, - 1<<28, - 1<<29, - 1<<30, - 1<<31, -}; - #define UFOAI_FLAG_BUTTON_BORDER 3 GtkWidget* Create_UFOAIFlagsDialog (GtkWidget* surfacedialog_widget) @@ -422,7 +387,7 @@ GtkWidget* Create_UFOAIFlagsDialog (GtkWidget* surfacedialog_widget) y++; x = i % 4; surface_buttons[i] = gtk_toggle_button_new_with_label (surfaceFlags[i]); - gtk_signal_connect(GTK_OBJECT (surface_buttons[i]), "toggled", GTK_SIGNAL_FUNC(on_surface_button_toggled), &flagBitMasks[i]); + gtk_signal_connect(GTK_OBJECT (surface_buttons[i]), "toggled", GTK_SIGNAL_FUNC(on_surface_button_toggled), GINT_TO_POINTER(1 << i)); gtk_widget_show(surface_buttons[i]); gtk_table_attach(GTK_TABLE (table4), surface_buttons[i], 0 + x, 1 + x, (0 + y), (1 + y), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), @@ -480,7 +445,7 @@ GtkWidget* Create_UFOAIFlagsDialog (GtkWidget* surfacedialog_widget) y++; x = i % 4; content_buttons[i] = gtk_toggle_button_new_with_label(contentFlags[i]); - gtk_signal_connect(GTK_OBJECT (content_buttons[i]), "toggled", GTK_SIGNAL_FUNC (on_content_button_toggled), &flagBitMasks[i]); + gtk_signal_connect(GTK_OBJECT (content_buttons[i]), "toggled", GTK_SIGNAL_FUNC (on_content_button_toggled), GINT_TO_POINTER(1 << i)); gtk_widget_show(content_buttons[i]); gtk_table_attach(GTK_TABLE (table3), content_buttons[i], 0 + x, 1 + x, (0 + y), (1 + y), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),