summaryrefslogtreecommitdiff
path: root/src/tool
diff options
context:
space:
mode:
authorglighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-23 05:53:29 +0000
committerglighta <glighta@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-23 05:53:29 +0000
commit5c776e41bf6c13498e9575ee88aa2b2d47185f9e (patch)
treec5fd29d4eb4e6df15b393cd68c1e8b16350b5101 /src/tool
parent15762b30698842255bc545dee68705fad3447a4b (diff)
downloadhercules-5c776e41bf6c13498e9575ee88aa2b2d47185f9e.tar.gz
hercules-5c776e41bf6c13498e9575ee88aa2b2d47185f9e.tar.bz2
hercules-5c776e41bf6c13498e9575ee88aa2b2d47185f9e.tar.xz
hercules-5c776e41bf6c13498e9575ee88aa2b2d47185f9e.zip
-Apply mkdu95 fix for bugreport:5145 preventing clone if player dead, (for slave and evil clone)
-Fix old fread, fgets warnings, displaying a msg errors when failed now -Cleaning checkweight debug showinfo git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16952 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/tool')
-rw-r--r--src/tool/mapcache.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index 4eb435544..49f948709 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -125,7 +125,7 @@ int read_map(char *name, struct map_data *m)
rsw = (unsigned char *)grfio_read(filename);
// Read water height
- if (rsw) {
+ if (rsw) {
water_height = (int)GetFloat(rsw+166);
aFree(rsw);
} else
@@ -176,8 +176,8 @@ void cache_map(char *name, struct map_data *m)
encode_zip(write_buf, &len, m->cells, m->xs*m->ys);
// Fill the map header
- if (sizeof(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);
+ if (strlen(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, strlen(name), MAP_NAME_LENGTH);
strncpy(info.name, name, MAP_NAME_LENGTH);
info.xs = MakeShortLE(m->xs);
info.ys = MakeShortLE(m->ys);
@@ -201,12 +201,11 @@ int find_map(char *name)
{
int i;
struct map_info info;
- size_t fileReadCount;
-
+
fseek(map_cache_fp, sizeof(struct main_header), SEEK_SET);
for(i = 0; i < header.map_count; i++) {
- fileReadCount = fread(&info, sizeof(info), 1, map_cache_fp);
+ if(fread(&info, sizeof(info), 1, map_cache_fp) != 1) printf("An error as occured in fread while reading map_cache\n");
if(strcmp(name, info.name) == 0) // Map found
return 1;
else // Map not found, jump to the beginning of the next map info header
@@ -266,7 +265,7 @@ int do_init(int argc, char** argv)
"pre-re"
#endif
);
-
+
// Process the command-line arguments
process_args(argc, argv);
@@ -305,8 +304,7 @@ int do_init(int argc, char** argv)
header.file_size = sizeof(struct main_header);
header.map_count = 0;
} else {
- size_t fileReadCount;
- fileReadCount = fread(&header, sizeof(struct main_header), 1, map_cache_fp);
+ if(fread(&header, sizeof(struct main_header), 1, map_cache_fp) != 1){ printf("An error as occured while reading map_cache_fp \n"); }
header.file_size = GetULong((unsigned char *)&(header.file_size));
header.map_count = GetUShort((unsigned char *)&(header.map_count));
}