ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/map.C
(Generate patch)

Comparing deliantra/server/common/map.C (file contents):
Revision 1.35 by root, Sun Dec 10 01:16:27 2006 UTC vs.
Revision 1.38 by pippijn, Mon Dec 11 19:46:46 2006 UTC

24 24
25#include <global.h> 25#include <global.h>
26#include <funcpoint.h> 26#include <funcpoint.h>
27 27
28#include <loader.h> 28#include <loader.h>
29#ifndef WIN32 /* ---win32 exclude header */
30# include <unistd.h> 29#include <unistd.h>
31#endif /* win32 */
32 30
33#include "path.h" 31#include "path.h"
34 32
35 33
36/* 34/*
157int 155int
158check_path (const char *name, int prepend_dir) 156check_path (const char *name, int prepend_dir)
159{ 157{
160 char buf[MAX_BUF]; 158 char buf[MAX_BUF];
161 159
162#ifndef WIN32
163 char *endbuf; 160 char *endbuf;
164 struct stat statbuf; 161 struct stat statbuf;
165 int mode = 0; 162 int mode = 0;
166#endif
167 163
168 if (prepend_dir) 164 if (prepend_dir)
169 strcpy (buf, create_pathname (name)); 165 strcpy (buf, create_pathname (name));
170 else 166 else
171 strcpy (buf, name); 167 strcpy (buf, name);
172#ifdef WIN32 /* ***win32: check this sucker in windows style. */
173 return (_access (buf, 0));
174#else
175 168
176 /* old method (strchr(buf, '\0')) seemd very odd to me - 169 /* old method (strchr(buf, '\0')) seemd very odd to me -
177 * this method should be equivalant and is clearer. 170 * this method should be equivalant and is clearer.
178 * Can not use strcat because we need to cycle through 171 * Can not use strcat because we need to cycle through
179 * all the names. 172 * all the names.
192 if ((statbuf.st_mode & S_IWGRP && getegid () == statbuf.st_gid) || 185 if ((statbuf.st_mode & S_IWGRP && getegid () == statbuf.st_gid) ||
193 (statbuf.st_mode & S_IWUSR && geteuid () == statbuf.st_uid) || (statbuf.st_mode & S_IWOTH)) 186 (statbuf.st_mode & S_IWUSR && geteuid () == statbuf.st_uid) || (statbuf.st_mode & S_IWOTH))
194 mode |= 2; 187 mode |= 2;
195 188
196 return (mode); 189 return (mode);
197#endif
198} 190}
199 191
200/* 192/*
201 * Prints out debug-information about a map. 193 * Prints out debug-information about a map.
202 * Dumping these at llevError doesn't seem right, but is 194 * Dumping these at llevError doesn't seem right, but is
860 852
861 while (fgets (buf, HUGE_BUF, fp) != NULL) 853 while (fgets (buf, HUGE_BUF, fp) != NULL)
862 { 854 {
863 buf[HUGE_BUF - 1] = 0; 855 buf[HUGE_BUF - 1] = 0;
864 key = buf; 856 key = buf;
857
865 while (isspace (*key)) 858 while (isspace (*key))
866 key++; 859 key++;
860
867 if (*key == 0) 861 if (*key == 0)
868 continue; /* empty line */ 862 continue; /* empty line */
863
869 value = strchr (key, ' '); 864 value = strchr (key, ' ');
865
870 if (!value) 866 if (!value)
871 { 867 {
872 end = strchr (key, '\n'); 868 if ((end = strchr (key, '\n')))
873 if (end != NULL)
874 {
875 *end = 0; 869 *end = 0;
876 }
877 } 870 }
878 else 871 else
879 { 872 {
880 *value = 0; 873 *value = 0;
881 value++; 874 value++;
882 end = strchr (value, '\n'); 875 end = strchr (value, '\n');
876
883 while (isspace (*value)) 877 while (isspace (*value))
884 { 878 {
885 value++; 879 value++;
880
886 if (*value == '\0' || value == end) 881 if (*value == '\0' || value == end)
887 { 882 {
888 /* Nothing but spaces. */ 883 /* Nothing but spaces. */
889 value = NULL; 884 value = NULL;
890 break; 885 break;
1427 print_shop_string (m, shop); 1422 print_shop_string (m, shop);
1428 fprintf (freezer, "shopitems %s\n", shop); 1423 fprintf (freezer, "shopitems %s\n", shop);
1429 } 1424 }
1430 if (m->shopgreed) 1425 if (m->shopgreed)
1431 fprintf (freezer, "shopgreed %f\n", m->shopgreed); 1426 fprintf (freezer, "shopgreed %f\n", m->shopgreed);
1432#ifndef WIN32
1433 if (m->shopmin) 1427 if (m->shopmin)
1434 fprintf (freezer, "shopmin %llu\n", m->shopmin); 1428 fprintf (freezer, "shopmin %llu\n", m->shopmin);
1435 if (m->shopmax) 1429 if (m->shopmax)
1436 fprintf (freezer, "shopmax %llu\n", m->shopmax); 1430 fprintf (freezer, "shopmax %llu\n", m->shopmax);
1437#else
1438 if (m->shopmin)
1439 fprintf (freezer, "shopmin %I64u\n", m->shopmin);
1440 if (m->shopmax)
1441 fprintf (freezer, "shopmax %I64u\n", m->shopmax);
1442#endif
1443 if (m->shoprace) 1431 if (m->shoprace)
1444 fprintf (freezer, "shoprace %s\n", m->shoprace); 1432 fprintf (freezer, "shoprace %s\n", m->shoprace);
1445 if (m->darkness) 1433 if (m->darkness)
1446 fprintf (freezer, "darkness %d\n", m->darkness); 1434 fprintf (freezer, "darkness %d\n", m->darkness);
1447 if (m->width) 1435 if (m->width)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines