Hello,
Been a while since I bought some systems for rAthena. And now I add them in Hercules and had a lot of mistakes, errors generated by the new structure of the source.
Could you help me with this?
Error clif.c
Error pc.c
Been a while since I bought some systems for rAthena. And now I add them in Hercules and had a lot of mistakes, errors generated by the new structure of the source.
Could you help me with this?
Error clif.c
clif.c: In function âclif_parse_GlobalMessageâ:clif.c:9930: warning: implicit declaration of function âstr_replaceâclif.c:9930: warning: assignment makes pointer from integer without a cast
Line 9930:
invocation = str_replace(god_db[sd->status.god].invocation,"{CHARNAME}",sd->status.name);
My Patch:
strlib.c
+char *str_replace( const char *string, const char *substr, const char *replacement )+{+ char *tok = NULL;+ char *newstr = NULL;+ + tok = strstr( string, substr );+ if( tok == NULL ) return strdup( string );+ newstr = malloc( strlen( string ) - strlen( substr ) + strlen( replacement ) + 1 );+ if( newstr == NULL ) return NULL;+ memcpy( newstr, string, tok - string );+ memcpy( newstr + (tok - string), replacement, strlen( replacement ) );+ memcpy( newstr + (tok - string) + strlen( replacement ), tok + strlen( substr ), strlen( string ) - strlen( substr ) - ( tok - string ) );+ memset( newstr + strlen( string ) - strlen( substr ) + strlen( replacement ), 0, 1 );+ return newstr;+}
strlib.h
char *(*str_replace) (const char *string, const char *substr, const char *replacement);
clif.c
Line 9930:
invocation = str_replace(god_db[sd->status.god].invocation,"{CHARNAME}",sd->status.name);
My Patch:
strlib.c
+char *str_replace( const char *string, const char *substr, const char *replacement )+{+ char *tok = NULL;+ char *newstr = NULL;+ + tok = strstr( string, substr );+ if( tok == NULL ) return strdup( string );+ newstr = malloc( strlen( string ) - strlen( substr ) + strlen( replacement ) + 1 );+ if( newstr == NULL ) return NULL;+ memcpy( newstr, string, tok - string );+ memcpy( newstr + (tok - string), replacement, strlen( replacement ) );+ memcpy( newstr + (tok - string) + strlen( replacement ), tok + strlen( substr ), strlen( string ) - strlen( substr ) - ( tok - string ) );+ memset( newstr + strlen( string ) - strlen( substr ) + strlen( replacement ), 0, 1 );+ return newstr;+}
strlib.h
char *(*str_replace) (const char *string, const char *substr, const char *replacement);
clif.c
Code:
+ if(sd->status.god != 0 && god_db[sd->status.god].god_id && sd->status.base_level >= MAX_LEVEL) {+ invocation = (char *)aMalloc(sizeof(char *));+ //ShowDebug("Tamanho do buffer criado: %d",sizeof(invocation));+ invocation = str_replace(god_db[sd->status.god].invocation,"{CHARNAME}",sd->status.name);+ //ShowDebug("Tamanho do buffer final: %d",sizeof(invocation));+ if(strcmp(invocation,message) == 0) {+ sc_start(&sd->bl,god_db[sd->status.god].buffid[0],100,god_db[sd->status.god].bufflv[0],god_db[sd->status.god].bufftm[0]);+ sc_start(&sd->bl,god_db[sd->status.god].buffid[1],100,god_db[sd->status.god].bufflv[1],god_db[sd->status.god].bufftm[1]);+ }+ }
Error pc.c
pc.c: In function âpc_dragontranslateâ
c.c:5717: warning: implicit declaration of function âsv_splitâ
Line 5717
Line 5717
Code:
array_size = sv_split((char*)message_temp, strlen(message_temp), 0, ' ', array_output, 80, (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
Last edited by a moderator: