Re: [Question] Zone expansion (die magical 100, die!)

From: George Greer (greerga@circlemud.org)
Date: 04/27/01


On Fri, 27 Apr 2001, Patrick Dughi wrote:

>        However, if we go and look at other patches, like dig or the
>sort, we quickly see that all zones are expected to be always and ONLY
>100 units large.

Ok, I'm sick of that limit.  Especially since we do stupid things like:
        zone_table[i - 1].top + 1 ... zone_table[i].top

Unless Alex has issues with the format, here's a tentative cut & pasted
patch (not including castle.c bits):

Index: db.h
===================================================================
RCS file: /home/circledb/.cvs/circle/src/db.h,v
retrieving revision 1.13
diff -u -p -r1.13 db.h
--- db.h        2001/03/05 02:47:08     1.13
+++ db.h        2001/04/27 17:04:12
@@ -156,6 +157,7 @@ struct zone_data {
    char        *name;              /* name of this zone        */
    int lifespan;           /* how long between resets (minutes)  */
    int age;                /* current age of this zone (minutes) */
+   room_vnum bot;           /* starting room number for this zone */
    room_vnum top;           /* upper limit for rooms in this zone */

    int reset_mode;         /* conditions for reset (see below)   */
diff -u -p -r1.58 db.c
--- db.c        2001/03/05 13:04:51     1.58
+++ db.c        2001/04/27 17:21:30
@@ -352,7 +352,7 @@ void boot_db(void)

   for (i = 0; i <= top_of_zone_table; i++) {
     log("Resetting %s (rooms %d-%d).", zone_table[i].name,
-       (i ? (zone_table[i - 1].top + 1) : 0), zone_table[i].top);
+       zone_table[i].bot, zone_table[i].top);
     reset_zone(i);
   }

@@ -1408,10 +1417,18 @@ void load_zones(FILE * fl, char *zonenam
   Z.name = str_dup(buf);

   line_num += get_line(fl, buf);
-  if (sscanf(buf, " %hd %d %d ", &Z.top, &Z.lifespan, &Z.reset_mode) != 3) {
-    log("SYSERR: Format error in 3-constant line of %s", zname);
+  error = sscanf(buf, " %hd %d %d %hd ", &Z.top, &Z.lifespan, &Z.reset_mode, &Z.bot);
+  if (error == 3)
+    Z.bot = Z.number * 100;
+  else if (error != 4) {
+    log("SYSERR: Format error in numeric constant line of %s", zname);
     exit(1);
   }
+  if (Z.bot > Z.top) {
+    log("SYSERR: Zone %d bottom (%d) > top (%d).", Z.number, Z.bot, Z.top);
+    exit(1);
+  }
+
   cmd_no = 0;

   for (;;) {

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST