Welcome to the Builder Academy

Loved New OLC Craft System

More
09 Aug 2012 03:33 #607 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
So the SYSERR: (Should actually be WARNING:) is stating that you are trying to remove something from a list that doesn't in fact exist within the list. In crafts.c, I use "remove_from_list()" 5 times, so you're going to have to figure out which one occurs just prior to the CRASH. The best way to do this is to just use mudlog() and send the message "1", "2", "3" etc.. before each remove_from_list() so when the MUD crashes, you'll know which occurance was called last.

I'm also curious to know if you have any crafts being loaded up with the MUD? Type "show craft" when you boot up and let me know if anything pops up.

If you do have crafts being loaded up, then see if the MUD crashes when you do a shutdown, and let me know.

Also, while running the MUD in gdb, when it crashes see if you can get a backtrace("bt") that shows any functions that are being called within the MUD. You may need to "scroll" up or down to see them, if they exist.

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
09 Aug 2012 03:55 - 09 Aug 2012 04:04 #608 by Papaya Pete
Just to reply quickly, it does actually show the list of crafts known (which was two, but manually deleted one). And I thought it was shutting down properly, but noticed it's doing a core dump.

I'll take a look and see what I can find. Maybe I made a mistake somewhere and accidentally changed something...

Edit:

Ah here we go. It's running the very first remove_from_list twice before the crash.
Code:
void free_craft(struct craft_data * craft) { struct requirement_data * r; struct iterator_data Iterator; if (craft->craft_name) free(craft->craft_name); if (craft->craft_msg_self) free(craft->craft_msg_self); if (craft->craft_msg_room) free(craft->craft_msg_room); if (craft->requirements->iSize) { for(r = (struct requirement_data *) merge_iterator(&Iterator, craft->requirements); r; r = next_in_list(&Iterator)) { // Temp mud log mudlog(CMP, LVL_GOD, TRUE, "Performed: Prime Remove From List."); remove_from_list(r, craft->requirements); free(r); } remove_iterator(&Iterator); free_list(craft->requirements); } free(craft); }
Last edit: 09 Aug 2012 04:04 by Papaya Pete.

Please Log in or Create an account to join the conversation.

More
09 Aug 2012 06:21 - 09 Aug 2012 15:54 #609 by Papaya Pete
So I've been testing it out a little and I found out when it crashes. It's only after the ingredients for a recipe are set. When the item recipe is first created, it saves properly, but if I try to modify an existing recipe it doesn't save properly. I'm also unable to delete existing recipes. Hope this helps!

Edit:

So it looks like the issue might be with this loop right here...
Code:
if (craft->requirements->iSize) { for(r = (struct requirement_data *) merge_iterator(&Iterator, craft->requirements); r; r = next_in_list(&Iterator)) { remove_from_list(r, craft->requirements); free(r); }

Since this is dealing with the required ingredients for a crafting recipe. Hmmm.
Last edit: 09 Aug 2012 15:54 by Papaya Pete.

Please Log in or Create an account to join the conversation.

More
10 Aug 2012 03:12 #621 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
Try that...
Code:
if (craft->requirements->iSize) { for(r = (struct requirement_data *) merge_iterator(&Iterator, craft->requirements); r; - r = next_in_list(&Iterator)) { + r = (struct requirement_data *) next_in_list(&Iterator)) { remove_from_list(r, craft->requirements); free(r); }

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

More
10 Aug 2012 05:29 #622 by Papaya Pete
Hmmm, I made that change... still crashing after trying to modify existing crafts or attempting to delete existing recipes.

Please Log in or Create an account to join the conversation.

More
11 Aug 2012 03:38 #636 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
I believe your crash is a result of free_craft() attempting to free something that doesn't exist. Which is quite odd since no one else, including myself, has seen/reported this issue before. My first guess is this probably is a compatibility issue that is appearing due to you using windows and cygwin to compile/run the code. Nevertheless, the next step in debugging this problem is to figure out if the requirement data is actually being loaded properly or not.

Please post (in code tags) a screen capture of show craft, show craft "item" if you can, your crafts file, and as much gdb data as possible from the crash.

Screen Cap Example:
Code:
Crafts: ID ) Name VNUM Item Name 1 ) Steel Ingot -> [1001] [a steel ingot] 2 ) Lumber -> [1005] [a piece of lumber] 5 ) Iron Ingot -> [1003] [an iron ingot] 100 ) recipe, basic staff -> [539 ] [a crafted staff]
Code:
Craft: Steel Ingot, (1) Makes: a steel ingot! Time: 3 Req: some raw steel (5 ) In Inventory Remove Req: a furnace (1 ) In Room No Remove

tbaMUD developer/programmer

Please Log in or Create an account to join the conversation.

Time to create page: 0.291 seconds