Re: Eq. Numbering in list_obj_to_char

From: Julian Fong (fong@autsrv.iitsg.nrc.ca)
Date: 08/04/95


On Fri, 4 Aug 1995, root wrote:

> 	Hello again.
> 	I'm currently running into a small snag with a routine I'm working on
> that does the classic:
> 	a short sword lies here (3)
> 	My current plan of attack is traverse the eq list in a room (via the
> CAN_SEE_OBJ macro and obj->next_content), put the item numbers the player can
> see into an array, count up the similar vnums, then send the output to the char.
> 	The problem is the "count up the similar vnums" part of this algorithim.
> I'm sort of stumped on how I should do this in a semi-elegant way.  Or, worse
> yet, is the approach I'm taking a poor one, and is there a better way?

I did something else which I think might be more efficient. First of all I
changed all the obj_to_char, obj_to_obj and obj_to_room stuff to insert into
the linked list, sorted by rnum (i used rnum but vnum is better i guess).
Then when I list objects to character, I go through the list comparing
adjacent elements. This way it's easier to count and you don't need another
array. 

This way screws up the way people drop objects (instead of having newly 
dropped objects appearing first in the equipment list, they might show 
up later) but I didn't really mind that much.  

Levork



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