Some errors at compile my rAthena patch here in Hercules

Yum

New member
Messages
7
Points
0
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

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
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â:pc.c:5717: warning: implicit declaration of function âsv_splitâ

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:
You can't patch rAthena diffs into Hercules so easily. Hercules' Source has gone through some major overhauling and to simply put it in real terms, you can't patch diffs that were made for rAthena automatically towards Hercules. You would need to change the diff a little bit to fit Hercules' source code since Hercules and rAthena has a different source structure.
 
I know that, I added the patch manually and succeeded in correcting some errors. These other I could not and that's why I'm asking for help.

 
I can try to convert it to fit hercules, but seeing only part of the diff is hard

 
Back
Top