Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Today, 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
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Google

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SWR FUSS Bugfix List » [Bug] Skill searches are case...
Forum Rules | Mark all | Recent Posts

[Bug] Skill searches are case sensitive and should not be
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jan 28, 2007, 12:09 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Bug: Skill searches are case sensitive and should not be
Danger: Low - Incredibly annoying, but not likely to cause any real harm
Found by: Metsuro
Fixed by: Keberus

---

magic.c, bsearch_skill_exact

Replace the function with:
int bsearch_skill_exact( const char *name, int first, int top )
{
   int sn;

   for( ;; )
   {
      sn = ( first + top ) >> 1;
      if( !IS_VALID_SN( sn ) )
         return -1;
      if( !strcasecmp( name, skill_table[sn]->name ) )
         return sn;
      if( first >= top )
         return -1;
      if( strcasecmp( name, skill_table[sn]->name ) < 1 )
         top = sn - 1;
      else
         first = sn + 1;
   }
}


magic.c, bsearch_skill

Replace the function with:
int bsearch_skill( const char *name, int first, int top )
{
   int sn;

   for( ;; )
   {
      sn = ( first + top ) >> 1;
      if( !IS_VALID_SN( sn ) )
         return -1;
      if( LOWER( name[0] ) == LOWER( skill_table[sn]->name[0] ) && !str_prefix( name, skill_table[sn]->name ) )
         return sn;
      if( first >= top )
         return -1;
      if( strcasecmp( name, skill_table[sn]->name ) < 1 )
         top = sn - 1;
      else
         first = sn + 1;
   }
}


skills.c, check_skill

Locate:
      if( strcmp( command, skill_table[sn]->name ) < 1 )
         top = sn - 1;


Change to:
      if( strcasecmp( command, skill_table[sn]->name ) < 1 )
         top = sn - 1;


tables.c, skill_comp

Locate:
   return strcmp( skill1->name, skill2->name );


Change to:
   return strcasecmp( skill1->name, skill2->name );


Whatever the reason for it, at some point skill lookups became case sensitive. This wasn't really a noticed problem for the most part because nearly every spell or skill created was given an all lowercase name. But trying to even do a lookup on "Fireball" would fail, even though there is a fireball spell. So after several incarnations, this fix finally emerges as the least intrusive of the options presented. It basically just goes through the skill related checks changing strcmp to strcasecmp.
       
Pages:<< prev 1 next >>