… | |
… | |
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 | /* |
… | |
… | |
157 | int |
155 | int |
158 | check_path (const char *name, int prepend_dir) |
156 | check_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 |
… | |
… | |
871 | |
863 | |
872 | value = strchr (key, ' '); |
864 | value = strchr (key, ' '); |
873 | |
865 | |
874 | if (!value) |
866 | if (!value) |
875 | { |
867 | { |
876 | if (end = strchr (key, '\n')) |
868 | if ((end = strchr (key, '\n'))) |
877 | *end = 0; |
869 | *end = 0; |
878 | } |
870 | } |
879 | else |
871 | else |
880 | { |
872 | { |
881 | *value = 0; |
873 | *value = 0; |
… | |
… | |
1430 | print_shop_string (m, shop); |
1422 | print_shop_string (m, shop); |
1431 | fprintf (freezer, "shopitems %s\n", shop); |
1423 | fprintf (freezer, "shopitems %s\n", shop); |
1432 | } |
1424 | } |
1433 | if (m->shopgreed) |
1425 | if (m->shopgreed) |
1434 | fprintf (freezer, "shopgreed %f\n", m->shopgreed); |
1426 | fprintf (freezer, "shopgreed %f\n", m->shopgreed); |
1435 | #ifndef WIN32 |
|
|
1436 | if (m->shopmin) |
1427 | if (m->shopmin) |
1437 | fprintf (freezer, "shopmin %llu\n", m->shopmin); |
1428 | fprintf (freezer, "shopmin %llu\n", m->shopmin); |
1438 | if (m->shopmax) |
1429 | if (m->shopmax) |
1439 | fprintf (freezer, "shopmax %llu\n", m->shopmax); |
1430 | fprintf (freezer, "shopmax %llu\n", m->shopmax); |
1440 | #else |
|
|
1441 | if (m->shopmin) |
|
|
1442 | fprintf (freezer, "shopmin %I64u\n", m->shopmin); |
|
|
1443 | if (m->shopmax) |
|
|
1444 | fprintf (freezer, "shopmax %I64u\n", m->shopmax); |
|
|
1445 | #endif |
|
|
1446 | if (m->shoprace) |
1431 | if (m->shoprace) |
1447 | fprintf (freezer, "shoprace %s\n", m->shoprace); |
1432 | fprintf (freezer, "shoprace %s\n", m->shoprace); |
1448 | if (m->darkness) |
1433 | if (m->darkness) |
1449 | fprintf (freezer, "darkness %d\n", m->darkness); |
1434 | fprintf (freezer, "darkness %d\n", m->darkness); |
1450 | if (m->width) |
1435 | if (m->width) |