memset tag mismatch
#1

Hey, I've found useful function from Slice called memset.

PHP код:
stock memset(variable[], cellsvalue) {
    new 
address;
    
#emit LOAD.S.pri  variable
    #emit STOR.S.pri  address
    
raw_memset(addresscellsvalue);
}
stock raw_memset(addresscellsvalue) {
    new 
param_adr;
    
#emit LCTRL       6
    #emit MOVE.alt
    #emit LCTRL       0
    #emit ADD
    #emit MOVE.alt
    #emit LCTRL       1
    #emit SUB.alt
    #emit ADD.C       92
    #emit STOR.S.pri  param_adr
    #emit LOAD.S.pri  cells
    #emit SHL.C.pri   2
    #emit SREF.S.pri  param_adr
    #emit LOAD.S.alt  address
    #emit LOAD.S.pri  value
    #emit FILL        0

So I decided to use it here instead of loop setting all values to -1, but it outputs tag mismatch warning. When I tried to pass PlayerText:-1, warning still persists. Seems to be working fine in game though.
PHP код:
enum E_MDC
{
    
PlayerText:E_MDC_TEXTDRAW[MDC_TEXTDRAW_SIZE],
    
//rest
}
memset(MDC_g_sPlayer[playerid][E_MDC_TEXTDRAW], MDC_TEXTDRAW_SIZE, -1); 
Reply
#2

You should recheck which parameter caused the tag mistake
I think it is the first and not the third, try that (_: to untag the variable / array)
PHP код:
memset(_MDC_g_sPlayer[playerid][E_MDC_TEXTDRAW], MDC_TEXTDRAW_SIZE, -1); 
Also I am pretty sure that you aren't using raw_memset in your code, you could combine them in one function to remove the function overhead and shift the opcodes around to remove the variable
PHP код:
stock memset(address[], cellsvalue) {
    
#emit LCTRL       6
    #emit MOVE.alt
    #emit LCTRL       0
    #emit ADD
    #emit MOVE.alt
    #emit LCTRL       1
    #emit SUB.alt
    #emit ADD.C       92
    #emit LOAD.S.alt  address
    #emit STOR.S.pri  address
    #emit LOAD.S.pri  cells
    #emit SHL.C.pri   2
    #emit SREF.S.pri  address
    #emit LOAD.S.pri  value
    #emit FILL        0

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)