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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.48 by root, Thu Sep 14 23:13:48 2006 UTC vs.
Revision 1.49 by root, Sat Sep 16 22:24:12 2006 UTC

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;
1289/* 1289/*
1290 * same as insert_ob_in_map except it handle separate coordinates and do a clean 1290 * same as insert_ob_in_map except it handle separate coordinates and do a clean
1291 * job preparing multi-part monsters 1291 * job preparing multi-part monsters
1292 */ 1292 */
1293object * 1293object *
1294insert_ob_in_map_at (object *op, mapstruct *m, object *originator, int flag, int x, int y) 1294insert_ob_in_map_at (object *op, maptile *m, object *originator, int flag, int x, int y)
1295{ 1295{
1296 object *tmp; 1296 object *tmp;
1297 1297
1298 if (op->head) 1298 if (op->head)
1299 op = op->head; 1299 op = op->head;
1327 * NULL if 'op' was destroyed 1327 * NULL if 'op' was destroyed
1328 * just 'op' otherwise 1328 * just 'op' otherwise
1329 */ 1329 */
1330 1330
1331object * 1331object *
1332insert_ob_in_map (object *op, mapstruct *m, object *originator, int flag) 1332insert_ob_in_map (object *op, maptile *m, object *originator, int flag)
1333{ 1333{
1334 object *tmp, *top, *floor = NULL; 1334 object *tmp, *top, *floor = NULL;
1335 sint16 x, y; 1335 sint16 x, y;
1336 1336
1337 if (QUERY_FLAG (op, FLAG_FREED)) 1337 if (QUERY_FLAG (op, FLAG_FREED))
1928 1928
1929int 1929int
1930check_move_on (object *op, object *originator) 1930check_move_on (object *op, object *originator)
1931{ 1931{
1932 object *tmp; 1932 object *tmp;
1933 mapstruct *m = op->map; 1933 maptile *m = op->map;
1934 int x = op->x, y = op->y; 1934 int x = op->x, y = op->y;
1935 1935
1936 MoveType move_on, move_slow, move_block; 1936 MoveType move_on, move_slow, move_block;
1937 1937
1938 if (QUERY_FLAG (op, FLAG_NO_APPLY)) 1938 if (QUERY_FLAG (op, FLAG_NO_APPLY))
2027 * a matching archetype at the given map and coordinates. 2027 * a matching archetype at the given map and coordinates.
2028 * The first matching object is returned, or NULL if none. 2028 * The first matching object is returned, or NULL if none.
2029 */ 2029 */
2030 2030
2031object * 2031object *
2032present_arch (const archetype *at, mapstruct *m, int x, int y) 2032present_arch (const archetype *at, maptile *m, int x, int y)
2033{ 2033{
2034 object * 2034 object *
2035 tmp; 2035 tmp;
2036 2036
2037 if (m == NULL || out_of_map (m, x, y)) 2037 if (m == NULL || out_of_map (m, x, y))
2050 * a matching type variable at the given map and coordinates. 2050 * a matching type variable at the given map and coordinates.
2051 * The first matching object is returned, or NULL if none. 2051 * The first matching object is returned, or NULL if none.
2052 */ 2052 */
2053 2053
2054object * 2054object *
2055present (unsigned char type, mapstruct *m, int x, int y) 2055present (unsigned char type, maptile *m, int x, int y)
2056{ 2056{
2057 object * 2057 object *
2058 tmp; 2058 tmp;
2059 2059
2060 if (out_of_map (m, x, y)) 2060 if (out_of_map (m, x, y))
2200 * the archetype because that isn't correct if the monster has been 2200 * the archetype because that isn't correct if the monster has been
2201 * customized, changed states, etc. 2201 * customized, changed states, etc.
2202 */ 2202 */
2203 2203
2204int 2204int
2205find_free_spot (const object *ob, mapstruct *m, int x, int y, int start, int stop) 2205find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop)
2206{ 2206{
2207 int 2207 int
2208 i, 2208 i,
2209 index = 0, flag; 2209 index = 0, flag;
2210 static int 2210 static int
2231 return -1; 2231 return -1;
2232 return altern[RANDOM () % index]; 2232 return altern[RANDOM () % index];
2233} 2233}
2234 2234
2235/* 2235/*
2236 * find_first_free_spot(archetype, mapstruct, x, y) works like 2236 * find_first_free_spot(archetype, maptile, x, y) works like
2237 * find_free_spot(), but it will search max number of squares. 2237 * find_free_spot(), but it will search max number of squares.
2238 * But it will return the first available spot, not a random choice. 2238 * 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. 2239 * Changed 0.93.2: Have it return -1 if there is no free spot available.
2240 */ 2240 */
2241 2241
2242int 2242int
2243find_first_free_spot (const object *ob, mapstruct *m, int x, int y) 2243find_first_free_spot (const object *ob, maptile *m, int x, int y)
2244{ 2244{
2245 int 2245 int
2246 i; 2246 i;
2247 2247
2248 for (i = 0; i < SIZEOFFREE; i++) 2248 for (i = 0; i < SIZEOFFREE; i++)
2312 * because we have to know what movement the thing looking to move 2312 * because we have to know what movement the thing looking to move
2313 * there is capable of. 2313 * there is capable of.
2314 */ 2314 */
2315 2315
2316int 2316int
2317find_dir (mapstruct *m, int x, int y, object *exclude) 2317find_dir (maptile *m, int x, int y, object *exclude)
2318{ 2318{
2319 int 2319 int
2320 i, 2320 i,
2321 max = SIZEOFFREE, mflags; 2321 max = SIZEOFFREE, mflags;
2322 2322
2323 sint16 nx, ny; 2323 sint16 nx, ny;
2324 object * 2324 object *
2325 tmp; 2325 tmp;
2326 mapstruct * 2326 maptile *
2327 mp; 2327 mp;
2328 2328
2329 MoveType blocked, move_type; 2329 MoveType blocked, move_type;
2330 2330
2331 if (exclude && exclude->head) 2331 if (exclude && exclude->head)
2539 * Modified to be map tile aware -.MSW 2539 * Modified to be map tile aware -.MSW
2540 */ 2540 */
2541 2541
2542 2542
2543int 2543int
2544can_see_monsterP (mapstruct *m, int x, int y, int dir) 2544can_see_monsterP (maptile *m, int x, int y, int dir)
2545{ 2545{
2546 sint16 dx, dy; 2546 sint16 dx, dy;
2547 int 2547 int
2548 mflags; 2548 mflags;
2549 2549

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines