From 65e41486f478dae996459e8e8b834be8c9b1e6a9 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 12 May 2008 04:33:30 +0000 Subject: 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... svn-id: r32049 --- engines/kyra/gui_lok.h | 104 +++++++++++++++++++++++-------------------- engines/kyra/gui_v2.h | 118 ++++++++++++++++++++++++++----------------------- 2 files changed, 117 insertions(+), 105 deletions(-) diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h index aa3bcdcc7f..607ef0b605 100644 --- a/engines/kyra/gui_lok.h +++ b/engines/kyra/gui_lok.h @@ -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; diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index 378a3cd815..161752627b 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -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; -- cgit v1.2.3