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.188 by root, Wed Sep 12 11:10:09 2007 UTC vs.
Revision 1.191 by root, Sun Sep 30 20:22:15 2007 UTC

1290 else 1290 else
1291 { 1291 {
1292 top = ms.bot; 1292 top = ms.bot;
1293 1293
1294 /* If there are other objects, then */ 1294 /* If there are other objects, then */
1295 if ((!(flag & INS_MAP_LOAD)) && top) 1295 if (top)
1296 { 1296 {
1297 object *last = 0; 1297 object *last = 0;
1298 1298
1299 /* 1299 /*
1300 * If there are multiple objects on this space, we do some trickier handling. 1300 * If there are multiple objects on this space, we do some trickier handling.
1352 */ 1352 */
1353 if (last && last->below && last != floor) 1353 if (last && last->below && last != floor)
1354 top = last->below; 1354 top = last->below;
1355 } 1355 }
1356 } /* If objects on this space */ 1356 } /* If objects on this space */
1357 if (flag & INS_MAP_LOAD)
1358 top = ms.top;
1359 1357
1360 if (flag & INS_ABOVE_FLOOR_ONLY) 1358 if (flag & INS_ABOVE_FLOOR_ONLY)
1361 top = floor; 1359 top = floor;
1362 1360
1363 /* Top is the object that our object (op) is going to get inserted above. 1361 /* Top is the object that our object (op) is going to get inserted above.
1396 op->map->touch (); 1394 op->map->touch ();
1397 } 1395 }
1398 1396
1399 op->map->dirty = true; 1397 op->map->dirty = true;
1400 1398
1401 if (!(flag & INS_MAP_LOAD))
1402 if (object *pl = ms.player ()) 1399 if (object *pl = ms.player ())
1403 pl->contr->ns->floorbox_update (); 1400 pl->contr->ns->floorbox_update ();
1404 1401
1405 /* If this object glows, it may affect lighting conditions that are 1402 /* If this object glows, it may affect lighting conditions that are
1406 * visible to others on this map. But update_all_los is really 1403 * visible to others on this map. But update_all_los is really
1407 * an inefficient way to do this, as it means los for all players 1404 * an inefficient way to do this, as it means los for all players
1408 * on the map will get recalculated. The players could very well 1405 * on the map will get recalculated. The players could very well
1991 * customized, changed states, etc. 1988 * customized, changed states, etc.
1992 */ 1989 */
1993int 1990int
1994find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) 1991find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop)
1995{ 1992{
1993 int altern[SIZEOFFREE];
1996 int index = 0, flag; 1994 int index = 0, flag;
1997 int altern[SIZEOFFREE];
1998 1995
1999 for (int i = start; i < stop; i++) 1996 for (int i = start; i < stop; i++)
2000 { 1997 {
2001 mapxy pos (m, x, y); pos.move (i); 1998 mapxy pos (m, x, y); pos.move (i);
2002 1999
2003 if (!pos.normalise ()) 2000 if (!pos.normalise ())
2004 continue; 2001 continue;
2005 2002
2006 mapspace &ms = *pos; 2003 mapspace &ms = *pos;
2007 ms.update (); 2004
2005 if (ms.flags () & P_IS_ALIVE)
2006 continue;
2008 2007
2009 /* However, often 2008 /* However, often
2010 * ob doesn't have any move type (when used to place exits) 2009 * ob doesn't have any move type (when used to place exits)
2011 * so the AND operation in OB_TYPE_MOVE_BLOCK doesn't work. 2010 * so the AND operation in OB_TYPE_MOVE_BLOCK doesn't work.
2012 */ 2011 */
2013 if (ob->move_type == 0 && ms.move_block != MOVE_ALL) 2012 if (ob->move_type == 0 && ms.move_block != MOVE_ALL)
2013 {
2014 altern [index++] = i;
2014 continue; 2015 continue;
2016 }
2015 2017
2016 /* Basically, if we find a wall on a space, we cut down the search size. 2018 /* Basically, if we find a wall on a space, we cut down the search size.
2017 * In this way, we won't return spaces that are on another side of a wall. 2019 * In this way, we won't return spaces that are on another side of a wall.
2018 * This mostly work, but it cuts down the search size in all directions - 2020 * This mostly work, but it cuts down the search size in all directions -
2019 * if the space being examined only has a wall to the north and empty 2021 * if the space being examined only has a wall to the north and empty

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines