On Sat, 20 Apr 1996, Hades wrote: > I am having a massive problem, here are the structs. They are for talking > mobs on my mud, and it works liek this: > say mob hi > if hi is a keyword in the talk-rec list, it says the say. If keep_talking != > null it'll go through THAT linked list and say those things. > > struct continue_rec { > char *say; > struct continue_rec *next_say; > }; > > struct talk_rec { > char *keyword; > char *say; > struct continue_rec *keep_talking; > struct talk_rec *next; > }; > > And in char_data: > > struct talk_rec *says; > > Now when I olc, all I want to do is move ->says from the prototype to the void copy_says(struct talk_rec *dest, struct talk_rec *src) { /* if dest->keyword exists, and isn't already src->keyword copy it */ if(dest->keyword && dest->keyword != src->keyword) { free(dest->keyword); dest->keyword = str_dup(src->keyword); } /* same with dest->src */ if(dest->say && dest->say != src->say) { free(dest->say); dest->say = str_dup(src->say); } /* here we just change the pointers around a bit */ dest->keep_talking = src->keep_talking; dest->next = src->next; return; }
This archive was generated by hypermail 2b30 : 12/18/00 PST