From 490c4f11cfd1a8a7b99efa612a4c2e0fe6020d62 Mon Sep 17 00:00:00 2001 From: Griatch Date: Fri, 13 Nov 2020 20:59:49 +0100 Subject: [PATCH] Don't allow 3-box with only two boxes in room. Resolve #2206. --- CHANGELOG.md | 2 ++ evennia/objects/manager.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af47d8e7e9..d6ce8f5702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,8 @@ without arguments starts a full interactive Python console. - New EvMenu templating system for quickly building simpler EvMenus without as much code. - Add `Command.client_height()` method to match existing `.client_width` (stricako) - Include more Web-client info in `session.protocol_flags`. +- Fixes in multi-match situations - don't allow finding/listing multimatches for 3-box when + only two boxes in location. ## Evennia 0.9 (2018-2019) diff --git a/evennia/objects/manager.py b/evennia/objects/manager.py index 0a3dbc90fa..2286f784c5 100644 --- a/evennia/objects/manager.py +++ b/evennia/objects/manager.py @@ -471,7 +471,12 @@ class ObjectDBManager(TypedObjectManager): matches = _searcher(searchdata, candidates, typeclass, exact=exact) # deal with result - if len(matches) > 1 and match_number is not None: + if len(matches) == 1 and match_number is not None and match_number != 0: + # this indicates trying to get a single match with a match-number + # targeting some higher-number match (like 2-box when there is only + # one box in the room). This leads to a no-match. + matches = [] + elif len(matches) > 1 and match_number is not None: # multiple matches, but a number was given to separate them if 0 <= match_number < len(matches): # limit to one match