Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shop listings




 I've started working an a shop inventory listing so you don't have
to wander around to every space.

 The way I'm doing it is searching the entire map, and any unpaid
item is assumed to be in a shop forsale.  This seems to work ok for
the limited work I've done (I had it dump that info to stderr).  The
problem with this method is some maps have multiple subshops (the
guild and old shop in the starting village.)  Not any real easy
solution I can think of.

 Now my question:

 As the list of what is in the shop is built, it would seem to need
to be attached to the player structure (if a static declaration inside
the function was used, and someone somewhere else got a shop inventory,
it would clobber the data.)  Does a variable in the player structure exit
(exist) for this purpose, or do I need to add a new one (no big deal if
I do)

 Second, it would seem best to copy the objects into the new list (and
at the same time, merge objects, if possible).  It looks like there
are some functions in object.c (libcross) that will do this, yet
there are parts of them which are unclear (like what Enviroment is, and
what it should be set to).  Does any good documentaion exist for
libcross?  It would seem like the code I need to do will
be something like:

	copy_object(new_obj, shop_obj);
	if (!merge_ob(new_obj, list))
		insert_ob_in_ob(new_obj, list);

 Where list is the list starting in the player structure.  Is
this more or less correct?

 And then to get rid of objects as they are displayed in the info window,
something like remove_ob(list)?

   Mark Wedel
master@cats.ucsc.edu