home · contact · privacy
Server: Check against setting map object id of 0 in config file reading.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 14 Apr 2014 04:09:12 +0000 (06:09 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 14 Apr 2014 04:09:12 +0000 (06:09 +0200)
README
src/server/configfile.c

diff --git a/README b/README
index 90fd601c82fc90052c4d9aa8b67182a6bcc170d1..2770f53c8d03cea998c9232f6f82b04975c47d35 100644 (file)
--- a/README
+++ b/README
@@ -111,12 +111,12 @@ NAME move
 EFFORT 5
 
 A line of "ACTION" followed by a number starts an action definition block and
-sets the action's id for internal use to 1. The number after "EFFORT" determines
-how many turns this action takes for the actor performing it. The string after
-"NAME" names the action. Furthermore, if it is one of "move", "pick_up", "drop"
-or "use", it matches internal functions described by these strings to this
-action. All other names (including "wait") currently are matched to a do-nothing
-wait function.
+sets the action's id (must be > 0) for internal use to 1. The number after
+"EFFORT" determines how many turns this action takes for the actor performing
+it. The string after "NAME" names the action. Furthermore, if it is one of
+"move", "pick_up", "drop" or "use", it matches internal functions described by
+these strings to this action. All other names (including "wait") currently are
+matched to a do-nothing wait function.
 
 Here's a typical map object type definition block: 
 
index aad3b7417e6f53823f91258dcd38759f5603d07a..537650246dd8e84e09e8d29b1ed71c5f06de89ed 100644 (file)
@@ -142,17 +142,21 @@ static void tokens_into_entries(char * token0, char * token1)
     if (token0)
     {
         parsetest_too_many_values();
-        if (!(   start_entry(token0, token1, str_act, &action_flags,
-                             sizeof(struct MapObjAct),(struct EntryHead**) &moa,
-                             (struct EntryHead *) world.map_obj_acts)
-              || start_entry(token0, token1, str_obj, &object_flags,
-                             sizeof(struct MapObjDef),(struct EntryHead**) &mod,
-                             (struct EntryHead *) world.map_obj_defs)
-              || start_map(token0, str_map, &map_flags)
-              || set_player_type(token0, str_player, token1)
-              || set_members(token0, token1, &object_flags, &action_flags,
-                              &map_flags, (struct MapObjDef *)mod,
-                              (struct MapObjAct *) moa)))
+        if (start_entry(token0, token1, str_act, &action_flags,
+                        sizeof(struct MapObjAct), (struct EntryHead**) &moa,
+                        (struct EntryHead *) world.map_obj_acts))
+        {
+            err_line(0 == atoi(token1), "Value must not be 0.");
+        }
+        else if (!(   start_entry(token0, token1, str_obj, &object_flags,
+                                  sizeof(struct MapObjDef),
+                                  (struct EntryHead**) &mod,
+                                  (struct EntryHead *) world.map_obj_defs)
+                   || start_map(token0, str_map, &map_flags)
+                   || set_player_type(token0, str_player, token1)
+                   || set_members(token0, token1, &object_flags, &action_flags,
+                                  &map_flags, (struct MapObjDef *)mod,
+                                  (struct MapObjAct *) moa)))
         {
             parse_unknown_arg();
         }
@@ -237,7 +241,7 @@ static void test_corpse_ids()
 
 
 
-static uint8_t set_map_members(char * token0, char * token1, uint8_t * map_flags)
+static uint8_t set_map_members(char * token0, char * token1,uint8_t * map_flags)
 {
     if      (   parse_val(token0, token1, "HEIGHT", map_flags,
                           HEIGHT_SET, 'i', (char *) &world.map.size.y)