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.37 by pippijn, Mon Dec 11 14:28:12 2006 UTC vs.
Revision 1.39 by root, Tue Dec 12 20:53:02 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
600 SET_FLAG (otmp, FLAG_OBJ_ORIGINAL); 592 SET_FLAG (otmp, FLAG_OBJ_ORIGINAL);
601 } 593 }
602 } 594 }
603 } 595 }
604 596
605 free_object (op); 597 op->destroy (0);
606 link_multipart_objects (m); 598 link_multipart_objects (m);
607} 599}
608 600
609/* This saves all the objects on the map in a non destructive fashion. 601/* This saves all the objects on the map in a non destructive fashion.
610 * Modified by MSW 2001-07-01 to do in a single pass - reduces code, 602 * Modified by MSW 2001-07-01 to do in a single pass - reduces code,
1316 if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) 1308 if (op->head == NULL && (QUERY_FLAG (op, FLAG_UNIQUE) || unique))
1317 { 1309 {
1318 clean_object (op); 1310 clean_object (op);
1319 if (QUERY_FLAG (op, FLAG_IS_LINKED)) 1311 if (QUERY_FLAG (op, FLAG_IS_LINKED))
1320 remove_button_link (op); 1312 remove_button_link (op);
1321 remove_ob (op); 1313 op->remove ();
1322 free_object (op); 1314 op->destroy (0);
1323 } 1315 }
1324 } 1316 }
1325 } 1317 }
1326} 1318}
1327 1319
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)
1532 { 1517 {
1533 next = tmp->below; 1518 next = tmp->below;
1534 clean_object (tmp); 1519 clean_object (tmp);
1535 if (QUERY_FLAG (tmp, FLAG_IS_LINKED)) 1520 if (QUERY_FLAG (tmp, FLAG_IS_LINKED))
1536 remove_button_link (tmp); 1521 remove_button_link (tmp);
1537 remove_ob (tmp); 1522 tmp->remove ();
1538 free_object (tmp); 1523 tmp->destroy (0);
1539 } 1524 }
1540} 1525}
1541 1526
1542/* 1527/*
1543 * Remove and free all objects in the given map. 1528 * Remove and free all objects in the given map.
1568 /* If the map isn't in memory, free_object will remove and 1553 /* If the map isn't in memory, free_object will remove and
1569 * free objects in op's inventory. So let it do the job. 1554 * free objects in op's inventory. So let it do the job.
1570 */ 1555 */
1571 if (m->in_memory == MAP_IN_MEMORY) 1556 if (m->in_memory == MAP_IN_MEMORY)
1572 clean_object (op); 1557 clean_object (op);
1573 remove_ob (op); 1558 op->remove ();
1574 free_object (op); 1559 op->destroy (0);
1575 } 1560 }
1576 } 1561 }
1577} 1562}
1578 1563
1579/* 1564/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines