From: <geo...@us...> - 2014-06-23 19:50:30
|
Revision: 7189 http://sourceforge.net/p/freeorion/code/7189 Author: geoffthemedio Date: 2014-06-23 19:50:26 +0000 (Mon, 23 Jun 2014) Log Message: ----------- Added special case to Enqueued condition evaluation, so that if no low or high range limits are specified, it defaults to a low = 1. Previously, it would default to low = 0 whenever no low was specified, meaning if no low or high are specified, it matches locations regardless of whether anything is enqueued there. This is counter-intuitive, as I'd expect an Enqueued condition with no ranges specified to match places that have any number (ie. low = 1) items of the specified type enqueued. Modified Paths: -------------- trunk/FreeOrion/universe/Condition.cpp Modified: trunk/FreeOrion/universe/Condition.cpp =================================================================== --- trunk/FreeOrion/universe/Condition.cpp 2014-06-23 18:06:00 UTC (rev 7188) +++ trunk/FreeOrion/universe/Condition.cpp 2014-06-23 19:50:26 UTC (rev 7189) @@ -3593,6 +3593,14 @@ int empire_id = (m_empire_id ? m_empire_id->Eval(parent_context) : ALL_EMPIRES); int low = (m_low ? m_low->Eval(parent_context) : 0); int high = (m_high ? m_high->Eval(parent_context) : INT_MAX); + // special case: if neither low nor high is specified, default to a + // minimum of 1, so that just matching "Enqueued (type) (name/id)" will + // match places where at least one of the specified item is enqueued. + // if a max or other minimum are specified, then default to 0 low, so + // that just specifying a max will include anything below that max, + // including 0. + if (!m_low && !m_high) + low = 1; EvalImpl(matches, non_matches, search_domain, EnqueuedSimpleMatch(m_build_type, m_name, design_id, empire_id, low, high)); |