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.192 by root, Fri Oct 12 19:13:25 2007 UTC vs.
Revision 1.196 by root, Wed Oct 17 22:01:27 2007 UTC

254 /* This is really a spellbook check - really, we should 254 /* This is really a spellbook check - really, we should
255 * check all objects in the inventory. 255 * check all objects in the inventory.
256 */ 256 */
257 if (ob1->inv || ob2->inv) 257 if (ob1->inv || ob2->inv)
258 { 258 {
259 /* if one object has inventory but the other doesn't, not equiv */ 259 if (!(ob1->inv && ob2->inv))
260 if ((ob1->inv && !ob2->inv) || (ob2->inv && !ob1->inv)) 260 return 0; /* inventories differ in length */
261 return 0;
262 261
263 /* Now check to see if the two inventory objects could merge */ 262 if (ob1->inv->below || ob2->inv->below)
263 return 0; /* more than one object in inv */
264
264 if (!object::can_merge (ob1->inv, ob2->inv)) 265 if (!object::can_merge (ob1->inv, ob2->inv))
265 return 0; 266 return 0; /* inventory objexts differ */
266 267
267 /* inventory ok - still need to check rest of this object to see 268 /* inventory ok - still need to check rest of this object to see
268 * if it is valid. 269 * if it is valid.
269 */ 270 */
270 } 271 }
306 ob1->optimise (); 307 ob1->optimise ();
307 ob2->optimise (); 308 ob2->optimise ();
308 309
309 if (ob1->self || ob2->self) 310 if (ob1->self || ob2->self)
310 { 311 {
311 int k1 = ob1->self ? HvTOTALKEYS (SvRV (ob1->self)) : 0; 312 int k1 = ob1->self ? HvTOTALKEYS (ob1->self) : 0;
312 int k2 = ob2->self ? HvTOTALKEYS (SvRV (ob2->self)) : 0; 313 int k2 = ob2->self ? HvTOTALKEYS (ob2->self) : 0;
313 314
314 if (k1 != k2) 315 if (k1 != k2)
315 return 0; 316 return 0;
316 else if (k1 == 0) 317 else if (k1 == 0)
317 return 1; 318 return 1;
1149merge_ob (object *op, object *top) 1150merge_ob (object *op, object *top)
1150{ 1151{
1151 if (!op->nrof) 1152 if (!op->nrof)
1152 return 0; 1153 return 0;
1153 1154
1154 if (top) 1155 if (!top)
1155 for (top = op; top && top->above; top = top->above) 1156 for (top = op; top && top->above; top = top->above)
1156 ; 1157 ;
1157 1158
1158 for (; top; top = top->below) 1159 for (; top; top = top->below)
1159 { 1160 {
1982 * to search (see the freearr_x/y[] definition). 1983 * to search (see the freearr_x/y[] definition).
1983 * It returns a random choice among the alternatives found. 1984 * It returns a random choice among the alternatives found.
1984 * start and stop are where to start relative to the free_arr array (1,9 1985 * start and stop are where to start relative to the free_arr array (1,9
1985 * does all 4 immediate directions). This returns the index into the 1986 * does all 4 immediate directions). This returns the index into the
1986 * array of the free spot, -1 if no spot available (dir 0 = x,y) 1987 * array of the free spot, -1 if no spot available (dir 0 = x,y)
1987 * Note - this only checks to see if there is space for the head of the
1988 * object - if it is a multispace object, this should be called for all
1989 * pieces.
1990 * Note2: This function does correctly handle tiled maps, but does not 1988 * Note: This function does correctly handle tiled maps, but does not
1991 * inform the caller. However, insert_ob_in_map will update as 1989 * inform the caller. However, insert_ob_in_map will update as
1992 * necessary, so the caller shouldn't need to do any special work. 1990 * necessary, so the caller shouldn't need to do any special work.
1993 * Note - updated to take an object instead of archetype - this is necessary 1991 * Note - updated to take an object instead of archetype - this is necessary
1994 * because arch_blocked (now ob_blocked) needs to know the movement type 1992 * because arch_blocked (now ob_blocked) needs to know the movement type
1995 * to know if the space in question will block the object. We can't use 1993 * to know if the space in question will block the object. We can't use
2040 2038
2041 /* Note it is intentional that we check ob - the movement type of the 2039 /* Note it is intentional that we check ob - the movement type of the
2042 * head of the object should correspond for the entire object. 2040 * head of the object should correspond for the entire object.
2043 */ 2041 */
2044 if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block)) 2042 if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block))
2043 continue;
2044
2045 if (ob->blocked (m, pos.x, pos.y))
2045 continue; 2046 continue;
2046 2047
2047 altern [index++] = i; 2048 altern [index++] = i;
2048 } 2049 }
2049 2050

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines