Skip to content

Commit

Permalink
refactor(ecs): fix #179, update MemMappedComponent.get()
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Feb 10, 2020
1 parent 89f6c36 commit 8ee2139
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/ecs/src/components/mem-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,7 @@ export class MemMappedComponent<K extends string> extends AComponent<

get(id: number) {
let i = this.sparse[id];
return i < this.n && this.dense[i] === id
? this.cache
? this.cache.getSet(i, () => {
i *= this.stride;
return this.vals.subarray(i, i + this.size);
})
: ((i *= this.stride), this.vals.subarray(i, i + this.size))
: undefined;
return this.dense[i] === id ? this.getIndex(i) : undefined;
}

getIndex(i: number) {
Expand Down

0 comments on commit 8ee2139

Please sign in to comment.