From fcfd73d0f73bfcbab17cc5e00a20db63c49ed424 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 9 Aug 2022 00:29:20 +0300 Subject: [PATCH 27/27] Check that cargo can actually load to transports shown at transportdlg See osdn #45331 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/transportdlg.c | 3 +-- client/gui-gtk-3.22/transportdlg.c | 3 +-- client/gui-gtk-4.0/transportdlg.c | 3 +-- client/gui-qt/dialogs.cpp | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/client/gui-gtk-3.0/transportdlg.c b/client/gui-gtk-3.0/transportdlg.c index f64247e790..919ac8184c 100644 --- a/client/gui-gtk-3.0/transportdlg.c +++ b/client/gui-gtk-3.0/transportdlg.c @@ -86,8 +86,7 @@ bool request_transport(struct unit *cargo, struct tile *ptile) struct unit *best_transport = transporter_for_unit_at(cargo, ptile); unit_list_iterate(ptile->units, ptransport) { - if (can_unit_transport(ptransport, cargo) - && get_transporter_occupancy(ptransport) < get_transporter_capacity(ptransport)) { + if (could_unit_load(cargo, ptransport)) { unit_list_append(potential_transports, ptransport); } } unit_list_iterate_end; diff --git a/client/gui-gtk-3.22/transportdlg.c b/client/gui-gtk-3.22/transportdlg.c index dcb9ed6c23..dfefd396e7 100644 --- a/client/gui-gtk-3.22/transportdlg.c +++ b/client/gui-gtk-3.22/transportdlg.c @@ -86,8 +86,7 @@ bool request_transport(struct unit *cargo, struct tile *ptile) struct unit *best_transport = transporter_for_unit_at(cargo, ptile); unit_list_iterate(ptile->units, ptransport) { - if (can_unit_transport(ptransport, cargo) - && get_transporter_occupancy(ptransport) < get_transporter_capacity(ptransport)) { + if (could_unit_load(cargo, ptransport)) { unit_list_append(potential_transports, ptransport); } } unit_list_iterate_end; diff --git a/client/gui-gtk-4.0/transportdlg.c b/client/gui-gtk-4.0/transportdlg.c index 62c8bb59ef..ec81a32449 100644 --- a/client/gui-gtk-4.0/transportdlg.c +++ b/client/gui-gtk-4.0/transportdlg.c @@ -86,8 +86,7 @@ bool request_transport(struct unit *cargo, struct tile *ptile) struct unit *best_transport = transporter_for_unit_at(cargo, ptile); unit_list_iterate(ptile->units, ptransport) { - if (can_unit_transport(ptransport, cargo) - && get_transporter_occupancy(ptransport) < get_transporter_capacity(ptransport)) { + if (could_unit_load(cargo, ptransport)) { unit_list_append(potential_transports, ptransport); } } unit_list_iterate_end; diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp index a244774f16..a978537958 100644 --- a/client/gui-qt/dialogs.cpp +++ b/client/gui-qt/dialogs.cpp @@ -4729,8 +4729,7 @@ bool qtg_request_transport(struct unit *pcargo, struct tile *ptile) #endif unit_list_iterate(ptile->units, ptransport) { - if (can_unit_transport(ptransport, pcargo) - && get_transporter_occupancy(ptransport) < get_transporter_capacity(ptransport)) { + if (could_unit_load(pcargo, ptransport)) { unit_list_append(potential_transports, ptransport); } } unit_list_iterate_end; -- 2.35.1