Login
User Name:

Password:



Register

Forgot your password?
 I3 and IMC
Dec 26, 2024 3:27 am
By GatewaySysop
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
LOP 1.6
Author: Remcon
Submitted by: Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
Users Online
Bing, Yandex, Google

Members: 0
Guests: 49
Stats
Files
Topics
Posts
Members
Newest Member
496
3,808
19,708
594
MaisieMacl

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

bribe_trigger
< Newer Topic :: Older Topic > question

Pages:<< prev 1 next >>
Post is unread #1 Oct 12, 2011 2:46 am   Last edited Oct 12, 2011 2:47 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303

GroupMembers
Posts86
JoinedAug 25, 2003

 
In mprog_bribe_trigger there is:

      /* Go through once to see which we should use */
      onprog = 0;
      for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next )
      {
         ++onprog;
         if( ( mprg->type == BRIBE_PROG ) && ( uamount >= atoi( mprg->arglist ) ) && ( amdiff == 0 || ( uamount - atoi( mprg->arglist ) ) < amdiff ) )
         {
            amdiff = ( uamount - atoi( mprg->arglist ) );
            useprog = onprog;
         }
      }

      /* Go through it again and use the closest bribe program to the amount */
      onprog = 0;
      for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next )
      {
         if( ++onprog != useprog )
            continue;

         if( ( mprg->type == BRIBE_PROG ) && ( uamount >= atoi( mprg->arglist ) ) )
         {
            increase_gold( mob, uamount );
            mprog_driver( mprg->comlist, mob, ch, obj, NULL, false );
            if( obj )
               extract_obj( obj );
            break;
         }
      }


I don't know but, is possible declare another mprg and make:

MPROG_DATA *sprg = NULL; 
      /* Go through once to see which we should use */
      for( mprg = mob->pIndexData->mudprogs; mprg; mprg = mprg->next )
       if( ( mprg->type == BRIBE_PROG ) && ( uamount >= atoi( mprg->arglist ) ) && ( amdiff == 0 || ( uamount - atoi( mprg->arglist ) ) < amdiff ) )
         {
            amdiff = ( uamount - atoi( mprg->arglist ) );
            sprg = mprg;         
         }

if ( sprg )
{
       increase_gold( mob, uamount );
       mprog_driver( sprg->comlist, mob, ch, obj, NULL, false );
       if( obj )
       extract_obj( obj );
       break;
}

Post is unread #2 Oct 26, 2011 8:33 pm   
Go to the top of the page
Go to the bottom of the page

Remcon

GroupAdministrators
Posts1,946
JoinedJul 26, 2005

 
Haven't tried, but should be able to. Minus the break in the part your adding since it isnt in a for loop

Post is unread #3 Oct 31, 2011 3:04 am   Last edited Oct 31, 2011 3:08 am by Matteo2303
Go to the top of the page
Go to the bottom of the page

Matteo2303

GroupMembers
Posts86
JoinedAug 25, 2003

 
Yeah, minus "break".
My bad.

Bye
mat

Pages:<< prev 1 next >>