Rename 'stringify' to 'uid' where it pertains to unique action IDs.
[enjoyable.git] / Config.m
index f62c40f..727b8b0 100644 (file)
--- a/Config.m
+++ b/Config.m
@@ -7,7 +7,9 @@
 
 #import "Config.h"
 
-@implementation Config
+@implementation Config {
+    NSMutableDictionary *entries;
+}
 
 @synthesize protect, name, entries;
 
     return self;
 }
 
-- (void)setTarget:(Target *)target forAction:(JSAction *)jsa {
-    entries[[jsa stringify]] = target;
+- (Target *)objectForKeyedSubscript:(JSAction *)action {
+    return action ? entries[action.uid] : nil;
 }
 
-- (Target *)getTargetForAction:(JSAction *)jsa {
-    return entries[[jsa stringify]];
+- (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action {
+    if (action) {
+        if (target)
+            entries[action.uid] = target;
+        else
+            [entries removeObjectForKey:action.uid];
+    }
 }
 
 @end