Jump to content
  • 0

properly reduce name length to 11


Jhedzkie

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  298
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

so, i saw this in char.c

char name[NAME_LENGTH];
char esc_name[NAME_LENGTH * 2 + 1];
int char_id, flag, k;

safestrncpy(name, name_, NAME_LENGTH);
normalize_name(name,TRIM_CHARS);
Sql_EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH));

and changed it into

char name[12];
char esc_name[12* 2 + 1];
int char_id, flag, k;

safestrncpy(name, name_, 12);
normalize_name(name,TRIM_CHARS);
Sql_EscapeStringLen(sql_handle, esc_name, name, strnlen(name, 12));

It works, right. however, it doesn't trigger the error message on character create screen that it exceeded the character name length. it would create the character but truncate the exceeding characters. what i hope to achieve is it would trigger the error that the entered name was more than 11 letters.

thanks in advanced.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  104
  • Reputation:   27
  • Joined:  12/05/13
  • Last Seen:  

I think you should edit mmo.h instead.

//For character names, title names, guilds, maps, etc.
//Includes null-terminator as it is the length of the array.
#define NAME_LENGTH (23 + 1)
#define PASSWD_LENGTH (32+1)

Not sure. I haven't tested this. ;)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  298
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

I believe that would affect everything that has something to do with the character name. I only want to reduce it to 11 chars on character creation time. This is to allow titles to be given to players from the achievement system that I am currently using. 

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...