Hi again ,-) Ok, thought I'd comment on the mails I just got on my questions pertaining the assign_the_shops() problem. I dug through the code I use, as well as (parts - so I'm lazy .-) the CircleMUD bpl 12 shop.c stuff. It seems, that at bootup in the boot_the_shops() the following happens: SHOP_KEEPER(top_shop) = real_mobile(SHOP_KEEPER(top_shop)); So... erm.... *grin* I'd say we have a real_mobile/rnum assigment in the shop_index[x].keeper value... So, the offset into SHOP_KEEPER(index) should be perfectly safe and 'in bounds' when using > 0 && < top_of_mobt ,-) This however raises a note, that the comment in some struct is wrong, or that something else, than what's actually done, was the purpose... *shrug* Furthermore, as Akuma wrote, I think there's actually a possible cause for a memory fault in the stock assign_the_shops code.. If the shop the mud boots has an invalid mobile assigned, that will put -1 into the shop_index[xxx].keeper value, then the following code 'underwrites' the shop_index table: for (index = 0; index < top_shop; index++) { if (mob_index[SHOP_KEEPER(index)].func) SHOP_FUNC(index) = mob_index[SHOP_KEEPER(index)].func; mob_index[SHOP_KEEPER(index)].func = shop_keeper; } And... yep... this is taken from STOCK CIRCLEMUD BPL12 in: void assign_the_shopkeepers(void) B-) So, BUG BUG BUG BUG BUG *grin* Even though I used my own hacked up version of the function, it inherited a sneaky, creepy bug... *grumble* I hope someone will fix this in std. circle also... Don't think my way of going arround it is very neat, but converted into stock type code it would look like: void assign_the_shopkeepers(void) { int index; extern int top_of_mobt; cmd_say = find_command("say"); cmd_tell = find_command("tell"); cmd_emote = find_command("emote"); cmd_slap = find_command("slap"); cmd_puke = find_command("puke"); for (index = 0; index < top_shop; index++) { if((SHOP_KEEPER(index) > -1) && (SHOP_KEEPER(index) <= top_of_mobt)) { if (mob_index[SHOP_KEEPER(index)].func) SHOP_FUNC(index) = mob_index[SHOP_KEEPER(index)].func; mob_index[SHOP_KEEPER(index)].func = shop_keeper; } } } The check against top_of_mobt is sort of lame, since real_mobile should have taken care of the check that the mobile it returns a vnum of exists, but I'm a little 'checkhappy' when it comes to memory trouble by now *G* Well, I thought this might be of commin interest ,-) Regards, Rand .d -- Rasmus Ronlev DOEK'94 http://www.econ.cbs.dk/~raro94ab IT-Advisor mailto:raro94ab@student.econ.cbs.dk B.Sc. Computer Science and Business Administration Stud. M.Sc. Computer Science and Business Administration +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST