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.154 by root, Thu May 17 21:11:42 2007 UTC vs.
Revision 1.155 by root, Thu May 17 21:32:08 2007 UTC

1236object * 1236object *
1237insert_ob_in_map (object *op, maptile *m, object *originator, int flag) 1237insert_ob_in_map (object *op, maptile *m, object *originator, int flag)
1238{ 1238{
1239 assert (!op->flag [FLAG_FREED]); 1239 assert (!op->flag [FLAG_FREED]);
1240 1240
1241 object *tmp, *top, *floor = NULL; 1241 object *top, *floor = NULL;
1242 1242
1243 op->remove (); 1243 op->remove ();
1244 1244
1245#if 0 1245#if 0
1246 if (!m->active != !op->active) 1246 if (!m->active != !op->active)
1262#endif 1262#endif
1263 return op; 1263 return op;
1264 } 1264 }
1265 1265
1266 if (object *more = op->more) 1266 if (object *more = op->more)
1267 {
1268 if (!insert_ob_in_map (more, m, originator, flag)) 1267 if (!insert_ob_in_map (more, m, originator, flag))
1269 {
1270 if (!op->head)
1271 LOG (llevError, "BUG: insert_ob_in_map(): inserting op->more killed op\n");
1272
1273 return 0; 1268 return 0;
1274 }
1275 }
1276 1269
1277 CLEAR_FLAG (op, FLAG_REMOVED); 1270 CLEAR_FLAG (op, FLAG_REMOVED);
1278 1271
1279 /* Ideally, the caller figures this out. However, it complicates a lot 1272 /* Ideally, the caller figures this out. However, it complicates a lot
1280 * of areas of callers (eg, anything that uses find_free_spot would now 1273 * of areas of callers (eg, anything that uses find_free_spot would now
1287 mapspace &ms = op->ms (); 1280 mapspace &ms = op->ms ();
1288 1281
1289 /* this has to be done after we translate the coordinates. 1282 /* this has to be done after we translate the coordinates.
1290 */ 1283 */
1291 if (op->nrof && !(flag & INS_NO_MERGE)) 1284 if (op->nrof && !(flag & INS_NO_MERGE))
1292 for (tmp = ms.bot; tmp; tmp = tmp->above) 1285 for (object *tmp = ms.bot; tmp; tmp = tmp->above)
1293 if (object::can_merge (op, tmp)) 1286 if (object::can_merge (op, tmp))
1294 { 1287 {
1295 op->nrof += tmp->nrof; 1288 op->nrof += tmp->nrof;
1296 tmp->destroy (); 1289 tmp->destroy ();
1297 } 1290 }
1466 * blocked() and wall() work properly), and these flags are updated by 1459 * blocked() and wall() work properly), and these flags are updated by
1467 * update_object(). 1460 * update_object().
1468 */ 1461 */
1469 1462
1470 /* if this is not the head or flag has been passed, don't check walk on status */ 1463 /* if this is not the head or flag has been passed, don't check walk on status */
1471 if (!(flag & INS_NO_WALK_ON) && !op->head) 1464 if (!(flag & INS_NO_WALK_ON) && op->head_ () == op)
1472 { 1465 {
1473 if (check_move_on (op, originator)) 1466 if (check_move_on (op, originator))
1474 return 0; 1467 return 0;
1475 1468
1476 /* If we are a multi part object, lets work our way through the check 1469 /* If we are a multi part object, lets work our way through the check
1477 * walk on's. 1470 * walk on's.
1478 */ 1471 */
1479 for (tmp = op->more; tmp != NULL; tmp = tmp->more) 1472 for (object *tmp = op->more; tmp; tmp = tmp->more)
1480 if (check_move_on (tmp, originator)) 1473 if (check_move_on (tmp, originator))
1481 return 0; 1474 return 0;
1482 } 1475 }
1483 1476
1484 return op; 1477 return op;
2132 object *tmp; 2125 object *tmp;
2133 maptile *mp; 2126 maptile *mp;
2134 2127
2135 MoveType blocked, move_type; 2128 MoveType blocked, move_type;
2136 2129
2137 if (exclude && exclude->head) 2130 if (exclude && exclude->head_ () != exclude)
2138 { 2131 {
2139 exclude = exclude->head; 2132 exclude = exclude->head;
2140 move_type = exclude->move_type; 2133 move_type = exclude->move_type;
2141 } 2134 }
2142 else 2135 else
2165 max = maxfree[i]; 2158 max = maxfree[i];
2166 else if (mflags & P_IS_ALIVE) 2159 else if (mflags & P_IS_ALIVE)
2167 { 2160 {
2168 for (tmp = ms.bot; tmp; tmp = tmp->above) 2161 for (tmp = ms.bot; tmp; tmp = tmp->above)
2169 if ((tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER) 2162 if ((tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER)
2170 && (tmp != exclude || (tmp->head && tmp->head != exclude))) 2163 && (tmp != exclude || (tmp->head_ () != tmp && tmp->head_ () != exclude)))
2171 break; 2164 break;
2172 2165
2173 if (tmp) 2166 if (tmp)
2174 return freedir[i]; 2167 return freedir[i];
2175 } 2168 }
2370 * create clone from object to another 2363 * create clone from object to another
2371 */ 2364 */
2372object * 2365object *
2373object_create_clone (object *asrc) 2366object_create_clone (object *asrc)
2374{ 2367{
2375 object *dst = 0, *tmp, *src, *part, *prev, *item; 2368 object *dst = 0, *tmp, *src, *prev, *item;
2376 2369
2377 if (!asrc) 2370 if (!asrc)
2378 return 0; 2371 return 0;
2379 2372
2380 src = asrc;
2381 if (src->head)
2382 src = src->head; 2373 src = asrc->head_ ();
2383 2374
2384 prev = 0; 2375 prev = 0;
2385 for (part = src; part; part = part->more) 2376 for (object *part = src; part; part = part->more)
2386 { 2377 {
2387 tmp = part->clone (); 2378 tmp = part->clone ();
2388 tmp->x -= src->x; 2379 tmp->x -= src->x;
2389 tmp->y -= src->y; 2380 tmp->y -= src->y;
2390 2381

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines