aboutsummaryrefslogtreecommitdiff
path: root/src/operate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/operate.cc')
-rw-r--r--src/operate.cc17
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