Pages:<< prev 1 next >>


Apprentice

GroupMembers
Posts86
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.
Bye, and sorry for my bad english
mat
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



Geomancer

GroupAdministrators
Posts1,992
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.


Apprentice

GroupMembers
Posts86
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"
*** 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"



Geomancer

GroupAdministrators
Posts1,992
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.



Apprentice

GroupMembers
Posts86
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



Geomancer

GroupAdministrators
Posts1,992
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.


Apprentice

GroupMembers
Posts86
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...



Geomancer

GroupAdministrators
Posts1,992
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
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.
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.



Apprentice

GroupMembers
Posts86
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.
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.



Conjurer

GroupMembers
Posts429
JoinedMar 7, 2005
Nice catch, thank you for sharing the find and proposed fix!

Pages:<< prev 1 next >>