r706 - trunk/game

lordhavoc at icculus.org lordhavoc at icculus.org
Fri May 5 15:28:50 EDT 2006


Author: lordhavoc
Date: 2006-05-05 15:28:49 -0400 (Fri, 05 May 2006)
New Revision: 706

Modified:
   trunk/game/m_menucore.c
   trunk/game/m_menucore.h
Log:
function pointer casts patch from painQuin to hush warnings


Modified: trunk/game/m_menucore.c
===================================================================
--- trunk/game/m_menucore.c	2006-05-05 19:09:19 UTC (rev 705)
+++ trunk/game/m_menucore.c	2006-05-05 19:28:49 UTC (rev 706)
@@ -196,10 +196,10 @@
 
 	item = Mem_Alloc(Menu.menu_zone, bytes);
 
-	item->Frame = Menu_Generic_Frame;
+	item->Frame = (MenuItemFrame_t)Menu_Generic_Frame;
 	item->MouseMove = Menu_Generic_MouseMoveNonSelectable;
-	item->KeyEvent = Menu_Generic_KeyPressIgnore;
-	item->Destroy = Menu_Generic_Destroy;
+	item->KeyEvent = (MenuItemKeyEvent_t)Menu_Generic_KeyPressIgnore;
+	item->Destroy = (MenuItemDestroy_t)Menu_Generic_Destroy;
 
 	item->type = type;
 
@@ -247,11 +247,11 @@
 	Menu_TextItem *it;
 	it = (Menu_TextItem*)Menu_Generic_Create(parent, MENU_ITEMTYPE_TEXT, x, y, sizeof(Menu_TextItem));
 
-	it->super.Draw = Menu_Text_Draw;
+	it->super.Draw = (MenuItemDraw_t)Menu_Text_Draw;
 	if (cookie != NULL)
 	{
-		it->super.MouseMove = Menu_Generic_MouseMoveSelectable;
-		it->super.KeyEvent = Menu_Text_KeyPress;
+		it->super.MouseMove = (MenuItemMouseMove_t)Menu_Generic_MouseMoveSelectable;
+		it->super.KeyEvent = (MenuItemKeyEvent_t)Menu_Text_KeyPress;
 	}
 	it->super.size[0] = 8*strlen(text);
 	it->super.size[1] = 8;
@@ -356,9 +356,9 @@
 	Menu_EditItem *it;
 	it = (Menu_EditItem*)Menu_Generic_Create(parent, MENU_ITEMTYPE_EDIT, x, y, sizeof(Menu_EditItem));
 
-	it->super.Draw = Menu_Edit_Draw;
-	it->super.MouseMove = Menu_Generic_MouseMoveSelectable;
-	it->super.KeyEvent = Menu_Edit_KeyPress;
+	it->super.Draw = (MenuItemDraw_t)Menu_Edit_Draw;
+	it->super.MouseMove = (MenuItemMouseMove_t)Menu_Generic_MouseMoveSelectable;
+	it->super.KeyEvent = (MenuItemKeyEvent_t)Menu_Edit_KeyPress;
 	it->super.size[0] = 8*strlen(text);
 	it->super.size[1] = 8;
 
@@ -481,10 +481,10 @@
 	Menu_ComboItem *it;
 	it = (Menu_ComboItem*)Menu_Generic_Create(parent, MENU_ITEMTYPE_COMBO, x, y, sizeof(Menu_ComboItem));
 
-	it->super.super.Draw = Menu_Combo_Draw;
-	it->super.super.MouseMove = Menu_Generic_MouseMoveSelectable;
-	it->super.super.KeyEvent = Menu_Combo_KeyPress;
-	it->super.super.Destroy = Menu_Combo_Destroy;
+	it->super.super.Draw = (MenuItemDraw_t)Menu_Combo_Draw;
+	it->super.super.MouseMove = (MenuItemMouseMove_t)Menu_Generic_MouseMoveSelectable;
+	it->super.super.KeyEvent = (MenuItemKeyEvent_t)Menu_Combo_KeyPress;
+	it->super.super.Destroy = (MenuItemDestroy_t)Menu_Combo_Destroy;
 	it->super.super.size[0] = w;
 	it->super.super.size[1] = 8;
 
@@ -558,11 +558,11 @@
 	Menu_PictureItem *it;
 	it = (Menu_PictureItem*)Menu_Generic_Create(parent, MENU_ITEMTYPE_PICTURE, x, y, sizeof(Menu_PictureItem));
 
-	it->super.Draw = Menu_Picture_Draw;
+	it->super.Draw = (MenuItemDraw_t)Menu_Picture_Draw;
 	if (command != NULL)
 	{
-		it->super.MouseMove = Menu_Generic_MouseMoveSelectable;
-		it->super.KeyEvent = Menu_Picture_KeyPress;
+		it->super.MouseMove = (MenuItemMouseMove_t)Menu_Generic_MouseMoveSelectable;
+		it->super.KeyEvent = (MenuItemKeyEvent_t)Menu_Picture_KeyPress;
 	}
 	it->super.size[0] = w;
 	it->super.size[1] = h;
@@ -671,9 +671,9 @@
 	Menu_SliderItem *it;
 	it = (Menu_SliderItem*)Menu_Generic_Create(parent, MENU_ITEMTYPE_SLIDER, x, y, sizeof(Menu_SliderItem));
 
-	it->super.Draw = Menu_Slider_Draw;
-	it->super.MouseMove = Menu_Generic_MouseMoveSelectable;
-	it->super.KeyEvent = Menu_Slider_KeyPress;
+	it->super.Draw = (MenuItemDraw_t)Menu_Slider_Draw;
+	it->super.MouseMove = (MenuItemMouseMove_t)Menu_Generic_MouseMoveSelectable;
+	it->super.KeyEvent = (MenuItemKeyEvent_t)Menu_Slider_KeyPress;
 
 	it->super.size[0] = w;
 	it->super.size[1] = h;
@@ -877,11 +877,11 @@
 		Menu_SubMenu_AddAtFront(parent, &menu->super);
 	}
 
-	menu->super.MouseMove = Menu_SubMenu_MouseMove;
-	menu->super.Frame = Menu_SubMenu_Frame;
-	menu->super.Draw = Menu_SubMenu_Draw;
-	menu->super.KeyEvent = Menu_SubMenu_KeyEvent;
-	menu->super.Destroy = Menu_SubMenu_Destroy;
+	menu->super.MouseMove = (MenuItemMouseMove_t)Menu_SubMenu_MouseMove;
+	menu->super.Frame = (MenuItemFrame_t)Menu_SubMenu_Frame;
+	menu->super.Draw = (MenuItemDraw_t)Menu_SubMenu_Draw;
+	menu->super.KeyEvent = (MenuItemKeyEvent_t)Menu_SubMenu_KeyEvent;
+	menu->super.Destroy = (MenuItemDestroy_t)Menu_SubMenu_Destroy;
 
 	menu->allowclose = true;
 
@@ -1185,8 +1185,8 @@
 
 	// init the root menu
 	// FIXME: create the rootmenu using the normal submenu creation function instead?
-	Menu.rootmenu.super.Frame = Menu_SubMenu_Frame;
-	Menu.rootmenu.super.MouseMove = Menu_SubMenu_MouseMove;
-	Menu.rootmenu.super.Draw = Menu_SubMenu_Draw;
-	Menu.rootmenu.super.KeyEvent = Menu_SubMenu_KeyEvent;
+	Menu.rootmenu.super.Frame = (MenuItemFrame_t)Menu_SubMenu_Frame;
+	Menu.rootmenu.super.MouseMove = (MenuItemMouseMove_t)Menu_SubMenu_MouseMove;
+	Menu.rootmenu.super.Draw = (MenuItemDraw_t)Menu_SubMenu_Draw;
+	Menu.rootmenu.super.KeyEvent = (MenuItemKeyEvent_t)Menu_SubMenu_KeyEvent;
 }

Modified: trunk/game/m_menucore.h
===================================================================
--- trunk/game/m_menucore.h	2006-05-05 19:09:19 UTC (rev 705)
+++ trunk/game/m_menucore.h	2006-05-05 19:28:49 UTC (rev 706)
@@ -30,6 +30,12 @@
 }
 Menu_ItemType;
 
+typedef void (*MenuItemFrame_t)(void *, Menu_Inheritance *, Ndouble);
+typedef void (*MenuItemDraw_t)(void *, Menu_Inheritance *);
+typedef Nbool (*MenuItemKeyEvent_t)(void *, NUint, NUint, NUint, Nbool);
+typedef void (*MenuItemMouseMove_t)(void *, Menu_Inheritance *);
+typedef void (*MenuItemDestroy_t)(void *);
+
 typedef struct Menu_Item
 {
 	// pass an elapsedtime parameter to make animation-speed changes, etc. possible




More information about the neither-commits mailing list