Skip to content

Commit 7cb24fd

Browse files
committed
Added an error log message that catches the case where the zone
range for an object update is too big, ie: the object spans more than two zones in any direction. I have ideas for maybe fixing it so that any range is allowed but until then we should provide an indication that the grid setup is bad.
1 parent 1be91f9 commit 7cb24fd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

release-notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Version 1.3.1 (unreleased)
99
* Added a thread-safe BufferedHashSet for creating "one writer, many readers"
1010
fast thread safe hash sets.
1111
* Added a double-buffered thread safe active IDs set to the NetworkStateListener.
12+
* Added an error log message when updating an object with a bounds bigger than
13+
supported by the current grid settings.
1214

1315

1416
Version 1.3.0 (latest)

src/main/java/com/simsilica/ethereal/zone/ZoneManager.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,18 @@ public void updateEntity( Long id, boolean active, Vec3d p, Quatd orientation, A
275275

276276
ZoneRange info = getZoneRange(id, true);
277277
if( !minZone.equals(info.min) || !maxZone.equals(info.max) ) {
278+
279+
// Check the range to see if it's too large... this indicates that
280+
// the bounds is too big for the grid spacing.
281+
if( maxZone.x - minZone.x > 1
282+
|| maxZone.y - minZone.y > 1
283+
|| maxZone.z - minZone.z > 1 ) {
284+
log.error("Object:" + id + " Range too big:" + minZone + " -> " + maxZone
285+
+ " from bounds:" + bounds
286+
+ " grid size:" + grid.getZoneSize()
287+
+ " likely too small for object with extents:" + bounds.getExtents());
288+
}
289+
278290
info.setRange(minZone, maxZone);
279291
}
280292

@@ -604,7 +616,7 @@ public void sendNoChange() {
604616

605617
public void setRange( Vec3i newMin, Vec3i newMax ) {
606618
ZoneKey[] oldKeys = keys.clone();
607-
619+
608620
// We could avoid recreating keys if they are already
609621
// set but the logic is tricky to get right and it's
610622
// not called very often anyway.

0 commit comments

Comments
 (0)