wesnoth icon indicating copy to clipboard operation
wesnoth copied to clipboard

"Fake Shroud" terrain type is displayed when you mouse over a unit's MP in the pop up list of terrains and the different costs for each terrain type

Open BenIsOnline opened this issue 9 months ago • 3 comments

Game and System Information

  • Version: 1.18.1
  • OS: Windows 11

Description of the bug

"Fake Shroud" terrain type is displayed when you mouse over a unit's MP in the pop up list of terrains and the different costs for each terrain type

Steps to reproduce the behavior

  1. Start a game
  2. Mouse over the MP for the current selected unit in the right info panel

Image

Expected behavior

The "Fake Shroud" terrain type isn't included as no unit can enter a hex of this type

Additional context

No response

BenIsOnline avatar Mar 20 '25 03:03 BenIsOnline

The gathering of the terrain types seems to be done in unit_moves(): https://github.com/wesnoth/wesnoth/blob/a46bae0f807ec788431e348990a75f79c54f7ced/src/reports.cpp#L678-L688

(Note this function is largely duplicated in get_mp_tooltip(), which makes me think the common parts should be factored out.) https://github.com/wesnoth/wesnoth/blob/a46bae0f807ec788431e348990a75f79c54f7ced/src/gui/widgets/unit_preview_pane.cpp#L160-L170

(On top of that, the pattern for excluding certain terrain types is also repeated in the help generator, and possibly elsewhere.) https://github.com/wesnoth/wesnoth/blob/a46bae0f807ec788431e348990a75f79c54f7ced/src/help/help_topic_generators.cpp#L830-L832

My guess is that VOID_TERRAIN should include the 'fake shroud' type as well, but it does not. https://github.com/wesnoth/wesnoth/blob/a46bae0f807ec788431e348990a75f79c54f7ced/src/terrain/translation.cpp#L121-L126

Confusingly, I see these comments around VOID_TERRAIN: https://github.com/wesnoth/wesnoth/blob/a46bae0f807ec788431e348990a75f79c54f7ced/src/terrain/terrain.hpp#L122-L127

Wedge009 avatar Mar 21 '25 22:03 Wedge009

hide_if_impassable should be respected as in help and all the duplicated logic should be extracted into a function.

soliton- avatar Mar 21 '25 22:03 soliton-

This issue goes back to at least 1.16, but only if ^_s (fake shroud) is present in the encountered_terrain_list of the user's preferences file. So perhaps there was a situation at some point where the fake shroud was included in the encountered terrains list but it shouldn't have been?

Wedge009 avatar Mar 22 '25 01:03 Wedge009