1 | /* |
1 | /* |
2 | * static char *rcsid_map_c = |
2 | * static char *rcsid_map_c = |
3 | * "$Id: map.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; |
3 | * "$Id: map.C,v 1.9 2006/08/27 16:15:11 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
37 | |
37 | |
38 | #include "path.h" |
38 | #include "path.h" |
39 | |
39 | |
40 | |
40 | |
41 | extern int nrofallocobjects,nroffreeobjects; |
41 | extern int nrofallocobjects,nroffreeobjects; |
42 | |
|
|
43 | void (*load_original_map_callback)(mapstruct *map); |
|
|
44 | void (*load_temporary_map_callback)(mapstruct *map); |
|
|
45 | void (*clean_temporary_map_callback)(mapstruct *map); |
|
|
46 | |
42 | |
47 | /* |
43 | /* |
48 | * Returns the mapstruct which has a name matching the given argument. |
44 | * Returns the mapstruct which has a name matching the given argument. |
49 | * return NULL if no match is found. |
45 | * return NULL if no match is found. |
50 | */ |
46 | */ |
… | |
… | |
268 | retval |= P_NEW_MAP; |
264 | retval |= P_NEW_MAP; |
269 | if (newmap) *newmap = mp; |
265 | if (newmap) *newmap = mp; |
270 | if (nx) *nx = newx; |
266 | if (nx) *nx = newx; |
271 | if (ny) *ny = newy; |
267 | if (ny) *ny = newy; |
272 | retval |= mp->spaces[newx + mp->width * newy].flags; |
268 | retval |= mp->spaces[newx + mp->width * newy].flags; |
|
|
269 | |
|
|
270 | if (retval & P_SAFE) |
|
|
271 | retval |= P_NO_MAGIC | P_NO_CLERIC; // P_SAFE does imply these |
|
|
272 | |
273 | return retval; |
273 | return retval; |
274 | } |
274 | } |
275 | |
275 | |
276 | |
276 | |
277 | /* |
277 | /* |
… | |
… | |
516 | * Loads (ands parses) the objects into a given map from the specified |
516 | * Loads (ands parses) the objects into a given map from the specified |
517 | * file pointer. |
517 | * file pointer. |
518 | * mapflags is the same as we get with load_original_map |
518 | * mapflags is the same as we get with load_original_map |
519 | */ |
519 | */ |
520 | |
520 | |
521 | void load_objects (mapstruct *m, FILE *fp, int mapflags) { |
521 | void load_objects (mapstruct *m, FILE *fp, object_thawer &thawer, int mapflags) { |
522 | int i,j,bufstate=LO_NEWFILE; |
522 | int i,j,bufstate=LO_NEWFILE; |
523 | int unique; |
523 | int unique; |
524 | object *op, *prev=NULL,*last_more=NULL, *otmp; |
524 | object *op, *prev=NULL,*last_more=NULL, *otmp; |
525 | |
525 | |
526 | op=get_object(); |
526 | op=get_object(); |
527 | op->map = m; /* To handle buttons correctly */ |
527 | op->map = m; /* To handle buttons correctly */ |
528 | |
528 | |
529 | while((i=load_object(fp,op,bufstate, mapflags))) { |
529 | while((i = load_object (fp, thawer, op, bufstate, mapflags))) { |
530 | /* Since the loading of the map header does not load an object |
530 | /* Since the loading of the map header does not load an object |
531 | * anymore, we need to pass LO_NEWFILE for the first object loaded, |
531 | * anymore, we need to pass LO_NEWFILE for the first object loaded, |
532 | * and then switch to LO_REPEAT for faster loading. |
532 | * and then switch to LO_REPEAT for faster loading. |
533 | */ |
533 | */ |
534 | bufstate = LO_REPEAT; |
534 | bufstate = LO_REPEAT; |
… | |
… | |
588 | /* This saves all the objects on the map in a non destructive fashion. |
588 | /* This saves all the objects on the map in a non destructive fashion. |
589 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
589 | * Modified by MSW 2001-07-01 to do in a single pass - reduces code, |
590 | * and we only save the head of multi part objects - this is needed |
590 | * and we only save the head of multi part objects - this is needed |
591 | * in order to do map tiling properly. |
591 | * in order to do map tiling properly. |
592 | */ |
592 | */ |
593 | void save_objects (mapstruct *m, FILE *fp, FILE *fp2, int flag) { |
593 | void save_objects (mapstruct *m, FILE *fp, object_freezer &freezer, FILE *fp2, object_freezer &freezer2, int flag) { |
594 | int i, j = 0,unique=0; |
594 | int i, j = 0,unique=0; |
595 | object *op; |
595 | object *op; |
596 | /* first pass - save one-part objects */ |
596 | /* first pass - save one-part objects */ |
597 | for(i = 0; i < MAP_WIDTH(m); i++) |
597 | for(i = 0; i < MAP_WIDTH(m); i++) |
598 | for (j = 0; j < MAP_HEIGHT(m); j++) { |
598 | for (j = 0; j < MAP_HEIGHT(m); j++) { |
… | |
… | |
608 | |
608 | |
609 | if (op->head || op->owner) |
609 | if (op->head || op->owner) |
610 | continue; |
610 | continue; |
611 | |
611 | |
612 | if (unique || QUERY_FLAG(op, FLAG_UNIQUE)) |
612 | if (unique || QUERY_FLAG(op, FLAG_UNIQUE)) |
613 | save_object( fp2 , op, 3); |
613 | save_object( fp2 , freezer2, op, 3); |
614 | else |
614 | else |
615 | if (flag == 0 || |
615 | if (flag == 0 || |
616 | (flag == 2 && (!QUERY_FLAG(op, FLAG_OBJ_ORIGINAL) && |
616 | (flag == 2 && (!QUERY_FLAG(op, FLAG_OBJ_ORIGINAL) && |
617 | !QUERY_FLAG(op, FLAG_UNPAID)))) |
617 | !QUERY_FLAG(op, FLAG_UNPAID)))) |
618 | save_object(fp, op, 3); |
618 | save_object(fp, freezer, op, 3); |
619 | |
619 | |
620 | } /* for this space */ |
620 | } /* for this space */ |
621 | } /* for this j */ |
621 | } /* for this j */ |
622 | } |
622 | } |
623 | |
623 | |
… | |
… | |
945 | m->winddir = atoi(value); |
945 | m->winddir = atoi(value); |
946 | } else if (!strcmp(key, "sky")) { |
946 | } else if (!strcmp(key, "sky")) { |
947 | m->sky = atoi(value); |
947 | m->sky = atoi(value); |
948 | } else if (!strcmp(key, "nosmooth")) { |
948 | } else if (!strcmp(key, "nosmooth")) { |
949 | m->nosmooth = atoi(value); |
949 | m->nosmooth = atoi(value); |
|
|
950 | } else if (!strcmp(key, "safe_map")) { |
|
|
951 | m->safe_map = atoi(value); |
950 | } |
952 | } |
951 | else if (!strncmp(key,"tile_path_", 10)) { |
953 | else if (!strncmp(key,"tile_path_", 10)) { |
952 | int tile=atoi(key+10); |
954 | int tile=atoi(key+10); |
953 | |
955 | |
954 | if (tile<1 || tile>4) { |
956 | if (tile<1 || tile>4) { |
… | |
… | |
1029 | if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { |
1031 | if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { |
1030 | LOG(llevError, "Can't open %s: %s\n", pathname, strerror_local(errno)); |
1032 | LOG(llevError, "Can't open %s: %s\n", pathname, strerror_local(errno)); |
1031 | return (NULL); |
1033 | return (NULL); |
1032 | } |
1034 | } |
1033 | |
1035 | |
|
|
1036 | object_thawer thawer (filename); |
|
|
1037 | |
1034 | m = get_linked_map(); |
1038 | m = get_linked_map(); |
1035 | |
1039 | |
1036 | strcpy (m->path, filename); |
1040 | strcpy (m->path, filename); |
1037 | if (load_map_header(fp, m)) { |
1041 | if (load_map_header(fp, m)) { |
1038 | LOG(llevError,"Error loading map header for %s, flags=%d\n", |
1042 | LOG(llevError,"Error loading map header for %s, flags=%d\n", |
… | |
… | |
1043 | |
1047 | |
1044 | allocate_map(m); |
1048 | allocate_map(m); |
1045 | m->compressed = comp; |
1049 | m->compressed = comp; |
1046 | |
1050 | |
1047 | m->in_memory=MAP_LOADING; |
1051 | m->in_memory=MAP_LOADING; |
1048 | load_objects (m, fp, flags & (MAP_BLOCK|MAP_STYLE)); |
1052 | load_objects (m, fp, thawer, flags & (MAP_BLOCK|MAP_STYLE)); |
1049 | close_and_delete(fp, comp); |
1053 | close_and_delete(fp, comp); |
1050 | m->in_memory=MAP_IN_MEMORY; |
1054 | m->in_memory=MAP_IN_MEMORY; |
1051 | if (!MAP_DIFFICULTY(m)) |
1055 | if (!MAP_DIFFICULTY(m)) |
1052 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1056 | MAP_DIFFICULTY(m)=calculate_difficulty(m); |
1053 | set_map_reset_time(m); |
1057 | set_map_reset_time(m); |
1054 | if (load_original_map_callback) |
1058 | INVOKE_MAP (LOAD, m); |
1055 | load_original_map_callback(m); |
|
|
1056 | return (m); |
1059 | return (m); |
1057 | } |
1060 | } |
1058 | |
1061 | |
1059 | /* |
1062 | /* |
1060 | * Loads a map, which has been loaded earlier, from file. |
1063 | * Loads a map, which has been loaded earlier, from file. |
… | |
… | |
1084 | m = load_original_map(buf, 0); |
1087 | m = load_original_map(buf, 0); |
1085 | if(m==NULL) return NULL; |
1088 | if(m==NULL) return NULL; |
1086 | fix_auto_apply(m); /* Chests which open as default */ |
1089 | fix_auto_apply(m); /* Chests which open as default */ |
1087 | return m; |
1090 | return m; |
1088 | } |
1091 | } |
1089 | |
1092 | |
|
|
1093 | object_thawer thawer (m->tmpname); |
1090 | |
1094 | |
1091 | if (load_map_header(fp, m)) { |
1095 | if (load_map_header(fp, m)) { |
1092 | LOG(llevError,"Error loading map header for %s (%s)\n", |
1096 | LOG(llevError,"Error loading map header for %s (%s)\n", |
1093 | m->path, m->tmpname); |
1097 | m->path, m->tmpname); |
1094 | delete_map(m); |
1098 | delete_map(m); |
… | |
… | |
1097 | } |
1101 | } |
1098 | m->compressed = comp; |
1102 | m->compressed = comp; |
1099 | allocate_map(m); |
1103 | allocate_map(m); |
1100 | |
1104 | |
1101 | m->in_memory=MAP_LOADING; |
1105 | m->in_memory=MAP_LOADING; |
1102 | load_objects (m, fp, 0); |
1106 | load_objects (m, fp, thawer, 0); |
1103 | close_and_delete(fp, comp); |
1107 | close_and_delete(fp, comp); |
1104 | m->in_memory=MAP_IN_MEMORY; |
1108 | m->in_memory=MAP_IN_MEMORY; |
1105 | if (load_temporary_map_callback) |
1109 | INVOKE_MAP (SWAPIN, m); |
1106 | load_temporary_map_callback(m); |
|
|
1107 | return m; |
1110 | return m; |
1108 | } |
1111 | } |
1109 | |
1112 | |
1110 | /* |
1113 | /* |
1111 | * Loads a map, which has been loaded earlier, from file. |
1114 | * Loads a map, which has been loaded earlier, from file. |
… | |
… | |
1122 | |
1125 | |
1123 | if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { |
1126 | if((fp=open_and_uncompress(pathname, 0, &comp))==NULL) { |
1124 | /* LOG(llevDebug,"Can't open overlay %s\n", pathname);*/ |
1127 | /* LOG(llevDebug,"Can't open overlay %s\n", pathname);*/ |
1125 | return m; |
1128 | return m; |
1126 | } |
1129 | } |
|
|
1130 | |
|
|
1131 | object_thawer thawer (pathname); |
1127 | |
1132 | |
1128 | if (load_map_header(fp, m)) { |
1133 | if (load_map_header(fp, m)) { |
1129 | LOG(llevError,"Error loading map header for overlay %s (%s)\n", |
1134 | LOG(llevError,"Error loading map header for overlay %s (%s)\n", |
1130 | m->path, pathname); |
1135 | m->path, pathname); |
1131 | delete_map(m); |
1136 | delete_map(m); |
… | |
… | |
1134 | } |
1139 | } |
1135 | m->compressed = comp; |
1140 | m->compressed = comp; |
1136 | /*allocate_map(m);*/ |
1141 | /*allocate_map(m);*/ |
1137 | |
1142 | |
1138 | m->in_memory=MAP_LOADING; |
1143 | m->in_memory=MAP_LOADING; |
1139 | load_objects (m, fp, MAP_OVERLAY); |
1144 | load_objects (m, fp, thawer, MAP_OVERLAY); |
1140 | close_and_delete(fp, comp); |
1145 | close_and_delete(fp, comp); |
1141 | m->in_memory=MAP_IN_MEMORY; |
1146 | m->in_memory=MAP_IN_MEMORY; |
1142 | return m; |
1147 | return m; |
1143 | } |
1148 | } |
1144 | |
1149 | |
… | |
… | |
1193 | */ |
1198 | */ |
1194 | LOG(llevDebug, "Can't open unique items file for %s\n", create_items_path(m->path)); |
1199 | LOG(llevDebug, "Can't open unique items file for %s\n", create_items_path(m->path)); |
1195 | return; |
1200 | return; |
1196 | } |
1201 | } |
1197 | |
1202 | |
|
|
1203 | object_thawer thawer (firstname); |
|
|
1204 | |
1198 | m->in_memory=MAP_LOADING; |
1205 | m->in_memory=MAP_LOADING; |
1199 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1206 | if (m->tmpname == NULL) /* if we have loaded unique items from */ |
1200 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1207 | delete_unique_items(m); /* original map before, don't duplicate them */ |
1201 | load_object(fp, NULL, LO_NOREAD,0); |
1208 | load_object(fp, thawer, NULL, LO_NOREAD,0); |
1202 | load_objects (m, fp, 0); |
1209 | load_objects (m, fp, thawer, 0); |
1203 | close_and_delete(fp, comp); |
1210 | close_and_delete(fp, comp); |
1204 | m->in_memory=MAP_IN_MEMORY; |
1211 | m->in_memory=MAP_IN_MEMORY; |
1205 | } |
1212 | } |
1206 | |
1213 | |
1207 | |
1214 | |
… | |
… | |
1214 | * (this should have been updated when first loaded) |
1221 | * (this should have been updated when first loaded) |
1215 | */ |
1222 | */ |
1216 | |
1223 | |
1217 | int new_save_map(mapstruct *m, int flag) { |
1224 | int new_save_map(mapstruct *m, int flag) { |
1218 | FILE *fp, *fp2; |
1225 | FILE *fp, *fp2; |
1219 | char filename[MAX_BUF],buf[MAX_BUF], shop[MAX_BUF]; |
1226 | char filename[MAX_BUF],buf[MAX_BUF], buf_s[MAX_BUF], |
|
|
1227 | shop[MAX_BUF], filename_s[MAX_BUF]; |
1220 | int i; |
1228 | int i; |
1221 | |
1229 | |
1222 | if (flag && !*m->path) { |
1230 | if (flag && !*m->path) { |
1223 | LOG(llevError,"Tried to save map without path.\n"); |
1231 | LOG(llevError,"Tried to save map without path.\n"); |
1224 | return -1; |
1232 | return -1; |
… | |
… | |
1245 | } else { |
1253 | } else { |
1246 | if (!m->tmpname) |
1254 | if (!m->tmpname) |
1247 | m->tmpname = tempnam_local(settings.tmpdir,NULL); |
1255 | m->tmpname = tempnam_local(settings.tmpdir,NULL); |
1248 | strcpy(filename, m->tmpname); |
1256 | strcpy(filename, m->tmpname); |
1249 | } |
1257 | } |
1250 | LOG(llevDebug,"Saving map %s\n",m->path); |
1258 | LOG(llevDebug,"Saving map %s to %s\n", m->path, filename); |
1251 | m->in_memory = MAP_SAVING; |
1259 | m->in_memory = MAP_SAVING; |
1252 | |
1260 | |
1253 | unlink (filename); // do not overwrite backups if done via hardlinks |
1261 | sprintf (filename_s, "%s~", filename); |
1254 | |
1262 | |
1255 | /* Compress if it isn't a temporary save. Do compress if unique */ |
1263 | /* Compress if it isn't a temporary save. Do compress if unique */ |
1256 | if (m->compressed && (m->unique || m->templatemap || flag)) { |
1264 | if (m->compressed && (m->unique || m->templatemap || flag)) { |
1257 | char buf[MAX_BUF]; |
1265 | char buf[MAX_BUF]; |
1258 | strcpy(buf, uncomp[m->compressed][2]); |
1266 | strcpy(buf, uncomp[m->compressed][2]); |
1259 | strcat(buf, " > "); |
1267 | strcat(buf, " > "); |
1260 | strcat(buf, filename); |
1268 | strcat(buf, filename_s); |
1261 | fp = popen(buf, "w"); |
1269 | fp = popen(buf, "w"); |
1262 | } else |
1270 | } else |
1263 | fp = fopen(filename, "w"); |
1271 | fp = fopen(filename_s, "w"); |
1264 | |
1272 | |
1265 | if(fp == NULL) { |
1273 | if(fp == NULL) { |
1266 | LOG(llevError, "Cannot write %s: %s\n", filename, strerror_local(errno)); |
1274 | LOG(llevError, "Cannot write %s: %s\n", filename_s, strerror_local(errno)); |
1267 | return -1; |
1275 | return -1; |
1268 | } |
1276 | } |
|
|
1277 | |
|
|
1278 | object_freezer freezer (filename); |
1269 | |
1279 | |
1270 | /* legacy */ |
1280 | /* legacy */ |
1271 | fprintf(fp,"arch map\n"); |
1281 | fprintf(fp,"arch map\n"); |
1272 | if (m->name) fprintf(fp,"name %s\n", m->name); |
1282 | if (m->name) fprintf(fp,"name %s\n", m->name); |
1273 | if (!flag) fprintf(fp,"swap_time %d\n", m->swap_time); |
1283 | if (!flag) fprintf(fp,"swap_time %d\n", m->swap_time); |
… | |
… | |
1306 | if (m->humid) fprintf(fp, "humid %d\n", m->humid); |
1316 | if (m->humid) fprintf(fp, "humid %d\n", m->humid); |
1307 | if (m->windspeed) fprintf(fp, "windspeed %d\n", m->windspeed); |
1317 | if (m->windspeed) fprintf(fp, "windspeed %d\n", m->windspeed); |
1308 | if (m->winddir) fprintf(fp, "winddir %d\n", m->winddir); |
1318 | if (m->winddir) fprintf(fp, "winddir %d\n", m->winddir); |
1309 | if (m->sky) fprintf(fp, "sky %d\n", m->sky); |
1319 | if (m->sky) fprintf(fp, "sky %d\n", m->sky); |
1310 | if (m->nosmooth) fprintf(fp, "nosmooth %d\n", m->nosmooth); |
1320 | if (m->nosmooth) fprintf(fp, "nosmooth %d\n", m->nosmooth); |
|
|
1321 | if (m->safe_map) fprintf(fp, "safe_map %d\n", m->safe_map); |
1311 | |
1322 | |
1312 | /* Save any tiling information, except on overlays */ |
1323 | /* Save any tiling information, except on overlays */ |
1313 | if (flag != 2) |
1324 | if (flag != 2) |
1314 | for (i=0; i<4; i++) |
1325 | for (i=0; i<4; i++) |
1315 | if (m->tile_path[i]) |
1326 | if (m->tile_path[i]) |
… | |
… | |
1320 | /* In the game save unique items in the different file, but |
1331 | /* In the game save unique items in the different file, but |
1321 | * in the editor save them to the normal map file. |
1332 | * in the editor save them to the normal map file. |
1322 | * If unique map, save files in the proper destination (set by |
1333 | * If unique map, save files in the proper destination (set by |
1323 | * player) |
1334 | * player) |
1324 | */ |
1335 | */ |
1325 | fp2 = fp; /* save unique items into fp2 */ |
|
|
1326 | if ((flag == 0 || flag == 2) && !m->unique && !m->templatemap) { |
1336 | if ((flag == 0 || flag == 2) && !m->unique && !m->templatemap) { |
1327 | sprintf (buf,"%s.v00",create_items_path (m->path)); |
1337 | sprintf (buf,"%s.v00",create_items_path (m->path)); |
|
|
1338 | sprintf (buf_s, "%s~", buf); |
1328 | if ((fp2 = fopen (buf, "w")) == NULL) { |
1339 | if ((fp2 = fopen (buf_s, "w")) == NULL) { |
1329 | LOG(llevError, "Can't open unique items file %s\n", buf); |
1340 | LOG(llevError, "Can't open unique items file %s\n", buf_s); |
1330 | } |
1341 | } |
|
|
1342 | |
|
|
1343 | object_freezer freezer2 (buf); |
|
|
1344 | |
1331 | if (flag == 2) |
1345 | if (flag == 2) |
1332 | save_objects(m, fp, fp2, 2); |
1346 | save_objects(m, fp, freezer, fp2, freezer2, 2); |
1333 | else |
1347 | else |
1334 | save_objects (m, fp, fp2, 0); |
1348 | save_objects (m, fp,freezer, fp2, freezer2, 0); |
1335 | if (fp2 != NULL) { |
1349 | if (fp2 != NULL) { |
1336 | if (ftell (fp2) == 0) { |
1350 | if (ftell (fp2) == 0) { |
1337 | fclose (fp2); |
1351 | fclose (fp2); |
|
|
1352 | rename (buf_s, buf); |
1338 | unlink (buf); |
1353 | unlink (buf); |
1339 | } else { |
1354 | } else { |
1340 | fclose (fp2); |
1355 | fclose (fp2); |
|
|
1356 | rename (buf_s, buf); |
1341 | chmod (buf, SAVE_MODE); |
1357 | chmod (buf, SAVE_MODE); |
1342 | } |
1358 | } |
1343 | } |
1359 | } |
1344 | } else { /* save same file when not playing, like in editor */ |
1360 | } else { /* save same file when not playing, like in editor */ |
1345 | save_objects(m, fp, fp, 0); |
1361 | save_objects(m, fp, freezer, fp, freezer, 0); |
1346 | } |
1362 | } |
1347 | |
1363 | |
1348 | if (m->compressed && (m->unique || m->templatemap || flag)) |
1364 | if (m->compressed && (m->unique || m->templatemap || flag)) |
1349 | pclose(fp); |
1365 | pclose(fp); |
1350 | else |
1366 | else |
1351 | fclose(fp); |
1367 | fclose(fp); |
|
|
1368 | |
|
|
1369 | rename (filename_s, filename); |
1352 | |
1370 | |
1353 | chmod (filename, SAVE_MODE); |
1371 | chmod (filename, SAVE_MODE); |
1354 | return 0; |
1372 | return 0; |
1355 | } |
1373 | } |
1356 | |
1374 | |
… | |
… | |
1669 | } |
1687 | } |
1670 | |
1688 | |
1671 | void clean_tmp_map(mapstruct *m) { |
1689 | void clean_tmp_map(mapstruct *m) { |
1672 | if(m->tmpname == NULL) |
1690 | if(m->tmpname == NULL) |
1673 | return; |
1691 | return; |
1674 | if (clean_temporary_map_callback) |
1692 | INVOKE_MAP (CLEAN, m); |
1675 | clean_temporary_map_callback (m); |
|
|
1676 | (void) unlink(m->tmpname); |
1693 | (void) unlink(m->tmpname); |
1677 | } |
1694 | } |
1678 | |
1695 | |
1679 | void free_all_maps(void) |
1696 | void free_all_maps(void) |
1680 | { |
1697 | { |
… | |
… | |
1819 | flags |= P_IS_ALIVE; |
1836 | flags |= P_IS_ALIVE; |
1820 | if (QUERY_FLAG(tmp,FLAG_NO_MAGIC)) |
1837 | if (QUERY_FLAG(tmp,FLAG_NO_MAGIC)) |
1821 | flags |= P_NO_MAGIC; |
1838 | flags |= P_NO_MAGIC; |
1822 | if (QUERY_FLAG(tmp,FLAG_DAMNED)) |
1839 | if (QUERY_FLAG(tmp,FLAG_DAMNED)) |
1823 | flags |= P_NO_CLERIC; |
1840 | flags |= P_NO_CLERIC; |
|
|
1841 | if (tmp->type == SAFE_GROUND) |
|
|
1842 | flags |= P_SAFE | P_NO_CLERIC | P_NO_MAGIC; |
1824 | |
1843 | |
1825 | if (QUERY_FLAG(tmp,FLAG_BLOCKSVIEW)) |
1844 | if (QUERY_FLAG(tmp,FLAG_BLOCKSVIEW)) |
1826 | flags |= P_BLOCKSVIEW; |
1845 | flags |= P_BLOCKSVIEW; |
1827 | } /* for stack of objects */ |
1846 | } /* for stack of objects */ |
1828 | |
1847 | |