languages to extended bitvectors

Posted by Swimming on Mon 10 Apr 2006 05:08 AM — 13 posts, 49,278 views.

#0
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
USA #1
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
#2
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] );
USA #3
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])
#4
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..
USA #5
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
USA #6
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.
#7
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
#8
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

?
#9
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
#10
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.
#11
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.
#12
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