Einige Kommentare ergaenzt/entfernt
Change-Id: I34a458f36e806a5a0da64006b8e98f5db69f7ebb
diff --git a/std/thing/properties.c b/std/thing/properties.c
index c372427..25d601c 100644
--- a/std/thing/properties.c
+++ b/std/thing/properties.c
@@ -24,9 +24,16 @@
// the mapping where the actual properties are stored. Direct initialization.
+// Indexed with F_VALUE, F_MODE, F_SET_METHOD and F_QUERY_METHOD
+// F_MODE, F_SET_METHOD and F_QUERY_METHOD are usually 'sparse' (i.e. there is
+// no entry for most properties), therefore it is more memory-efficient to
+// store them like this than in one mapping, although it requires more
+// mapping lookups.
private nosave mapping *prop = ({ ([]), ([]), ([]), ([]) });
-// the mapping that is used for saving
+// the mapping that is used for saving. During save_object/restore_object it
+// contains the properties with SAVE flag.
+// This is empty outside of a save_object() or restore_object() call!
private mapping properties;
// security-flag
@@ -171,8 +178,6 @@
}
// _set_*-Methode vorhanden? falls ja, aufrufen.i
- // TODO: Closurecache einfuehren und Funktionaufruf nur noch machen, wenn es
- // die _set_* auch gibt?
if (call_resolved(&result,this_object(),"_set_"+name,Value ))
return result;
@@ -220,7 +225,6 @@
}
// _query_*-Methode vorhanden? falls ja, aufrufen.
- // TODO: Closurecache und nur rufen, wenn es _query_* auch gibt?
if (call_resolved(&result,this_object(),"_query_"+name))
return result;
@@ -229,7 +233,10 @@
}
-// Das gesamte Property-Mapping auf einen Schlag setzen
+// Viele Properties auf einen Schlag setzen.
+// genutzt von simul_efun zum Setzen aller Properties, welche im
+// restore_object() eingelesen wurden.
+// Andere objekt-externe Nutzung ausdruecklich **NICHT** supportet!
public void SetProperties( mapping props )
{
string *names;
@@ -274,6 +281,9 @@
// Ein Mapping mit allen Properties zurueckgeben
+// genutzt von simul_efun im save_object() zur Abfrage aller Properties, um
+// hieraus die gespeicherten zu bestimmen.
+// Andere objekt-externe Nutzung ausdruecklich **NICHT** supportet!
public mapping QueryProperties()
{
mapping props;
@@ -306,9 +316,16 @@
// mapping Properties setzen zum Speichern (per save_object())
-// Aufruf nur aus simul_efun heraus
+// Aufruf nur aus simul_efun heraus (sinnvoll). Diese fragt alle Properties
+// via QueryProperties() ab, filtert alle nicht-gespeicherten Properties aus
+// und setzt ueber diese Funktion die gespeicherten in der tatsaechlich von
+// save_object() gespeicherten Variable <properties>.
public void _set_save_data(mixed data) { properties = data; }
// mapping Properties zum Restoren zurueckgeben
+// Aufruf nur aus simul_efun heraus (sinnvoll). Diese ruft nach dem
+// restore_object die restaurierten Properties hiermit ab und schreibt sie
+// nach Konditionierung via SetProperties() zurueck, damit die Daten (wieder)
+// in <prop> zur Verfuegung steheh.
public mixed _get_save_data() { return properties; }
diff --git a/sys/thing/properties.h b/sys/thing/properties.h
index e34c79e..9feed60 100644
--- a/sys/thing/properties.h
+++ b/sys/thing/properties.h
@@ -7,23 +7,30 @@
#ifndef __THING_PROPERTIES_H__
#define __THING_PROPERTIES_H__
-// special defines
-
+// Flags indexing <prop> and they are used as well for Set() calls
#define F_VALUE 0
#define F_MODE 1
#define F_SET_METHOD 2
#define F_QUERY_METHOD 3
+
+// Flags for Set() to modify/manipulate F_MODE of a property in bit-wise
+// manner
#define F_MODE_AS 4
#define F_MODE_AD 5
+// mode flags for Properties
#define SAVE 64
#define PROTECTED 128 // only this_object() can change the values
#define SECURED 256 // like PROTECTED, but never resetable
#define NOSETMETHOD 512 // Keine Set-Methode => Nicht mofifizierbar
-#define SETMNOTFOUND 1024 // Keine Set-Methode gefunden
-#define QUERYMNOTFOUND 2048 // Keine Query-Methode gefunden
-#define QUERYCACHED 4096
-#define SETCACHED 8192
+// Problem with the following: shadows, default methods etc. may change the
+// result at runtime and they do not save that much time (or even at all?)
+// because of the apply cache of the driver. Not used since 1995. But
+// be careful about re-using the values because of ancient (!) savefiles
+#define SETMNOTFOUND 1024 // Keine Set-Methode gefunden. Not used.
+#define QUERYMNOTFOUND 2048 // Keine Query-Methode gefunden. Not used.
+#define QUERYCACHED 4096 // Not used anymore
+#define SETCACHED 8192 // Not used anymore
#endif // __THING_PROPERTIES_H__
@@ -34,10 +41,6 @@
// prototypes
-// (E)UID-Methods
-//static mixed _query_uid();
-//static mixed _query_euid();
-
// direct property access
public varargs mixed Set(string name, mixed Value, int Type, int extern);
public varargs mixed Query(string name, int Type);