Login
User Name:

Password:



Register

Forgot your password?
Skills/Spells Teacher Bug
May 30, 2021 3:01 pm
By Osien
C system call
May 5, 2021 4:28 am
By Matteo2303
ifchecks "morph" - "nuisance"
Apr 17, 2021 3:02 pm
By GatewaySysop
18 years ago
Mar 29, 2021 5:10 pm
By Remcon
Bugs found in Smaugfuss1.9.3
Mar 19, 2021 8:41 pm
By Zedethar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
SWRFUSS 1.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.4
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
Users Online
CommonCrawl, Majestic-12, SemrushBot

Members: 0
Guests: 2
Stats
Files
Topics
Posts
Members
Newest Member
486
3,770
19,545
577
Braska

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SmaugFUSS » do_supplicate
Forum Rules | Mark all | Recent Posts

do_supplicate
< Newer Topic :: Older Topic > change return with continue

Pages:<< prev 1 next >>
Post is unread #1 Jan 25, 2021 12:57 pm   Last edited Jan 25, 2021 2:27 pm by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts84
JoinedAug 25, 2003

 
Hello,

In do_supplicate loop for "supplicate corpse" I suggest check "return" istance for two reasons:
1) If there are more than one corpse, and the last or one in the middle of list is in a ROOM_NOSUPPLICATE you don't pay favour costs.
2) if one corpse is in a ROOM_NOSUPPLICATE you can't get some other corpses that you are allowed to get.

      for( obj = first_object; obj; obj = obj->next )
      {
         if( obj->in_room && !str_cmp( buf2, obj->short_descr ) && ( obj->pIndexData->vnum == OBJ_VNUM_CORPSE_PC ) )
         {
            found = TRUE;

            if( IS_PKILL( ch ) && obj->timer > 19 )
            {
               if( retr )
                  ch->pcdata->favor -= ch->pcdata->deity->scorpse;
               send_to_char( "So soon?  Have patience...\n\r", ch );
               return; // <- here I don't know (I haven't this scenario)
            }

            if( xIS_SET( obj->in_room->room_flags, ROOM_NOSUPPLICATE ) )
            {
               act( AT_MAGIC, "The image of your corpse appears, but suddenly wavers away.", ch, NULL, NULL, TO_CHAR );
               return; // <- I suggest use: continue;... upper echo is better move out from loop probably
            }

            act( AT_MAGIC, "Your corpse appears suddenly, surrounded by a divine presence...", ch, NULL, NULL, TO_CHAR );
            act( AT_MAGIC, "$n's corpse appears suddenly, surrounded by a divine force...", ch, NULL, NULL, TO_ROOM );
            obj_from_room( obj );
            obj = obj_to_room( obj, ch->in_room );
            xREMOVE_BIT( obj->extra_flags, ITEM_BURIED );
            retr = TRUE;
         }
      }

// after I not check...



Bye, and sorry for my bad english
mat

Post is unread #2 Jan 26, 2021 7:14 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,903
JoinedJul 26, 2005

 
the reason it is like that is it will bring every single corpse to you. if you do those returns it will how ever break out. you can use the word continue instead of return in each place and it have the desired result you are looking for.

Post is unread #3 Jan 27, 2021 1:50 am   Last edited Jan 27, 2021 1:55 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts84
JoinedAug 25, 2003

 
Ok, probably I miss something but actually If you die two times (or more) and last corpse (or one in the middle) is in a nosupplicate room, when you supplicate corpse you don't pay favour*** and also It's possible you don't get any corpse or only the corpse obj that are listed before the corpse that stay in nosupplicate room.

*** This because ch->pcdata->favor -= ch->pcdata->deity->scorpse;
is located outside of loop.

Correct?

bye
mat

ps. Smaug 1.9.4 use "return" not "continue"

Post is unread #4 Jan 27, 2021 5:57 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,903
JoinedJul 26, 2005

 
right, it is meant so that any corpse of yours that it can bring it will bring all for the one set favor cost. It should continue on those places so it doesn't bring them but continue looking for other corpses. It uses the retr setting to know that it did find and bring you a corpse from somewhere.

Post is unread #5 Jan 31, 2021 6:30 am   
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts84
JoinedAug 25, 2003

 
Remcon said:

right, it is meant so that any corpse of yours that it can bring it will bring all for the one set favor cost. It should continue on those places so it doesn't bring them but continue looking for other corpses. It uses the retr setting to know that it did find and bring you a corpse from somewhere.


I'm very sorry. My English is so terrible that I have great difficulty both expressing myself and understanding.

Imagine this situation.
I die 3 times and I'm not a PKILL. The first 2 times in any location. The third in a NOSUPPLICATE location.

The loop start...
for( obj = first_object; obj; obj = obj->next )


The first and second corpses are found and brought back to me. (And so far I haven't paid any favors.)

The loop finally finds the third body, which however is in a NOSUPPLICATE location.

The following happens:

            if( xIS_SET( obj->in_room->room_flags, ROOM_NOSUPPLICATE ) )
            {
               act( AT_MAGIC, "The image of your corpse appears, but suddenly wavers away.", ch, NULL, NULL, TO_CHAR );
               return;
            }

The "return" statement exits the function do_supplicate without paying any favors even though I have two bodies back.


Bye
mat

Post is unread #6 Feb 1, 2021 3:50 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,903
JoinedJul 26, 2005

 
Ok, so in this situation you want it to check every object looking for your corpses and bring you all it can. I think you are hinting at if it fails to bring one then it shouldn't charge you the fee? It's meant more of if it brings you any you pay the fee. If I recall correctly.

Post is unread #7 Feb 2, 2021 2:56 am   Last edited Feb 2, 2021 3:14 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts84
JoinedAug 25, 2003

 
Remcon said:

Ok, so in this situation you want it to check every object looking for your corpses and bring you all it can. I think you are hinting at if it fails to bring one then it shouldn't charge you the fee? It's meant more of if it brings you any you pay the fee. If I recall correctly.


No, quite the opposite.
In my opinion, if one or more body is recovered, the PC should pay.
currently under certain conditions this does not happen.

I suggest something like this


int ccnt = 0;
      for( obj = first_object; obj; obj = obj->next )
      {
         if( obj->in_room && !str_cmp( buf2, obj->short_descr ) && ( obj->pIndexData->vnum == OBJ_VNUM_CORPSE_PC ) )
         {
            found = TRUE;

            if( IS_PKILL( ch ) && obj->timer > 19 )
           continue;

            if( xIS_SET( obj->in_room->room_flags, ROOM_NOSUPPLICATE ) )
           continue;

            ccnt += 1;
            obj_from_room( obj );
            obj = obj_to_room( obj, ch->in_room );
            xREMOVE_BIT( obj->extra_flags, ITEM_BURIED );
         }
      }

if( found )
{
      if ( ccnt > 0 )
      {
            act( AT_MAGIC, "Your remains are brought back to you by a divine force.", ch, NULL, NULL, TO_CHAR );
            act( AT_MAGIC, "$n's remains appears suddenly, surrounded by a divine force...", ch, NULL, NULL, TO_ROOM );
      }
      else
      {
            send_to_char( "A power holds your remains where they are.\r\n", ch );
            return;
      }
}
else
{
         send_to_char( "No corpse of yours litters the world...\r\n", ch );
         return;
}




                  ch->pcdata->favor -= ch->pcdata->deity->scorpse;

// etc...

Post is unread #8 Feb 2, 2021 3:17 pm   
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,903
JoinedJul 26, 2005

 
My bad I was looking at mine and I had long ago changed it lol. So I went and looked in SmaugFUSS1.9.4 and I see it has this
   if( !str_cmp( arg, "corpse" ) )
   {
      char buf2[MAX_STRING_LENGTH];
      OBJ_DATA *obj;
      bool found;
      bool retr = FALSE;

      if( ch->pcdata->favor < ch->pcdata->deity->scorpse )
      {
         send_to_char( "You are not favored enough for a corpse retrieval.\r\n", ch );
         return;
      }

      if( xIS_SET( ch->in_room->room_flags, ROOM_CLANSTOREROOM ) )
      {
         send_to_char( "You cannot supplicate in a storage room.\r\n", ch );
         return;
      }

      found = FALSE;
      snprintf( buf2, MAX_STRING_LENGTH, "the corpse of %s", ch->name );
      for( obj = first_object; obj; obj = obj->next )
      {
         if( obj->in_room && !str_cmp( buf2, obj->short_descr ) && ( obj->pIndexData->vnum == OBJ_VNUM_CORPSE_PC ) )
         {
            found = TRUE;

            if( IS_PKILL( ch ) && obj->timer > 19 )
            {
               if( retr )
                  ch->pcdata->favor -= ch->pcdata->deity->scorpse;
               send_to_char( "So soon?  Have patience...\n\r", ch );
               return;
            }

            if( xIS_SET( obj->in_room->room_flags, ROOM_NOSUPPLICATE ) )
            {
               act( AT_MAGIC, "The image of your corpse appears, but suddenly wavers away.", ch, NULL, NULL, TO_CHAR );
               return;
            }

            act( AT_MAGIC, "Your corpse appears suddenly, surrounded by a divine presence...", ch, NULL, NULL, TO_CHAR );
            act( AT_MAGIC, "$n's corpse appears suddenly, surrounded by a divine force...", ch, NULL, NULL, TO_ROOM );
            obj_from_room( obj );
            obj = obj_to_room( obj, ch->in_room );
            xREMOVE_BIT( obj->extra_flags, ITEM_BURIED );
            retr = TRUE;
         }
      }

      if( !found )
      {
         send_to_char( "No corpse of yours litters the world...\r\n", ch );
         return;
      }
      ch->pcdata->favor -= ch->pcdata->deity->scorpse;

      if( ch->pcdata->favor < ch->pcdata->deity->susceptnum )
         SET_BIT( ch->susceptible, ch->pcdata->deity->suscept );

      if( ( oldfavor > ch->pcdata->deity->affectednum &&
            ch->pcdata->favor <= ch->pcdata->deity->affectednum ) ||
          ( oldfavor > ch->pcdata->deity->elementnum &&
            ch->pcdata->favor <= ch->pcdata->deity->elementnum ) ||
          ( oldfavor < ch->pcdata->deity->susceptnum && ch->pcdata->favor >= ch->pcdata->deity->susceptnum ) )
      {
         update_aris( ch );
      }

      return;
   }

Yea, this one isn't right by any means lol.

Nothing wrong with your suggested fix. I misunderstood you and thought you were saying to add the returns, considering mine has continues lol.

Post is unread #9 Feb 2, 2021 3:42 pm   
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts84
JoinedAug 25, 2003

 
I had begun to suspect we had two different codes under our eyes.

Once with a friend of mine we spent a day talking, realizing only at the end that my code was completely different from his.

I also don't use the smaugfuss 1.9.4, but when I notice something I say it here hoping it will be useful to someone.

Goodbye see you soon.

Post is unread #10 Feb 3, 2021 11:19 pm   
Go to the top of the page
Go to the bottom of the page

GatewaySysop
Conjurer
GroupMembers
Posts408
JoinedMar 7, 2005

 
Nice catch, thank you for sharing the find and proposed fix! :cool:

Pages:<< prev 1 next >>