From 4804b121d08421a245c8f7ac775d6378630f2134 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 30 Sep 2021 15:03:30 -0600 Subject: [PATCH] Remove archive argument from readComponent --- projects/nat-archive-tool/src/nat/Lib.kiss | 11 +++++------ .../nat-archive-tool/src/nat/systems/NameSystem.kiss | 2 +- .../src/nat/systems/WikipediaImageSystem.kiss | 2 +- .../source/EntrySprite.kiss | 6 +++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/projects/nat-archive-tool/src/nat/Lib.kiss b/projects/nat-archive-tool/src/nat/Lib.kiss index 2c3ddf1f..bd784f33 100644 --- a/projects/nat-archive-tool/src/nat/Lib.kiss +++ b/projects/nat-archive-tool/src/nat/Lib.kiss @@ -7,7 +7,7 @@ `(.exists .components ,e ,(symbolName componentType))) // Changes to the object returned by (readComponent) will not be saved! Use (withWritableComponents) for making changes -(defMacro readComponent [archive e componentType] +(defMacro readComponent [e componentType] `(let [componentData (dictGet (the Map .components ,e) ,(symbolName componentType))] (print (+ "reading " componentData " as " ,(symbolName componentType) " for " .id ,e)) (the nat.components ,componentType @@ -33,7 +33,7 @@ (symbol)] (doFor [name type] bindingPairs (bindingList.push `&mut ,name) - (bindingList.push `(readComponent ,archive ,e ,type)) + (bindingList.push `(readComponent ,e ,type)) (saveList.push `(dictSet .components ,e ,(symbolName type) (tink.Json.stringify (the nat.components ,type ,name))))) `(let [,@bindingList ,retValSymbol {,@body}] @@ -49,16 +49,15 @@ ,retValSymbol))) // Create a system that selects Entries according to a single string component (i.e. Name or Author) matching the given value -(defMacro stringComponentSystem [archive componentType value process] +(defMacro stringComponentSystem [componentType value process] `(new System (lambda [archive :nat.Entry e] ?(and (hasComponent e ,componentType) - (= ,value (readComponent ,archive e ,componentType)))) + (= ,value (readComponent e ,componentType)))) ,process)) (function tagList [archive e] - (let [t - (readComponent archive e Tags)] + (let [t (readComponent e Tags)] (collect (t.keys)))) (function tagsMatch [archive e tagsBoolExp] diff --git a/projects/nat-archive-tool/src/nat/systems/NameSystem.kiss b/projects/nat-archive-tool/src/nat/systems/NameSystem.kiss index 9e698470..e4d81b4b 100644 --- a/projects/nat-archive-tool/src/nat/systems/NameSystem.kiss +++ b/projects/nat-archive-tool/src/nat/systems/NameSystem.kiss @@ -6,7 +6,7 @@ (defNew [] (super ->[archive e] (hasComponent e Name) - ->[archive e] (let [name (readComponent archive e Name)] + ->[archive e] (let [name (readComponent e Name)] (if (entriesByName.exists (name.toLowerCase)) (.push (dictGet entriesByName (name.toLowerCase)) e) (dictSet entriesByName (name.toLowerCase) [e])) diff --git a/projects/nat-archive-tool/src/nat/systems/WikipediaImageSystem.kiss b/projects/nat-archive-tool/src/nat/systems/WikipediaImageSystem.kiss index ff079b86..e4f3708e 100644 --- a/projects/nat-archive-tool/src/nat/systems/WikipediaImageSystem.kiss +++ b/projects/nat-archive-tool/src/nat/systems/WikipediaImageSystem.kiss @@ -10,7 +10,7 @@ // named method in case a user will want to run it on selectedEntries instead of on media entries (method scrapeForImages [archive e] (let [:String title - (readComponent archive e Name) + (readComponent e Name) :Array wikipediaImageUrls (queryImageUrls (queryImageTitles [title]))] (addFiles archive e diff --git a/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss b/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss index 1ca517b4..04bd162b 100644 --- a/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss +++ b/projects/nat-flixel-desktop-playground/source/EntrySprite.kiss @@ -6,8 +6,8 @@ &prop :ArchiveController controller] [&mut :Bool selected false] - (let [images (readComponent archive e Images)] - (case (dictGet (readComponent archive e Positions) positionKey) + (let [images (readComponent e Images)] + (case (dictGet (readComponent e Positions) positionKey) ((object x x y y z z) (super x y))) (.onComplete (BitmapData.loadFromFile (joinPath archive.archiveDir "files" (nth images.imageFiles images.pinnedImageIndex))) @@ -15,7 +15,7 @@ (loadGraphic bitmapData) (updateColor) (when (hasComponent e Scale) - (let [:Float scale (readComponent archive e Scale)] + (let [:Float scale (readComponent e Scale)] (this.scale.set scale scale) (updateHitbox))) (enableMouseClicks false)