OASIS OLC code

From: Robert Drake (bleak@BELLSOUTH.NET)
Date: 06/16/98


I've been working in a Merc style codebase for a while now, one of the
things I did was "port" OASIS to our code.  What I really did was combine
the good aspects of all the OLC's I looked at, mainly taking the interface
from OASIS.  I found a couple of things about OASIS that I changed and I
thought I might share it, if anyones interested.

This came from.. probably an old version of OASIS patched in to bpl11

first off, the structure used:

struct olc_data {
  int mode;
  int zone_num;
  int number;
  int value;
  struct char_data *mob;
  struct room_data *room;
  struct obj_data *obj;
  struct zone_data *zone;
  struct shop_data *shop;
  struct extra_descr_data *desc;
};

what I did, was remove *mob, *room, *obj, *zone and *shop and replace them
with
void * edit_data;
which saves 16 bytes of memory per OLC user, at the cost of data
protection (which most of the time, OASIS doesn't protect the data anyway)
(this assumes 4 byte pointers)

I replaced the calls to them with things like:
#define OLC_ROOM(d)     ((struct room_data *)((d)->olc->edit_data))

this change requires a rewrite of cleanup_olc, but mines completely
different anyway.

Also, when making new files I usually just copied the data out of the old
ones.. so if I was making medit.c I might copy oedit.c, which is great,
but occasionally you might forget about a line somewhere and call the
OLC_OBJ() in medit, or you might use OEDIT_CONFIRM_BLAH instead of MEDIT_
this is bad for ethier scheme, and produces no warnings.. so I put:

#define IN_MEDIT_C
before my include of olc.h, then wrapped the MEDIT_ states and OLC_MOB()
in #ifdef's, making it give errors if I used them in the wrong file.

Once you get the OLC fully debugged, you don't need any of this code.. but
its still nice to have it..

alright, enough rambling.. hope this helps someone.. :)

Robert Drake


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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