浏览代码

- There will now be a warning regarding to map name length limitation (part of bugreport:1688).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16950 54d463be-8e91-2dee-dedb-b68131a5f0ec
momacabu 12 年之前
父节点
当前提交
96c2cf57d3
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/tool/mapcache.c

+ 2 - 0
src/tool/mapcache.c

@@ -176,6 +176,8 @@ void cache_map(char *name, struct map_data *m)
 	encode_zip(write_buf, &len, m->cells, m->xs*m->ys);
 	encode_zip(write_buf, &len, m->cells, m->xs*m->ys);
 
 
 	// Fill the map header
 	// Fill the map header
+	if (name > MAP_NAME_LENGTH) // It does not hurt to warn that there are maps with name longer than allowed.
+		ShowWarning ("Map name '%s' size '%d' is too long. Truncating to '%d'.\n", name, sizeof(name), MAP_NAME_LENGTH);
 	strncpy(info.name, name, MAP_NAME_LENGTH);
 	strncpy(info.name, name, MAP_NAME_LENGTH);
 	info.xs = MakeShortLE(m->xs);
 	info.xs = MakeShortLE(m->xs);
 	info.ys = MakeShortLE(m->ys);
 	info.ys = MakeShortLE(m->ys);