> printf("Creating ammo index...\n");
> pAmmoIndex = get_obj_index(OBJ_VNUM_AMMO);
> printf("Ammo index created...\n");
Check to make sure pAmmoIndex isn't null... that's the only way to know if
it's found it or not. It won't crash because it couldn't find the index
(yet).
if (!pAmmoIndex)
printf("Ammo index was NOT found.\n");
> printf("Creating ammo...\n");
> pammo = create_object( pAmmoIndex, 0 ); /* <--- boom! */
> printf("Ammo obj created...");
Same deal about checking for null...
Also, put a \n at the end of that printf.
Since stdout is line-buffered (I'm assuming you're looking at it from a
terminal), if it crashes before it is forced to flush its buffer, you'll
never know whether or not it got to this point.
Or just fprintf to stderr, that has all buffering turned off by default.
I doubt the call to create_object is the culprit.. possibly something in
create_object. If you make these modifications, I would put some printfs in
create_object to make sure the program is entering and exiting the function
correctly, then you may be able to narrow it down (you will want to suppress
those messages during boot-up if you have a large world.....)
> pammo->value[0] = ammo_table[i].type;
> pammo->name = ammo_table[i].name;
> pammo->short_descr = ammo_table[i].shortdesc;
> pammo->description = ammo_table[i].longdesc;
Are you SURE you don't want to str_dup those?
And I mean like really sure, man.
> As you can see, I've pinpointed the problem with the wonderfully advanced
> tactic of putting in lots of printf() calls. Anyhow, I'd really appreciate
> any help.
learn gdb :)
--Palrich.