From 8226134f67b661d0a9ffa4b98e08af0702df34ea Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 16 Apr 2016 17:13:00 -0400 Subject: [PATCH] Make can_trade() return true if at least one caravan can trade Fixes #900 --- NEWS.rst | 1 + plugins/uicommon.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 9a5b0c40b..23a16f325 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -84,6 +84,7 @@ Fixes - More plugins should recognize non-dwarf citizens - Fixed a possible crash from cloning jobs - moveToBuilding() now sets flags for items that aren't a structural part of the building properly +- `autotrade`, `stocks`: Made trading work when multiple caravans are present but only some can trade - `confirm` note-delete: No longer interferes with name entry - `exportlegends`: Handles entities without specific races, and a few other fixes for things new to v0.42 - `fastdwarf`: Fixed a bug involving teleporting mothers but not the babies they're holding. diff --git a/plugins/uicommon.h b/plugins/uicommon.h index c2bb7d464..347ef5dbf 100644 --- a/plugins/uicommon.h +++ b/plugins/uicommon.h @@ -263,11 +263,11 @@ static bool can_trade() auto caravan = *it; auto trade_state = caravan->trade_state; auto time_remaining = caravan->time_remaining; - if ((trade_state != state::Approaching && trade_state != state::AtDepot) || time_remaining == 0) - return false; + if ((trade_state == state::Approaching || trade_state == state::AtDepot) && time_remaining != 0) + return true; } - return true; + return false; } static bool is_metal_item(df::item *item)