aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/menubar.cpp13
-rw-r--r--engines/sci/gfx/menubar.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp
index a9e14bf55e..83067eeac7 100644
--- a/engines/sci/gfx/menubar.cpp
+++ b/engines/sci/gfx/menubar.cpp
@@ -53,10 +53,8 @@ void menubar_free(menubar_t *menubar) {
int j;
for (j = 0; j < menu->items_nr; j++) {
- if (menu->items[j].keytext)
- free(menu->items[j].keytext);
- if (menu->items[j].text)
- free(menu->items[j].text);
+ free(menu->items[j].keytext);
+ free(menu->items[j].text);
}
free(menu->items);
@@ -106,7 +104,8 @@ int _menubar_add_menu_item(gfx_state_t *state, menu_t *menu, int type, char *lef
if (right) {
gfxop_get_text_params(state, font, right, SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
- total_left_size = MENU_BOX_CENTER_PADDING + (item->keytext_size = width);
+ item->keytext_size = width;
+ total_left_size = MENU_BOX_CENTER_PADDING + width;
}
item->enabled = 1;
@@ -323,8 +322,8 @@ int menubar_set_attribute(EngineState *s, int menu_nr, int item_nr, int attribut
break;
case MENU_ATTRIBUTE_KEY:
- if (item->keytext)
- free(item->keytext);
+ free(item->keytext);
+ item->keytext = 0;
if (value.segment) {
diff --git a/engines/sci/gfx/menubar.h b/engines/sci/gfx/menubar.h
index 2ccd6f8a5e..124344e539 100644
--- a/engines/sci/gfx/menubar.h
+++ b/engines/sci/gfx/menubar.h
@@ -88,7 +88,7 @@ struct EngineState;
struct menu_item_t {
int type; /* Normal or hbar */
char *keytext; /* right-centered part of the text (the key) */
- int keytext_size; /* Width of the right-centered text */
+ int keytext_size; // FIXME: Essentially unused
int flags;
byte said[MENU_SAID_SPEC_SIZE]; /* Said spec for this item */