|
@@ -2222,27 +2222,27 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
|
|
|
{
|
|
|
const char* p;
|
|
|
struct npc_data* dnd;// duplicate npc
|
|
|
- char newname[NAME_LENGTH];
|
|
|
+ char newname[NPC_NAME_LENGTH+1];
|
|
|
|
|
|
// parse name
|
|
|
p = strstr(name,"::");
|
|
|
if( p ) { // <Display name>::<Unique name>
|
|
|
size_t len = p-name;
|
|
|
- if( len > NAME_LENGTH ) {
|
|
|
- ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
|
|
|
+ if( len > NPC_NAME_LENGTH ) {
|
|
|
+ ShowWarning("npc_parsename: Display name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NPC_NAME_LENGTH);
|
|
|
safestrncpy(nd->name, name, sizeof(nd->name));
|
|
|
} else {
|
|
|
memcpy(nd->name, name, len);
|
|
|
memset(nd->name+len, 0, sizeof(nd->name)-len);
|
|
|
}
|
|
|
len = strlen(p+2);
|
|
|
- if( len > NAME_LENGTH )
|
|
|
- ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
|
|
|
+ if( len > NPC_NAME_LENGTH )
|
|
|
+ ShowWarning("npc_parsename: Unique name of '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NPC_NAME_LENGTH);
|
|
|
safestrncpy(nd->exname, p+2, sizeof(nd->exname));
|
|
|
} else {// <Display name>
|
|
|
size_t len = strlen(name);
|
|
|
- if( len > NAME_LENGTH )
|
|
|
- ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NAME_LENGTH);
|
|
|
+ if( len > NPC_NAME_LENGTH )
|
|
|
+ ShowWarning("npc_parsename: Name '%s' is too long (len=%u) in file '%s', line'%d'. Truncating to %u characters.\n", name, (unsigned int)len, filepath, strline(buffer,start-buffer), NPC_NAME_LENGTH);
|
|
|
safestrncpy(nd->name, name, sizeof(nd->name));
|
|
|
safestrncpy(nd->exname, name, sizeof(nd->exname));
|
|
|
}
|
|
@@ -2773,9 +2773,9 @@ int npc_convertlabel_db(DBKey key, DBData *data, va_list ap)
|
|
|
len = p-lname;
|
|
|
|
|
|
// here we check if the label fit into the buffer
|
|
|
- if( len > 23 )
|
|
|
+ if( len > NAME_LENGTH )
|
|
|
{
|
|
|
- ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, filepath);
|
|
|
+ ShowError("npc_parse_script: label name longer than %d chars! '%s'\n (%s)", NAME_LENGTH, lname, filepath);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -3152,7 +3152,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
|
|
|
}
|
|
|
|
|
|
int npc_duplicate4instance(struct npc_data *snd, int16 m) {
|
|
|
- char newname[NAME_LENGTH];
|
|
|
+ char newname[NPC_NAME_LENGTH+1];
|
|
|
|
|
|
if( map[m].instance_id == 0 )
|
|
|
return 1;
|
|
@@ -4627,11 +4627,11 @@ void do_init_npc(void){
|
|
|
for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ )
|
|
|
npc_viewdb2[i - MAX_NPC_CLASS2_START].class_ = i;
|
|
|
|
|
|
- ev_db = strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA),2*NAME_LENGTH+2+1);
|
|
|
- npcname_db = strdb_alloc(DB_OPT_BASE,NAME_LENGTH);
|
|
|
+ ev_db = strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA), EVENT_NAME_LENGTH);
|
|
|
+ npcname_db = strdb_alloc(DB_OPT_BASE, NPC_NAME_LENGTH+1);
|
|
|
npc_path_db = strdb_alloc(DB_OPT_BASE|DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA,80);
|
|
|
#if PACKETVER >= 20131223
|
|
|
- NPCMarketDB = strdb_alloc(DB_OPT_BASE, NAME_LENGTH+1);
|
|
|
+ NPCMarketDB = strdb_alloc(DB_OPT_BASE, NPC_NAME_LENGTH+1);
|
|
|
npc_market_fromsql();
|
|
|
#endif
|
|
|
|