InteractionMenu: fix script error when custom entry extra_data contains something different from a proplist

The check was only meant for inventory menus (where extra_data always is a proplist); it was not in the right if-clause below, though.
alut-include-path
David Dormagen 2017-05-02 19:11:11 +02:00
parent 34f736081c
commit 0d32d924dc
1 changed files with 29 additions and 23 deletions

View File

@ -820,6 +820,11 @@ func OnMenuEntryHover(proplist menu_info, int entry_index, int player)
if (!info.menu.callback_target || !info.menu.callback_hover)
{
var text = Format("%s:|%s", info.entry.symbol->GetName(), info.entry.symbol.Description);
// For contents menus, we can sometimes present additional information about objects.
if (info.menu.flag == InteractionMenu_Contents)
{
// Get the first valid object of the clicked stack.
var obj = nil;
if (info.entry.extra_data && info.entry.extra_data.objects)
{
@ -830,8 +835,8 @@ func OnMenuEntryHover(proplist menu_info, int entry_index, int player)
break;
}
}
// For contents menus, we can sometimes present additional information about objects.
if (info.menu.flag == InteractionMenu_Contents && obj)
// ..and use that object to fetch some more information.
if (obj)
{
var additional = nil;
if (obj->Contents())
@ -850,6 +855,7 @@ func OnMenuEntryHover(proplist menu_info, int entry_index, int player)
if (additional != nil)
text = Format("%s||%s", text, additional);
}
}
GuiUpdateText(text, current_main_menu_id, 1, current_description_box.desc_target);
}