--- deliantra/server/common/map.C 2006/12/03 02:04:57 1.34 +++ deliantra/server/common/map.C 2006/12/11 19:46:46 1.38 @@ -26,9 +26,7 @@ #include #include -#ifndef WIN32 /* ---win32 exclude header */ -# include -#endif /* win32 */ +#include #include "path.h" @@ -159,19 +157,14 @@ { char buf[MAX_BUF]; -#ifndef WIN32 char *endbuf; struct stat statbuf; int mode = 0; -#endif if (prepend_dir) strcpy (buf, create_pathname (name)); else strcpy (buf, name); -#ifdef WIN32 /* ***win32: check this sucker in windows style. */ - return (_access (buf, 0)); -#else /* old method (strchr(buf, '\0')) seemd very odd to me - * this method should be equivalant and is clearer. @@ -194,7 +187,6 @@ mode |= 2; return (mode); -#endif } /* @@ -858,31 +850,34 @@ int msgpos = 0; int maplorepos = 0; - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { buf[HUGE_BUF - 1] = 0; key = buf; + while (isspace (*key)) key++; + if (*key == 0) continue; /* empty line */ + value = strchr (key, ' '); + if (!value) { - end = strchr (key, '\n'); - if (end != NULL) - { - *end = 0; - } + if ((end = strchr (key, '\n'))) + *end = 0; } else { *value = 0; value++; end = strchr (value, '\n'); + while (isspace (*value)) { value++; + if (*value == '\0' || value == end) { /* Nothing but spaces. */ @@ -915,7 +910,7 @@ if (!strcmp (key, "msg")) { - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { if (!strcmp (buf, "endmsg\n")) break; @@ -936,7 +931,7 @@ } else if (!strcmp (key, "maplore")) { - while (fgets (buf, HUGE_BUF - 1, fp) != NULL) + while (fgets (buf, HUGE_BUF, fp) != NULL) { if (!strcmp (buf, "endmaplore\n")) break; @@ -1429,17 +1424,10 @@ } if (m->shopgreed) fprintf (freezer, "shopgreed %f\n", m->shopgreed); -#ifndef WIN32 if (m->shopmin) fprintf (freezer, "shopmin %llu\n", m->shopmin); if (m->shopmax) fprintf (freezer, "shopmax %llu\n", m->shopmax); -#else - if (m->shopmin) - fprintf (freezer, "shopmin %I64u\n", m->shopmin); - if (m->shopmax) - fprintf (freezer, "shopmax %I64u\n", m->shopmax); -#endif if (m->shoprace) fprintf (freezer, "shoprace %s\n", m->shoprace); if (m->darkness)