… | |
… | |
911 | mortals.erase (i); |
911 | mortals.erase (i); |
912 | } |
912 | } |
913 | |
913 | |
914 | static int lastmortals = 0;//D |
914 | static int lastmortals = 0;//D |
915 | |
915 | |
916 | if (mortals.size() != lastmortals)//D |
916 | if (mortals.size() != lastmortals && lastmortals > 100)//D |
917 | { |
917 | { |
918 | lastmortals = mortals.size ();//D |
918 | lastmortals = mortals.size ();//D |
919 | LOG (llevDebug, "%d objects in mortal queue\n", lastmortals);//D |
919 | LOG (llevDebug, "%d objects in mortal queue\n", lastmortals);//D |
920 | } |
920 | } |
921 | } |
921 | } |
… | |
… | |
1084 | { |
1084 | { |
1085 | object *tmp, *last = 0; |
1085 | object *tmp, *last = 0; |
1086 | object *otmp; |
1086 | object *otmp; |
1087 | |
1087 | |
1088 | int check_walk_off; |
1088 | int check_walk_off; |
1089 | mapstruct *m; |
1089 | maptile *m; |
1090 | |
1090 | |
1091 | sint16 x, y; |
1091 | sint16 x, y; |
1092 | |
1092 | |
1093 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
1093 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
1094 | return; |
1094 | return; |
… | |
… | |
1213 | |
1213 | |
1214 | tmp->contr->socket.update_look = 1; |
1214 | tmp->contr->socket.update_look = 1; |
1215 | } |
1215 | } |
1216 | |
1216 | |
1217 | /* See if player moving off should effect something */ |
1217 | /* See if player moving off should effect something */ |
1218 | if (check_walk_off && ((op->move_type & tmp->move_off) && (op->move_type & ~tmp->move_off & ~tmp->move_block) == 0)) |
1218 | if (check_walk_off |
|
|
1219 | && ((op->move_type & tmp->move_off) |
|
|
1220 | && (op->move_type & ~tmp->move_off & ~tmp->move_block) == 0)) |
1219 | { |
1221 | { |
1220 | move_apply (tmp, op, NULL); |
1222 | move_apply (tmp, op, NULL); |
1221 | |
1223 | |
1222 | if (op->destroyed ()); |
1224 | if (op->destroyed ()) |
1223 | LOG (llevError, "BUG: remove_ob(): name %s, archname %s destroyed " "leaving object\n", &tmp->name, &tmp->arch->name); |
1225 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1224 | } |
1226 | } |
1225 | |
1227 | |
1226 | /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ |
1228 | /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ |
1227 | |
1229 | |
1228 | if (tmp->above == tmp) |
1230 | if (tmp->above == tmp) |
… | |
… | |
1289 | /* |
1291 | /* |
1290 | * same as insert_ob_in_map except it handle separate coordinates and do a clean |
1292 | * same as insert_ob_in_map except it handle separate coordinates and do a clean |
1291 | * job preparing multi-part monsters |
1293 | * job preparing multi-part monsters |
1292 | */ |
1294 | */ |
1293 | object * |
1295 | object * |
1294 | insert_ob_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) |
1296 | insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y) |
1295 | { |
1297 | { |
1296 | object *tmp; |
1298 | object *tmp; |
1297 | |
1299 | |
1298 | if (op->head) |
1300 | if (op->head) |
1299 | op = op->head; |
1301 | op = op->head; |
… | |
… | |
1327 | * NULL if 'op' was destroyed |
1329 | * NULL if 'op' was destroyed |
1328 | * just 'op' otherwise |
1330 | * just 'op' otherwise |
1329 | */ |
1331 | */ |
1330 | |
1332 | |
1331 | object * |
1333 | object * |
1332 | insert_ob_in_map (object *op, mapstruct *m, object *originator, int flag) |
1334 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1333 | { |
1335 | { |
1334 | object *tmp, *top, *floor = NULL; |
1336 | object *tmp, *top, *floor = NULL; |
1335 | sint16 x, y; |
1337 | sint16 x, y; |
1336 | |
1338 | |
1337 | if (QUERY_FLAG (op, FLAG_FREED)) |
1339 | if (QUERY_FLAG (op, FLAG_FREED)) |
… | |
… | |
1928 | |
1930 | |
1929 | int |
1931 | int |
1930 | check_move_on (object *op, object *originator) |
1932 | check_move_on (object *op, object *originator) |
1931 | { |
1933 | { |
1932 | object *tmp; |
1934 | object *tmp; |
1933 | mapstruct *m = op->map; |
1935 | maptile *m = op->map; |
1934 | int x = op->x, y = op->y; |
1936 | int x = op->x, y = op->y; |
1935 | |
1937 | |
1936 | MoveType move_on, move_slow, move_block; |
1938 | MoveType move_on, move_slow, move_block; |
1937 | |
1939 | |
1938 | if (QUERY_FLAG (op, FLAG_NO_APPLY)) |
1940 | if (QUERY_FLAG (op, FLAG_NO_APPLY)) |
… | |
… | |
2027 | * a matching archetype at the given map and coordinates. |
2029 | * a matching archetype at the given map and coordinates. |
2028 | * The first matching object is returned, or NULL if none. |
2030 | * The first matching object is returned, or NULL if none. |
2029 | */ |
2031 | */ |
2030 | |
2032 | |
2031 | object * |
2033 | object * |
2032 | present_arch (const archetype *at, mapstruct *m, int x, int y) |
2034 | present_arch (const archetype *at, maptile *m, int x, int y) |
2033 | { |
2035 | { |
2034 | object * |
2036 | object * |
2035 | tmp; |
2037 | tmp; |
2036 | |
2038 | |
2037 | if (m == NULL || out_of_map (m, x, y)) |
2039 | if (m == NULL || out_of_map (m, x, y)) |
… | |
… | |
2050 | * a matching type variable at the given map and coordinates. |
2052 | * a matching type variable at the given map and coordinates. |
2051 | * The first matching object is returned, or NULL if none. |
2053 | * The first matching object is returned, or NULL if none. |
2052 | */ |
2054 | */ |
2053 | |
2055 | |
2054 | object * |
2056 | object * |
2055 | present (unsigned char type, mapstruct *m, int x, int y) |
2057 | present (unsigned char type, maptile *m, int x, int y) |
2056 | { |
2058 | { |
2057 | object * |
2059 | object * |
2058 | tmp; |
2060 | tmp; |
2059 | |
2061 | |
2060 | if (out_of_map (m, x, y)) |
2062 | if (out_of_map (m, x, y)) |
… | |
… | |
2200 | * the archetype because that isn't correct if the monster has been |
2202 | * the archetype because that isn't correct if the monster has been |
2201 | * customized, changed states, etc. |
2203 | * customized, changed states, etc. |
2202 | */ |
2204 | */ |
2203 | |
2205 | |
2204 | int |
2206 | int |
2205 | find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop) |
2207 | find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) |
2206 | { |
2208 | { |
2207 | int |
2209 | int |
2208 | i, |
2210 | i, |
2209 | index = 0, flag; |
2211 | index = 0, flag; |
2210 | static int |
2212 | static int |
… | |
… | |
2231 | return -1; |
2233 | return -1; |
2232 | return altern[RANDOM () % index]; |
2234 | return altern[RANDOM () % index]; |
2233 | } |
2235 | } |
2234 | |
2236 | |
2235 | /* |
2237 | /* |
2236 | * find_first_free_spot(archetype, mapstruct, x, y) works like |
2238 | * find_first_free_spot(archetype, maptile, x, y) works like |
2237 | * find_free_spot(), but it will search max number of squares. |
2239 | * find_free_spot(), but it will search max number of squares. |
2238 | * But it will return the first available spot, not a random choice. |
2240 | * But it will return the first available spot, not a random choice. |
2239 | * Changed 0.93.2: Have it return -1 if there is no free spot available. |
2241 | * Changed 0.93.2: Have it return -1 if there is no free spot available. |
2240 | */ |
2242 | */ |
2241 | |
2243 | |
2242 | int |
2244 | int |
2243 | find_first_free_spot (const object *ob, mapstruct *m, int x, int y) |
2245 | find_first_free_spot (const object *ob, maptile *m, int x, int y) |
2244 | { |
2246 | { |
2245 | int |
2247 | int |
2246 | i; |
2248 | i; |
2247 | |
2249 | |
2248 | for (i = 0; i < SIZEOFFREE; i++) |
2250 | for (i = 0; i < SIZEOFFREE; i++) |
… | |
… | |
2312 | * because we have to know what movement the thing looking to move |
2314 | * because we have to know what movement the thing looking to move |
2313 | * there is capable of. |
2315 | * there is capable of. |
2314 | */ |
2316 | */ |
2315 | |
2317 | |
2316 | int |
2318 | int |
2317 | find_dir (mapstruct *m, int x, int y, object *exclude) |
2319 | find_dir (maptile *m, int x, int y, object *exclude) |
2318 | { |
2320 | { |
2319 | int |
2321 | int |
2320 | i, |
2322 | i, |
2321 | max = SIZEOFFREE, mflags; |
2323 | max = SIZEOFFREE, mflags; |
2322 | |
2324 | |
2323 | sint16 nx, ny; |
2325 | sint16 nx, ny; |
2324 | object * |
2326 | object * |
2325 | tmp; |
2327 | tmp; |
2326 | mapstruct * |
2328 | maptile * |
2327 | mp; |
2329 | mp; |
2328 | |
2330 | |
2329 | MoveType blocked, move_type; |
2331 | MoveType blocked, move_type; |
2330 | |
2332 | |
2331 | if (exclude && exclude->head) |
2333 | if (exclude && exclude->head) |
… | |
… | |
2539 | * Modified to be map tile aware -.MSW |
2541 | * Modified to be map tile aware -.MSW |
2540 | */ |
2542 | */ |
2541 | |
2543 | |
2542 | |
2544 | |
2543 | int |
2545 | int |
2544 | can_see_monsterP (mapstruct *m, int x, int y, int dir) |
2546 | can_see_monsterP (maptile *m, int x, int y, int dir) |
2545 | { |
2547 | { |
2546 | sint16 dx, dy; |
2548 | sint16 dx, dy; |
2547 | int |
2549 | int |
2548 | mflags; |
2550 | mflags; |
2549 | |
2551 | |