Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Majestic-12, Yahoo!

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
479
3,708
19,242
614
BenitoVirg
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Hardcoded level checks ...
Forum Rules | Mark all | Recent Posts

[Bug] Hardcoded level checks in various places
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jul 30, 2005, 10:19 am   Last edited Jul 30, 2005, 10:51 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Hardcoded level checks in various places
Danger: Varies by location
Found by: Several people over time
Fixed by: Several other people over time

---

act_info.c, show_char_to_char_0

Locate:
if( IS_IMMORTAL( victim ) && victim->level > 50 )


Replace with:

if( IS_IMMORTAL( victim ) && victim->level > LEVEL_AVATAR )


Locate:
else if( CAN_PKILL( victim ) && victim->level < 51 )


Replace with:
else if( CAN_PKILL( victim ) && victim->level < LEVEL_IMMORTAL )


act_info.c, do_who

Locate:
if( wch->level > 50 && IS_IMMORTAL( wch ) )


Replace with:
if( wch->level > LEVEL_AVATAR && IS_IMMORTAL( wch ) )


Locate:
if( IS_IMMORTAL( victim ) && victim->level > 50 )


Replace with:
if( IS_IMMORTAL( victim ) && victim->level > LEVEL_AVATAR )


mud_comm.c, do_mpinvis

Locate:
if( level < 2 || level > 51 )


Replace with:
if( level < 2 || level > LEVEL_IMMORTAL )


act_comm.c, talk_channel

Locate:
if( ( ch->level < 51 ) && ( channel != CHANNEL_WARTALK ) && ( channel != CHANNEL_CLAN ) )


Replace with:
if( ( ch->level < LEVEL_IMMORTAL ) && ( channel != CHANNEL_WARTALK ) && ( channel != CHANNEL_CLAN ) )


act_comm.c, do_group

Locate:
      ch_printf( ch, "\n\rFollowing %-12.12s     [hitpnts]   [ magic ] [mst] [mvs] [race]%s\n\r",
                 PERS( leader, ch ), ch->level < 50 ? " [to lvl]" : "" );


Replace with:
      ch_printf( ch, "\n\rFollowing %-12.12s     [hitpnts]   [ magic ] [mst] [mvs] [race]%s\n\r",
                 PERS( leader, ch ), ch->level < LEVEL_AVATAR ? " [to lvl]" : "" );


Locate:
if( gch->level < 50 )


Replace with:
if( gch->level < LEVEL_AVATAR )


clans.c, do_council_induct

Locate:
if ( victim->level < 51 )


Replace with:
if ( victim->level < LEVEL_IMMORTAL )


comm.c, nanny

Locate:
         if( ch->level == 50 )
            do_help( ch, "amotd" );
         if( ch->level < 50 && ch->level > 0 )
            do_help( ch, "motd" );


Replace with:
         if( ch->level == LEVEL_AVATAR )
            do_help( ch, "amotd" );
         if( ch->level < LEVEL_AVATAR && ch->level > 0 )
            do_help( ch, "motd" );


act_wiz.c, do_mortalize

Locate:
      victim->level = 50;
      victim->exp = exp_level( victim, 50 );


Replace with:
      victim->level = LEVEL_AVATAR;
      victim->exp = exp_level( victim, LEVEL_AVATAR );


fight.c, check_killer

Locate:
level_ratio = URANGE( 1, ch->level / victim->level, 50 );


Replace with:
level_ratio = URANGE( 1, ch->level / victim->level, LEVEL_AVATAR );


fight.c, raw_kill

Locate:
if( victim->level < 50 )


Replace with:
if( victim->level < LEVEL_AVATAR )


comments.c, do_comment

Locate:
if( ( get_trust( victim ) >= get_trust( ch ) ) || ( get_trust( ch ) < 58 ) )  /* switch to some LEVEL_ thingie */


Replace with:
if( ( get_trust( victim ) >= get_trust( ch ) ) || ( get_trust( ch ) < LEVEL_GOD ) )


Locate:
         if( ( 58 <= get_trust( ch ) ) /* switch to some LEVEL_ thingie */
             && ( vnum == anum ) )


Replace with:
         if( ( LEVEL_GOD <= get_trust( ch ) )
             && ( vnum == anum ) )


The above "metabug" was fixed up by going over every file in the code and looking for the literal strings "50" and "51" which are the common levels for avatar and immortal. The other levels from 52-65 were hunted for the hard way: by using grep. This isn't necessarily going to account for every last possible place there are hardcoded level values, but this should take care of nearly all of the important ones.
       
Pages:<< prev 1 next >>