diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-08-07 10:27:10 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-08-07 10:27:10 (EDT) |
commit | 362c6c4c8141345d060c573a92680128041b123a (patch) | |
tree | 17f3102ec1c60dbdbfa9e16113909d89919b5c4e /src | |
parent | 9b47e3b6a4680c6ed4c77903f6c56909405c1678 (diff) | |
download | mazefight-362c6c4c8141345d060c573a92680128041b123a.zip mazefight-362c6c4c8141345d060c573a92680128041b123a.tar.gz mazefight-362c6c4c8141345d060c573a92680128041b123a.tar.bz2 |
menu: Replace switch with array
Diffstat (limited to 'src')
-rw-r--r-- | src/menu.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -31,6 +31,8 @@ #include "tk.h" #include "util.h" +const int MF_MENU_SIZES_[] = {15, 20, 30}; + struct _mf_menu { long seed; int size; @@ -54,19 +56,8 @@ _mf_menu_size(void *user_data, int state) { struct _mf_menu *menu = (struct _mf_menu *) user_data; - switch (state) { - case 0: - menu->size = 15; - break; - case 1: - menu->size = 20; - break; - case 2: - menu->size = 30; - break; - default: - break; - } + menu->size = MF_MENU_SIZES_[state]; + return 0; } |