Project

General

Profile

Bug #1961 » freeciv-3.2.3-widget_id-truncation.patch

Matt Jolly, 03/09/2026 07:13 AM

View differences:

client/gui-sdl2/widget.c
Widget.
**************************************************************************/
struct widget *get_widget_pointer_from_id(const struct widget *gui_list,
Uint16 id, enum scan_direction direction)
widget_id id, enum scan_direction direction)
{
if (direction == SCAN_FORWARD) {
while (gui_list) {
......
Find ID in MAIN widgets list ( begin_widget_list ) and return pointer to
this Widgets.
**************************************************************************/
struct widget *get_widget_pointer_from_main_list(Uint16 id)
struct widget *get_widget_pointer_from_main_list(widget_id id)
{
return get_widget_pointer_from_id(begin_main_widget_list, id, SCAN_FORWARD);
}
client/gui-sdl2/widget.h
struct widget *find_next_widget_for_key(struct widget *start_widget, SDL_Keysym key);
struct widget *get_widget_pointer_from_id(const struct widget *gui_list,
Uint16 id,
widget_id id,
enum scan_direction direction);
struct widget *get_widget_pointer_from_main_list(Uint16 id);
struct widget *get_widget_pointer_from_main_list(widget_id id);
#define set_action(id, action_callback) \
get_widget_pointer_from_main_list(id)->action = action_callback
client/gui-sdl3/widget.c
Widget.
**************************************************************************/
struct widget *get_widget_pointer_from_id(const struct widget *gui_list,
Uint16 id, enum scan_direction direction)
widget_id id, enum scan_direction direction)
{
if (direction == SCAN_FORWARD) {
while (gui_list) {
......
Find ID in MAIN widgets list ( begin_widget_list ) and return pointer to
this Widgets.
**************************************************************************/
struct widget *get_widget_pointer_from_main_list(Uint16 id)
struct widget *get_widget_pointer_from_main_list(widget_id id)
{
return get_widget_pointer_from_id(begin_main_widget_list, id, SCAN_FORWARD);
}
client/gui-sdl3/widget.h
struct widget *find_next_widget_for_key(struct widget *start_widget, SDL_KeyboardEvent *key);
struct widget *get_widget_pointer_from_id(const struct widget *gui_list,
Uint16 id,
widget_id id,
enum scan_direction direction);
struct widget *get_widget_pointer_from_main_list(Uint16 id);
struct widget *get_widget_pointer_from_main_list(widget_id id);
#define set_action(id, action_callback) \
get_widget_pointer_from_main_list(id)->action = action_callback
(2-2/2)