From 732fe6f4811cc082bf938fed2d28c1f9c8bbd1f6 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Tue, 15 Aug 2023 18:30:19 -0600 Subject: generate uuids for entities; scaffolding for a server --- engine/structures/QuadTree.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'engine/structures') diff --git a/engine/structures/QuadTree.ts b/engine/structures/QuadTree.ts index a57c6e7..49afdad 100644 --- a/engine/structures/QuadTree.ts +++ b/engine/structures/QuadTree.ts @@ -1,7 +1,7 @@ import type { Coord2D, Dimension2D } from "../interfaces"; interface BoxedEntry { - id: number; + id: string; dimension: Dimension2D; center: Coord2D; } @@ -72,8 +72,8 @@ export class QuadTree { } } - public getNeighborIds(boxedEntry: BoxedEntry): number[] { - const neighbors: number[] = this.objects.map(({ id }) => id); + public getNeighborIds(boxedEntry: BoxedEntry): string[] { + const neighbors: string[] = this.objects.map(({ id }) => id); if (this.hasChildren()) { this.getQuadrants(boxedEntry).forEach((quadrant) => { @@ -160,11 +160,7 @@ export class QuadTree { this.objects.forEach((boxedEntry) => { this.getQuadrants(boxedEntry).forEach((direction) => { const quadrant = this.children.get(direction); - quadrant?.insert( - boxedEntry.id, - boxedEntry.dimension, - boxedEntry.center, - ); + quadrant?.insert(boxedEntry); }); }); -- cgit v1.2.3-70-g09d2