Jump to content
  • 0
Sign in to follow this  
Yum

Some errors at compile my rAthena patch here in Hercules

Question

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
+	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

array_size = sv_split((char*)message_temp, strlen(message_temp), 0, ' ', array_output, 80, (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));

 

 

Edited by Yum

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

 

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.

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.