Resolve component collision decission

This commit is contained in:
Christian Treffs 2019-02-14 14:59:27 +01:00
parent f7d2a5b3a2
commit 13dc68dc26
2 changed files with 2 additions and 5 deletions

View File

@ -28,11 +28,8 @@ public extension Nexus {
/// test if component is already assigned
guard !has(componentId: componentId, entityIdx: entityIdx) else {
// FIXME: this is still open to debate
// a) we replace the component
// b) we copy the properties
// c) we assert fail
report("ComponentAdd collision: \(entityIdx) already has a component \(component)")
assertionFailure("ComponentAdd collision: \(entityIdx) already has a component \(component)")
return
}

View File

@ -70,7 +70,7 @@ class NexusTests: XCTestCase {
let p0 = Position(x: 1, y: 2)
e0.assign(p0)
e0.assign(p0)
// component collision: e0.assign(p0)
XCTAssert(e0.hasComponents)
XCTAssert(e0.numComponents == 1)