Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ languages to extended bitvectors

languages to extended bitvectors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Swimming   (20 posts)  Bio
Date Mon 10 Apr 2006 05:08 AM (UTC)
Message
Hi, i need more languages. so i figure to change them to ext_bv. If someone else has done this can you show me a snippet or code?
i've done some and am having trouble with some lines, but didn't want to post in case someone has already made up one that works.
donkey
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #1 on Mon 10 Apr 2006 11:55 AM (UTC)
Message
Well exactly what problems are you having, here is a link to a post concerning changing channels from bitvectors to extended bitvectors, the principles are the same.

http://sml.shadow-lands.com/2002/msg02297.html
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #2 on Wed 12 Apr 2006 01:32 AM (UTC)
Message
looked through all the things in the archives with ext bv and couldn't find these particular things..

lang_array is the ext_bv thing now.

invalid operands to binary &:
if( IS_SET( language, lang_array[lang] )

incompatible type for argument 2 of `knows_language':
if( knows_language( ch, lang_array[langs], ch ) )

incompatible types in assignment:
ch->speaking = lang_array[langs];

request for member `bits' in something not a structure
or union & invalid operands to binary >> & invalid
operands to binary &:
SET_BIT( ch->speaks, lang_array[lang] );
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #3 on Wed 12 Apr 2006 04:53 PM (UTC)
Message
ok, you don't need to change the lang_array, that is merely an array of the bitvectors, you need to go through and change all references to it into extended bitvector function references. then once you do that, go through mud.h and change the actual language variables from bitvectors to just plain integers, then you need to change speaking in the char_data structure from int to EXT_BV.

So just to be clear:
int speaks;
int speaking;
becomes
EXT_BV speaks;
EXT_BV speaking;

#define LANG_COMMON BV00
becomes
#define LANG_COMMON 0

SET_BIT(ch->speaks, lang_array[lang]);
becomes
xSET_BIT(ch->speaks, lang_array[lang]);

IS_SET(ch->speaks, lang_array[lang])
becomes
xIS_SET(ch->speaks, lang_array[lang])
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #4 on Thu 13 Apr 2006 10:46 PM (UTC)
Message
I'm still getting incompatible types for arg 2 in knows_language:
knows_language( ch, lang_array[lang], ch )
I get 4 errors for every one line of it.

And I'm supposed to change int const lang_array[] into EXT_BV lang_array[] right?

When there are things like if (... & ch->speaks)
I put !xIS_EMPTY(ch->speaks), it made the warnings stop but I don't know if it is right.

and it had a problem with countlang, changing it from int countlangs( int languages ) to (EXT_BV languages). Again, it made it go away, but I don't know if it's right either.

am getting invlid operands to binary & still for:
if( IS_SET( language, lang_array[lang] )&& xIS_SET( ch->speaks, lang_array[lang] ) )
No matter which way I change it, there are still problems.

thanks muchly..
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #5 on Thu 13 Apr 2006 11:08 PM (UTC)
Message
Why are you changing to extended bit vectors? Do you really need that many languages? It seems like 32 should be enough languages.

This topic might help:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1945

~Nick Cash
http://www.nick-cash.com
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #6 on Fri 14 Apr 2006 10:50 AM (UTC)
Message
for the second time, you don't need to change it to EXT_BV lang_array[], post your errors please, we cannot help fix your errors blind.
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #7 on Sun 16 Apr 2006 09:58 PM (UTC)
Message
errors:
incompatible type for argument 2 of `knows_language':
knows_language( sch, ch->speaking, ch )

incompatible type for argument 1 of `countlangs':
countlangs( ch->speaks )

invalid operands to binary &:
if( ch->speaks & language )


i think i can change the countlangs to take bvs, but there are lots of other things that use knows_language so i can't do that to it.
and i don't understand how the if( ... & ...) thing works
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #8 on Wed 19 Apr 2006 10:02 PM (UTC)
Message
these happen 4 times for each:
incompatible type for argument 2 of `knows_language':
knows_language( sch, ch->speaking, ch )
knows_language( gch, ch->speaking, ch )
knows_language( victim, ch->speaking, ch )

one time each for:
knows_language( ch, sch->speaking, sch)
knows_language( sch, ch->speaking, ch)

it doesn't do it when it has ch in the first argument, usually

?
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #9 on Fri 05 May 2006 12:19 AM (UTC)
Message
made a ext_knows_language to take ext_bv

still don't have any clue what to do with the things like:

if( victim->speaking & LANG_CLAN )

if( ch->speaks & language )

I guess I'm not understanding what they mean.
Should I use xIS_SET(victim->speaking, LANG_CLAN)

or is it something else?

ideas?

thanks
Top

Posted by Colton   (44 posts)  Bio
Date Reply #10 on Sat 06 May 2006 12:21 AM (UTC)
Message
I am actually having trouble doing this one also, seems to be a rather tricky one. I've been converting all of my bit vectors to extended bit vectors so that it wont have to be done if I run out later and it seems that this has many little functions here and there that dont like to cooperate. Espessialy the scramble function, I was thinking of compleatly redoing that and making a whole new function for someone who didn't know how to speak a certian language.
Top

Posted by Colton   (44 posts)  Bio
Date Reply #11 on Sat 06 May 2006 12:28 AM (UTC)
Message
As for:
if( victim->speaking & LANG_CLAN )

I'd do:

if( !xIS_EMPTY( victim->speaking) && IS_SET( victim->speaking, LANG_CLAN ))

and the other:

if( ch->speaks & language )

maybe:

if( !xIS_EMPTY(ch->speaks) & !xIS_EMPTY(language) )

Not sure on the second though.. didn't get that far heh.
Top

Posted by Swimming   (20 posts)  Bio
Date Reply #12 on Mon 19 Jun 2006 09:55 PM (UTC)
Message
Righto-

I've gotten it to work, for the most part.
There are some problems when trying to learn a language but I believe it is coming from this line:

if( VALID_LANGS & language ) 
      return TRUE;


in in ext_can_learn_lang. I had to copy can_learn_lang and make it accept ext_bv.

I need to check if the language is valid. How is that done?
the other times valid_langs has been checked is by get_langflags with a character string.

What is VALID_LANGS counted as?

Oh, I had done

if(VALID_LANGS & !xIS_EMPTY(language))


to get it to compile, but I believe it is wrong.

thankees
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


33,644 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.