SA-MP Forums Archive
something wrong with rbits - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: something wrong with rbits (/showthread.php?tid=515535)



something wrong with rbits - Yves - 26.05.2014

am getting this

Код:
error 025: function heading differs from prototype
the error shows on this rbits.inc

Код:
// its showing the error on the stock bit_set.
stock Bit_Set(BIT_TAGS: abArray[], iIdx, const iValue, const e_Bits: iShift, const iSize = sizeof(abArray)) {
	new
		bVar = ((iIdx & ((1 << _: (Bit32 - iShift)) - 1)) << _: iShift),
		bLim = ((1 << (1 << _: iShift)) - 1)
	;
	iIdx = (iIdx >>> _: (Bit32 - iShift));
	
	if(!(-1 < iIdx < iSize)) {
		return 0;
	}
	(_: abArray[iIdx] &= ~(bLim << bVar));
	(_: abArray[iIdx] |= ((bLim & iValue) << bVar));
	
	return 1;
}



Re : something wrong with rbits - S4t3K - 26.05.2014

Might have a difference between the "native" declaration and the "stock" declaration of the function.


Re: something wrong with rbits - Yves - 26.05.2014

and how would i fix this issue?


Re : something wrong with rbits - S4t3K - 26.05.2014

Make the native declaration and the stock declaration corresponding each other.

The most efficient solution is to copy and paste the function name and its parameters in both of the declarations, without forgetting to add a semicolon after the "native" declaration.


Re: something wrong with rbits - Yves - 26.05.2014

i seriously don't understand what that is?

i been trying to fix this https://sampforum.blast.hk/showthread.php?tid=308561 hours & hours & hours i can't do it because it shows a error again over & over. but i want to use it.


Re : something wrong with rbits - S4t3K - 26.05.2014

You use an include called rBits right ?

In this include, it might have two times the function Bit_Set with all its parameters.

The first time will be the implementation and the second one will be the native declaration, to be shown in the right hand part of pawno (listing of all the functions in all the includes)

Make them corresponding then it will be good. (them = the two times when the function is called)


Re: something wrong with rbits - Konstantinos - 26.05.2014

The problem is probably that both rBits and y_bit (YSI) uses Bit_Set. There's a native in y_bit so rename it to rBit_Set in rBits include so they won't conflict each other.


Re: something wrong with rbits - Yves - 26.05.2014

okay now am getting
error 017: undefined symbol "rBit1_Set"

new rBit1: PlayerLogged;

rBit1_Set(PlayerLogged, playerid, 1);


Re: something wrong with rbits - Konstantinos - 26.05.2014

Except renaming the function, you need to rename the definitions too. For example:
pawn Код:
#define Bit1_Set(%0,%1,%2) \
    Bit_Set(%0, (%1), (%2), Bit1)
should become:
pawn Код:
#define Bit1_Set(%0,%1,%2) \
    rBit_Set(%0, (%1), (%2), Bit1)



Re: something wrong with rbits - Yves - 26.05.2014

Okay i did that but still showing error

error 017: undefined symbol "rBit1_Set"