RE: NEWBIE-INTERMEDIATE//To Harvey Gilpin

From: MEZICK, ANGUS (AMEZICK@corporate.pria.com)
Date: 05/16/96


>I have a question I put in that object level part of your code and got it
>all to work except now the data files are screwed up because its expecting
>to have a level bit in the data file for obj

>you know like instead of

>100 0 450
>A
>13 19

>it wants

>100 0 450
>15
>A
>13 19

Ok.... instead of just 15... write it like this:
100 0 450
L
15
A
13 19

and in db.c change this parse_obj in this section:
   obj_proto[i].min_level = 0; <-------- to just init the variable to 0
    switch (*line) {
    case 'L':
     /*level stuff*/
    case 'E':
      CREATE(new_descr, struct extra_descr_data, 1);
      new_descr->keyword = fread_string(obj_f, buf2);
      new_descr->description = fread_string(obj_f, buf2);
      new_descr->next = obj_proto[i].ex_description;
      obj_proto[i].ex_description = new_descr;
      break;
    case 'A':
      if (j >= MAX_OBJ_AFFECT) {
     fprintf(stderr, "Too many A fields (%d max), %s\n", MAX_OBJ_AFFECT, 
buf2);
      }
      get_line(obj_f, line);
      sscanf(line, " %d %d ", t, t + 1);
      obj_proto[i].affected[j].location = t[0];
      obj_proto[i].affected[j].modifier = t[1];
      j++;
      break;
    case '$':
    case '#':
      top_of_objt = i++;
      return line;
      break;
    default:
      fprintf(stderr, "Format error in %s\n", buf2);
      break;
    }

This technique can be VERY helpful for adding other stuff to, like a 
teleport room in the .wld  file without having to rewrite EVERY file.  The 
only time I would suggest a complete rewrite for item levels is if you were 
going to go MERC on us and give every item a level.   then just tack to 
level onto the 100 0 450 line and make it 100 0 450 15.   good luck.. I like 
this question.. :)
dodger



This archive was generated by hypermail 2b30 : 12/18/00 PST