Smaugfuss1.9.3

Posted by Oblisgr on Wed 29 Jan 2020 12:02 AM — 4 posts, 19,766 views.

#0
I added some line to do_wear and after that my game crashes when i m trying to wear a weapon.

it gives:


Wed Jan 29 01:55:15 2020 :: Oblisgr (127.0.0.1) has connected.
Segmentation fault (core dumped)


and the code i added is:



obj=get_obj_carry(ch, arg1);

   if ( (LEARNED(ch, gsn_daggers) < 1) && obj->value[3] == 0 )
   {
   send_to_char("You have to practice &B[daggers] weapon skill first.&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_swords) < 1) && obj->value[3] == 1 )
   {
   send_to_char("You are not studied &B[swords]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_greatswords) < 1) && obj->value[3] == 2 )
   {
   send_to_char("First you have to learn &B[greatswords]&D weapon proficiency.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_hatchets) < 1) && obj->value[3] == 3 )
   {
   send_to_char("You are not studied &B[hatchets]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_greataxes) < 1) && obj->value[3] == 4 )
   {
   send_to_char("You are not studied &B[greataxes]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_maces) < 1) && obj->value[3] == 5 )
   {
   send_to_char("You are not studied &B[maces]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_mauls) < 1) && obj->value[3] == 6 )
   {
   send_to_char("You are not studied &B[mauls]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_polearms) < 1) && obj->value[3] == 7 )
   {
   send_to_char("You are not studied &B[polearms]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_fists) < 1) && obj->value[3] == 8 )
   {
   send_to_char("You are not studied &B[fists]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_staves) < 1) && obj->value[3] == 9 )
   {
   send_to_char("You are not studied &B[staves]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_wands) < 1) && obj->value[3] == 10 )
   {
   send_to_char("You are not studied &B[wands]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_guns) < 1) && obj->value[3] == 11 )
   {
   send_to_char("You are not studied &B[guns]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_bows) < 1) && obj->value[3] == 12 )
   {
   send_to_char("You are not studied &B[bows]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_crossbows) < 1) && obj->value[3] == 13 )
   {
   send_to_char("You are not studied &B[crossbows]&D yet.\r\n", ch);
   return;
   } 

   if ( (LEARNED(ch, gsn_thrown) < 1) && obj->value[3] == 14 )
   {
   send_to_char("You are not studied &B[thrown]&D yet.\r\n", ch);
   return;
   } 

USA Global Moderator #1
Quote:
the code i added is

Code doesn't work that way. We need to know exactly where you put it and what all of the code around it is doing.
Amended on Wed 29 Jan 2020 05:50 AM by Fiendish
Australia Forum Administrator #2
I suggest you look at: http://gammon.com.au/gdb

It will be worth getting gdb to work for you, and then you can find the exact line where it crashed. That won't necessarily tell you the exact reason for the crash, but it will put you in the right general spot.

My guess is that 'obj' or 'ch' are NULL, but the reason for that you would have to find out.
#3
problem solved!

changed position to obj=get_obj_carry(ch, arg1);