diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2026-08-01 12:54:04 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2026-08-01 13:03:27 -0300 |
| commit | 3fd1bdbaaffc6582943e3c9b3c28c20976fcb2ad (patch) | |
| tree | 952057f030cfe71de2008d294181695facd8e5ee | |
| parent | db5050d5dbc0525d05837f728bea52f7954286cc (diff) | |
| download | game-3fd1bdbaaffc6582943e3c9b3c28c20976fcb2ad.tar.gz game-3fd1bdbaaffc6582943e3c9b3c28c20976fcb2ad.zip | |
I've also reverted the search range of `NotifyTrades` to
(12, 10), because it's just not related to `CloseContainer`.
It is called before objects are moved, and on the case the
object is split, it is called on the remaining part.
| -rw-r--r-- | src/operate.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/operate.cc b/src/operate.cc index 5e2c964..93cdeee 100644 --- a/src/operate.cc +++ b/src/operate.cc @@ -998,7 +998,7 @@ void NotifyTrades(Object Obj){ return; } - TFindCreatures Search(16, 14, Obj, FIND_PLAYERS); + TFindCreatures Search(12, 10, Obj, FIND_PLAYERS); while(true){ uint32 CharacterID = Search.getNext(); if(CharacterID == 0){ @@ -1065,7 +1065,18 @@ void CloseContainer(Object Con, bool Force){ return; } - TFindCreatures Search(16, 14, Con, FIND_PLAYERS); + // IMPORTANT(fusion): The original search range was (12, 10), but it caused + // containers to remain open when a player moved them beyond it. The new range + // is the sum of: + // (7, 7) - max Z offset + // (7, 5) - max terminal distance + // (6, 4) - max walk to object distance + // (2, 2) - max distance to another player close to the container + // Considering that `CMoveObject` does a visibility check to limit the "walk + // to object distance", this should be a permanent fix. It may not be the best + // solution, but I don't want to diverge too much from the original. See `Move` + // for a complementary comment about this. + TFindCreatures Search(22, 18, Con, FIND_PLAYERS); while(true){ uint32 CharacterID = Search.getNext(); if(CharacterID == 0){ @@ -1386,7 +1397,7 @@ void Move(uint32 CreatureID, Object Obj, Object Con, int Count, bool NoMerge, Ob NotifyDepot(CreatureID, Obj, CountObjects(Obj)); } - // NOTE(fusion): `CloseContainer` checks a small region around the object, + // IMPORTANT(fusion): `CloseContainer` checks a fixed region around the object, // related to the terminal width/height, so calling it once at the end should // be enough when the movement is done by a creature (CreatureID != 0). // The other case (when the movement is done by a script, spell, etc...) can |
