Dugy / Legend_of_the_Invincibles

An add-on campaign for the Battle for Wesnoth game
GNU General Public License v3.0
40 stars 22 forks source link

Item descriptions in loti.item.type[N].description are no longer populated #230

Closed edwardspec closed 5 years ago

edwardspec commented 5 years ago

To reproduce, type loti.item.type[100].description in Lua console.

Expected result: description of Cunctator's sword. Actual result: nil.

[describe_object] in GENERATE_ITEM_LIST macro (items.cfg) was calculating the descriptions (and saving them in item_list array), but after commit 56698d063b8ab470f1ec2d5d492e33006c84620e, item_list is no longer used and all descriptions in _reload() are nil.

Possible solution: store calculated descriptions in array, reuse this array in _reload().

Dugy commented 5 years ago

This was intentional. The items were mostly used without a need to have descriptions, so they were added by another function call in all cases when they were actually displayed. Furthermore, after the change, the items are not needed to be stored in a WML variable.

If didn't properly determine where they were needed and where not, please tell me about it.

edwardspec commented 5 years ago

WML variable does seem to be still used in some places in the code:

$ git grep -F '.description' | grep item_list
utils/global_events.cfg:$item_list.object[$k].description"
utils/global_events.cfg:$item_list.object[$k].description"
utils/global_events.cfg:$item_list.object[$k].description"
utils/global_events.cfg:$item_list.object[$k].description"}
utils/global_events.cfg:$item_list.object[$k].description"}
utils/items.cfg:        output=item_list.object[$item_number].description
utils/items.cfg:                                        message= _"$item_list.object[$item_number].description
utils/items.cfg:                                        message="$item_list.object[$item_number].description
utils/items.cfg:                                                value="$item_list.object[$item_number].description
utils/utils.cfg:                        {VARIABLE description $item_list.object[$j].description}

Exact impact (if any) is unknown. May be related to screenshot of https://github.com/Dugy/Legend_of_the_Invincibles/pull/225#issuecomment-451794435

edwardspec commented 5 years ago

1) Start Gladiators. 2) Equip any item. 3) There will be no description near "Remove item" option: no-description