I did this a while back too a little differently from the people I've read.
Basically I have a structure that's like this
struct Store {
sh_int roomvnum;
char *owner;
STORE_LIST *selling;
SOLD_LIST *sold;
int coffer;
SHOPKEEPER *shopkeeper;
};
So how this works is roomvnum is the vnum of the room, you have your owner
(Player or Clan), then a list of what it's selling and what's been sold. The
list of selling is essentially just a list of objects and their price. I did
this rather than resets so that you could put in an object that has all
enchants and restrings on it without losing those affects. The sold list is
just a list of what's been sold so the shopkeeper doesn't have to remember what
they put in there. The coffer keeps the amount of qps (My stores deal in QPs
rather than cash) that have been sold and you can empty it whenever you'd like.
The shopkeeper is just basically a mob and how many days it's been since you
paid it. With my system in order to sell things you either have to be in the
store yourself or have hired a shopkeeper who requires a daily wage. To buyers
a store looks just like a normal mob based store, to the owner I made a little
OLC type interface that lets them add items, update prices and stuff like that.
This my main structure, I then have a function to write them out to files
which prints the basic info and makes use of fwrite_obj and fread_obj to handle
the more intricate stuff without me doing too much work. Then in db.c after
all the areas are loaded up, I run my load stores routine which goes through
setting flags in each room that has a store.
This is just a rough explanation of how I did it, not sure if it's the best
way, but I've been really happy with the results.
Jason
_____________________________________________________________
wotmania: Your number one source for The Wheel of Time.
http://wotmania.com