F_MODE_*: changed values

The F_MODE_AS and F_MODE_AD flags do not index the <prop> array,
in contrast to the other F_* entries, but blocked the next
possible index in this array. Therefore changed the numbering to
negative numbers that will never index an array.
Also use a symbolic constant for the length of the array <props>
and use it to allocate it.

Change-Id: I71e487515ef9851c5f12bf899c285b7fb1da3a59
diff --git a/std/thing/properties.c b/std/thing/properties.c
index d289de1..b9b2372 100644
--- a/std/thing/properties.c
+++ b/std/thing/properties.c
@@ -25,12 +25,12 @@
 #include "/secure/wizlevels.h"
 
 // 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 = ({ ([]), ([]), ([]), ([]) });
+// Indexed with F_VALUE, F_MODE, F_SET_METHOD, F_QUERY_METHOD, F_VALIDATOR
+// F_MODE, F_SET_METHOD, F_QUERY_METHOD and F_VALIDATOR 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 = allocate(F_PROP_ENTRIES, ([]));
 
 // the mapping that is used for saving. During save_object/restore_object it
 // contains the properties with SAVE flag. 
@@ -319,7 +319,7 @@
     // nur vom Objekt selber manipuliert werden
     if (same_object||!(prop[F_MODE][names[j]] & (PROTECTED|SECURED)) )
     {
-      i=4;
+      i=F_PROP_ENTRIES;
       while(i--)
       {
         if(props[names[j],i])
@@ -343,11 +343,11 @@
   int i, j;
   string *names;
 
-  props = m_allocate( 0, 4 );
+  props = m_allocate( sizeof(prop[F_VALUE]), F_PROP_ENTRIES );
   
   if (pointerp(prop))
   {
-    i=4;
+    i=F_PROP_ENTRIES;
     while(i--)
     {
       names = m_indices(prop[i]);
@@ -364,7 +364,7 @@
   if ( pointerp(prop) )
     return(deep_copy(prop));
   else
-    return ({ ([]),([]),([]),([]) });
+    return allocate(F_PROP_ENTRIES, ([]));
 }
 
 
diff --git a/sys/thing/properties.h b/sys/thing/properties.h
index be7a6cd..77ec0d0 100644
--- a/sys/thing/properties.h
+++ b/sys/thing/properties.h
@@ -7,11 +7,12 @@
 #ifndef __THING_PROPERTIES_H__
 #define __THING_PROPERTIES_H__
 
-// Flags indexing <prop> and they are used as well for Set() calls
+// Type 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
+#define F_PROP_ENTRIES  4 // how many entries in <prop> mapping?
 
 // The following are used as type flags for Set(), but they do not index
 // <prop>, therfore they have a negative sign.
@@ -20,11 +21,11 @@
 // automatically
 #define F_SET_MAPPER    -F_SET_METHOD
 // 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
+// manner (but are themselves not bitwise of course!).
+#define F_MODE_AS       -400
+#define F_MODE_AD       -500
 
-// mode flags for Properties
+// and from here the 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