← Back to team overview

widelands-dev team mailing list archive

Architecture question concerning ui_basic/ui_fsmenu

 

I am working on a new branch to handle keypresses. This let me to do
some refactoring on the return codes, to give them all names rather than
using plain numbers.

At the moment, I have 2 different types of named codes:

1. Two const int values in UI::Panel as generic codes (dying_code,
ok_code) [1]

2. An enum class in FullscreenMenuBase with Widelands-specific codes
(kTutorial, kSinglePlayer etc.) [2]

I think we should have one global enum class with all the return codes
in it, and use it as the argument/return type for Panel::run() and
Panel::end_modal(). This way, we could get rid of all plain numbers and
hodgepodge scattered enums permanently via type safety.

However, we want to keep ui_basic from being Widelands-specific. So,
where is the best way to put them?



[1]
https://bazaar.launchpad.net/~widelands-dev/widelands/bug-1480937/view/head:/src/ui_basic/panel.h#L91

[2]
https://bazaar.launchpad.net/~widelands-dev/widelands/bug-1480937/view/head:/src/ui_fsmenu/base.h#L43


Follow ups