[Scummvm-cvs-logs] SF.net SVN: scummvm: [32049] scummvm/trunk/engines/kyra

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon May 12 06:33:30 CEST 2008


Revision: 32049
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32049&view=rev
Author:   eriktorbjorn
Date:     2008-05-11 21:33:30 -0700 (Sun, 11 May 2008)

Log Message:
-----------
Added do { ... } while (0) to the GUI_V* macros, so that they will work as
expected if, for instance, someone writes "if (...) GUI_V1_MENU_ITEM( ... );"
I don't expect anyone will want to write statements like that, but just to
avoid nasty surprises...

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lok.h
    scummvm/trunk/engines/kyra/gui_v2.h

Modified: scummvm/trunk/engines/kyra/gui_lok.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.h	2008-05-12 04:29:41 UTC (rev 32048)
+++ scummvm/trunk/engines/kyra/gui_lok.h	2008-05-12 04:33:30 UTC (rev 32049)
@@ -31,59 +31,65 @@
 namespace Kyra {
 
 #define GUI_V1_BUTTON(button, a, b, c, d, e, f, g, h, i, j, k) \
-	button.nextButton = 0; \
-	button.index = a; \
-	button.unk6 = button.unk8 = 0; \
-	button.data0Val1 = b; \
-	button.data1Val1 = c; \
-	button.data2Val1 = d; \
-	button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
-	button.flags = e; \
-	button.dimTableIndex = f; \
-	button.x = g; \
-	button.y = h; \
-	button.width = i; \
-	button.height = j; \
-	button.flags2 = k; \
-	button.mouseWheel = 0
+	do { \
+		button.nextButton = 0; \
+		button.index = a; \
+		button.unk6 = button.unk8 = 0; \
+		button.data0Val1 = b; \
+		button.data1Val1 = c; \
+		button.data2Val1 = d; \
+		button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
+		button.flags = e; \
+		button.dimTableIndex = f; \
+		button.x = g; \
+		button.y = h; \
+		button.width = i; \
+		button.height = j; \
+		button.flags2 = k; \
+		button.mouseWheel = 0; \
+	} while (0)
 
 #define GUI_V1_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
-	menu.x = a; \
-	menu.y = b; \
-	menu.width = c; \
-	menu.height = d; \
-	menu.bkgdColor = e; \
-	menu.color1 = f; \
-	menu.color2 = g; \
-	menu.menuNameString = h; \
-	menu.textColor = i; \
-	menu.titleX = j; \
-	menu.titleY = k; \
-	menu.highlightedItem = l; \
-	menu.numberOfItems = m; \
-	menu.scrollUpButtonX = n; \
-	menu.scrollUpButtonY = o; \
-	menu.scrollDownButtonX = p; \
-	menu.scrollDownButtonY = q
+	do { \
+		menu.x = a; \
+		menu.y = b; \
+		menu.width = c; \
+		menu.height = d; \
+		menu.bkgdColor = e; \
+		menu.color1 = f; \
+		menu.color2 = g; \
+		menu.menuNameString = h; \
+		menu.textColor = i; \
+		menu.titleX = j; \
+		menu.titleY = k; \
+		menu.highlightedItem = l; \
+		menu.numberOfItems = m; \
+		menu.scrollUpButtonX = n; \
+		menu.scrollUpButtonY = o; \
+		menu.scrollDownButtonX = p; \
+		menu.scrollDownButtonY = q; \
+	} while (0)
 
 #define GUI_V1_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) \
-	item.enabled = a; \
-	item.itemString = d; \
-	item.x = e; \
-	item.y = g; \
-	item.width = h; \
-	item.height = i; \
-	item.textColor = j; \
-	item.highlightColor = k; \
-	item.titleX = l; \
-	item.bkgdColor = n; \
-	item.color1 = o; \
-	item.color2 = p; \
-	item.saveSlot = q; \
-	item.labelString = r; \
-	item.labelX = s; \
-	item.labelY = t; \
-	item.unk1F = v
+	do { \
+		item.enabled = a; \
+		item.itemString = d; \
+		item.x = e; \
+		item.y = g; \
+		item.width = h; \
+		item.height = i; \
+		item.textColor = j; \
+		item.highlightColor = k; \
+		item.titleX = l; \
+		item.bkgdColor = n; \
+		item.color1 = o; \
+		item.color2 = p; \
+		item.saveSlot = q; \
+		item.labelString = r; \
+		item.labelX = s; \
+		item.labelY = t; \
+		item.unk1F = v; \
+	} while (0)
 
 class KyraEngine_LoK;
 

Modified: scummvm/trunk/engines/kyra/gui_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.h	2008-05-12 04:29:41 UTC (rev 32048)
+++ scummvm/trunk/engines/kyra/gui_v2.h	2008-05-12 04:33:30 UTC (rev 32049)
@@ -31,66 +31,72 @@
 namespace Kyra {
 
 #define GUI_V2_BUTTON(button, a, b, c, d, e, f, h, i, j, k, l, m, n, o, p, q, r, s, t) \
-	button.nextButton = 0; \
-	button.index = a; \
-	button.unk6 = b; \
-	button.unk8 = c; \
-	button.data0Val1 = d; \
-	button.data1Val1 = e; \
-	button.data2Val1 = f; \
-	button.flags = h; \
-	button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
-	button.dimTableIndex = i; \
-	button.x = j; \
-	button.y = k; \
-	button.width = l; \
-	button.height = m; \
-	button.data0Val2 = n; \
-	button.data0Val3 = o; \
-	button.data1Val2 = p; \
-	button.data1Val3 = q; \
-	button.data2Val2 = r; \
-	button.data2Val3 = s; \
-	button.flags2 = t; \
-	button.mouseWheel = 0
+	do { \
+		button.nextButton = 0; \
+		button.index = a; \
+		button.unk6 = b; \
+		button.unk8 = c; \
+		button.data0Val1 = d; \
+		button.data1Val1 = e; \
+		button.data2Val1 = f; \
+		button.flags = h; \
+		button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
+		button.dimTableIndex = i; \
+		button.x = j; \
+		button.y = k; \
+		button.width = l; \
+		button.height = m; \
+		button.data0Val2 = n; \
+		button.data0Val3 = o; \
+		button.data1Val2 = p; \
+		button.data1Val3 = q; \
+		button.data2Val2 = r; \
+		button.data2Val3 = s; \
+		button.flags2 = t; \
+		button.mouseWheel = 0; \
+	} while (0)
 
 #define GUI_V2_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
-	menu.x = a; \
-	menu.y = b; \
-	menu.width = c; \
-	menu.height = d; \
-	menu.bkgdColor = e; \
-	menu.color1 = f; \
-	menu.color2 = g; \
-	menu.menuNameId = h; \
-	menu.textColor = i; \
-	menu.titleX = j; \
-	menu.titleY = k; \
-	menu.highlightedItem = l; \
-	menu.numberOfItems = m; \
-	menu.scrollUpButtonX = n; \
-	menu.scrollUpButtonY = o; \
-	menu.scrollDownButtonX = p; \
-	menu.scrollDownButtonY = q
+	do { \
+		menu.x = a; \
+		menu.y = b; \
+		menu.width = c; \
+		menu.height = d; \
+		menu.bkgdColor = e; \
+		menu.color1 = f; \
+		menu.color2 = g; \
+		menu.menuNameId = h; \
+		menu.textColor = i; \
+		menu.titleX = j; \
+		menu.titleY = k; \
+		menu.highlightedItem = l; \
+		menu.numberOfItems = m; \
+		menu.scrollUpButtonX = n; \
+		menu.scrollUpButtonY = o; \
+		menu.scrollDownButtonX = p; \
+		menu.scrollDownButtonY = q; \
+	 } while (0)
 
 #define GUI_V2_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
-	item.enabled = a; \
-	item.itemId = b; \
-	item.x = c; \
-	item.y = d; \
-	item.width = e; \
-	item.height = f; \
-	item.textColor = g; \
-	item.highlightColor = h; \
-	item.titleX = i; \
-	item.bkgdColor = j; \
-	item.color1 = k; \
-	item.color2 = l; \
-	item.saveSlot = m; \
-	item.labelId = n; \
-	item.labelX = o; \
-	item.labelY = p; \
-	item.unk1F = q
+	do { \
+		item.enabled = a; \
+		item.itemId = b; \
+		item.x = c; \
+		item.y = d; \
+		item.width = e; \
+		item.height = f; \
+		item.textColor = g; \
+		item.highlightColor = h; \
+		item.titleX = i; \
+		item.bkgdColor = j; \
+		item.color1 = k; \
+		item.color2 = l; \
+		item.saveSlot = m; \
+		item.labelId = n; \
+		item.labelX = o; \
+		item.labelY = p; \
+		item.unk1F = q; \
+	} while (0)
 
 class KyraEngine_v2;
 class Screen_v2;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list