more careful entry saving

This commit is contained in:
2021-08-02 20:30:37 -06:00
parent b6f07afb7d
commit 5c1839e35c
2 changed files with 3 additions and 3 deletions

View File

@@ -186,5 +186,5 @@
files (VarText null)] files (VarText null)]
(doFor e entries (doFor e entries
(doFor file files (doFor file files
(withWritableEntry archive e (addFile archive e file)))) (addFile archive e file)))
entries)) entries))

View File

@@ -26,10 +26,10 @@
// TODO check not overwriting a component // TODO check not overwriting a component
(defMacro addComponent [archive e componentType c] (defMacro addComponent [archive e componentType c]
`(let [componentId (Uuid.v4)] `(withWritableEntry ,archive ,e (let [componentId (uuid.Uuid.v4)]
(dictSet .components ,e ,(symbolName componentType) componentId) (dictSet .components ,e ,(symbolName componentType) componentId)
(writeComponent ,archive ,e ,componentType ,c) (writeComponent ,archive ,e ,componentType ,c)
,e)) ,e)))
// Retrieve multiple components from an Entity with mutable access. // Retrieve multiple components from an Entity with mutable access.
// All components will be serialized after the block is done. // All components will be serialized after the block is done.