Project

General

Profile

Bug #2192 ยป 0066-sdl-Fix-crash-when-ruleset-does-not-have-roads-for-a.patch

Marko Lindqvist, 08/31/2026 05:24 AM

View differences:

client/gui-sdl2/menu.c
{
struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
bool road_conn_possible;
if (proad != NULL) {
struct extra_type *tgt;
tgt = road_extra_get(proad);
road_conn_possible = can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt);
} else {
road_conn_possible = FALSE;
}
if (road_conn_possible) {
local_show(ID_UNIT_ORDER_CONNECT_ROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_ROAD);
if (can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt)) {
local_show(ID_UNIT_ORDER_CONNECT_ROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_ROAD);
}
}
}
{
struct road_type *proad = road_by_gui_type(ROAD_GUI_RAILROAD);
bool road_conn_possible;
if (proad != NULL) {
struct extra_type *tgt;
tgt = road_extra_get(proad);
road_conn_possible = can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt);
} else {
road_conn_possible = FALSE;
}
if (road_conn_possible) {
local_show(ID_UNIT_ORDER_CONNECT_RAILROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_RAILROAD);
if (can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt)) {
local_show(ID_UNIT_ORDER_CONNECT_RAILROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_RAILROAD);
}
}
}
client/gui-sdl3/menu.c
{
struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
bool road_conn_possible;
if (proad != NULL) {
struct extra_type *tgt;
tgt = road_extra_get(proad);
road_conn_possible = can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt);
} else {
road_conn_possible = FALSE;
}
if (road_conn_possible) {
local_show(ID_UNIT_ORDER_CONNECT_ROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_ROAD);
if (can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt)) {
local_show(ID_UNIT_ORDER_CONNECT_ROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_ROAD);
}
}
}
{
struct road_type *proad = road_by_gui_type(ROAD_GUI_RAILROAD);
bool road_conn_possible;
if (proad != NULL) {
struct extra_type *tgt;
tgt = road_extra_get(proad);
road_conn_possible = can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt);
} else {
road_conn_possible = FALSE;
}
if (road_conn_possible) {
local_show(ID_UNIT_ORDER_CONNECT_RAILROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_RAILROAD);
if (can_unit_do_connect(punit, ACTIVITY_GEN_ROAD, tgt)) {
local_show(ID_UNIT_ORDER_CONNECT_RAILROAD);
} else {
local_hide(ID_UNIT_ORDER_CONNECT_RAILROAD);
}
}
}
    (1-1/1)