The goal of this code is to make a linked list of only special doors to be checked every tick. This way i don't have to process every exit on the mud every tick to decrement counters and remove flags from door affecting spells. Also this way i can put the timer interger and owner variable only on the special doors, to further conserve memory. Unfortunately I'm not that terribly familiar with how to create and modify linked lists (i know what i have learned from the example on the mud itself) and i seem to have some bugs to work out. The code for the spell CREATE()'s a spec_door variable and theninserts the propper data into the fields. Then it links it to the spec_door_list list. the list is of a structure called spec_door here's the form for spec_door struct spec_door { struct room_direction_data *door; int timer; char *owner; struct spec_door *next; }; ok now, I'm creating these structures and adding them into the linked list. the problem i'm having is this I have a room_direction_data structure. I have to find the member of the spec_door linked list which contains this room_direction_data. this is how i did it, but it crashes every time it passes through this code. for(k = spec_door_list; k ; k = k->next) { if( k->door == EXITN(ch->in_room, door)) break; } REMOVE_FROM_LIST(k, spec_door_list, next); now just so you'll know, here's the definition of the macro REMOVE_FROM_LIST #define REMOVE_FROM_LIST(item, head, next) \ if ((item) == (head)) \ head = (item)->next; \ else { \ temp = head; \ while (temp && (temp->next != (item))) \ temp = temp->next; \ if (temp) \ temp->next = (item)->next; \ } \ as a last question: when removing a item from this linked list, i assume i should free it. I have written a free_spec_door() function, but could someone more knowledgeable about this give me what is -correct- for a free_spec_door function, givin the above structure for spec_door? I really appreaciate all the help, and the CM mailing list is already in the credits on my login page. :-) thanks all Veritus Silverun silverun.dynip.com port 7777 http://silverun.dynip.com +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST