Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing, DotBot

Members: 0
Guests: 18
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
629
DarrenPayn
Today's Birthdays
Atami (31)
Related Links
» SmaugMuds.org » General » Smaug Snippets » dualclass snip
Forum Rules | Mark all | Recent Posts

dualclass snip
< Newer Topic :: Older Topic > undefined?

Pages:<< prev 1 next >>
Post is unread #1 Dec 19, 2003, 4:31 pm
Go to the top of the page
Go to the bottom of the page

xander

GroupMembers
Posts35
JoinedDec 17, 2003

I'm attempting to add in the DUALCLASS snip found on the links from your site. i keep getting these errors in the make

make[1]: Entering directory `/home/darkinsanity/code/src'
gcc -c -O -g2 -Wall magic.c
magic.c: In function `bsearch_skill_exact':
magic.c:206: `ch' undeclared (first use in this function)
magic.c:206: (Each undeclared identifier is reported only once
magic.c:206: for each function it appears in.)


here is the section of code that is giving me the error.

inside ch_bsearch_skill_exact
change:

if (!str_cmp(name, skill_table[sn]->name)
&& ch->pcdata->learned[sn] > 0
&& ch->level >= skill_table[sn]->skill_level[ch->class] )
return sn;
into:


if (!str_cmp(name, skill_table[sn]->name)
(this is line 206) && ch->pcdata->learned[sn] > 0
&& (ch->level >= skill_table[sn]->skill_level[ch->class]
|| DUAL_SKILL(ch, sn) ) )
return sn;

i have tried to remove that line, but it seems that now it's not accepting any 'ch'.
you guys are better than me at this, so maybe you know someone who had the same prob, or maybe you ran into it yourselves?

any input is appreciated.
       
Post is unread #2 Dec 19, 2003, 7:17 pm   Last edited Nov 24, 2007, 12:17 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Never used the code ourselves, nor do I know of anyone else who might have offhand. However, bsearch_skill_exact is not intended to accept a ch as one of it's arguments. It has no means for checking that. You sure you didn't miss an instruction somewhere that told you to modify that function? It should look like this stock:

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( !str_cmp( name, skill_table[sn]->name ) )
    return sn;
	if( first >= top )
    return -1;
    	if( strcmp( name, skill_table[sn]->name) < 1 )
    top = sn - 1;
    	else
    first = sn + 1;
   }
   return -1;
}

       
Post is unread #3 Dec 22, 2003, 1:34 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Be also warned that "class" should be considered an "evil reserved word" now that the codebase is striving to be C++ compatible. Much pain and suffering can be avoided by doing that kind of translation as you apply the snippets, rather than hunting them down later.
       
Post is unread #4 Dec 23, 2003, 2:59 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

True, also have to keep that in mind as well, but the original error makes that a moot point since bsearch_skill_exact isn't supposed to be using a ch at all.
       
Pages:<< prev 1 next >>