From: <js...@us...> - 2005-05-06 05:56:04
|
Update of /cvsroot/exult/exult/objs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2514/objs Modified Files: objs.cc objs.h Log Message: Implemented set_orrery() intrinsic Index: objs.cc =================================================================== RCS file: /cvsroot/exult/exult/objs/objs.cc,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- objs.cc 3 May 2005 05:20:45 -0000 1.134 +++ objs.cc 6 May 2005 05:55:55 -0000 1.135 @@ -530,6 +530,7 @@ Game_object *Game_object::find_closest ( + Tile_coord pos, // Where to look from. int *shapenums, // Shapes to look for. // c_any_shapenum=any NPC. int num_shapes, // Size of shapenums. @@ -540,19 +541,18 @@ int i; for (i = 0; i < num_shapes; i++) // 0xb0 mask finds anything. - find_nearby(vec, shapenums[i], dist, 0xb0); + find_nearby(vec, pos, shapenums[i], dist, 0xb0); int cnt = vec.size(); if (!cnt) return (0); Game_object *closest = 0; // Get closest. int best_dist = 10000; // In tiles. // Get our location. - Tile_coord loc = get_tile(); for (Game_object_vector::const_iterator it = vec.begin(); it != vec.end(); ++it) { Game_object *obj = *it; - int dist = obj->get_tile().distance(loc); + int dist = obj->get_tile().distance(pos); if (dist < best_dist) { closest = obj; Index: objs.h =================================================================== RCS file: /cvsroot/exult/exult/objs/objs.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- objs.h 18 Sep 2004 20:47:11 -0000 1.66 +++ objs.h 6 May 2005 05:55:56 -0000 1.67 @@ -190,10 +190,17 @@ Game_object *find_closest(Game_object_vector& vec, int *shapenums, int num_shapes, int dist = 24); + static Game_object *find_closest(Tile_coord pos, + int *shapenums, int num_shapes, int dist = 24); Game_object *find_closest(int *shapenums, int num_shapes, - int dist = 24); + int dist = 24) + { return find_closest(get_tile(), shapenums, + num_shapes, dist); } Game_object *find_closest(int shapenum, int dist = 24) { return find_closest(&shapenum, 1, dist); } + static Game_object *find_closest(Tile_coord pos, int shapenum, + int dist = 24) + { return find_closest(pos, &shapenum, 1, dist); } Rectangle get_footprint(); // Get tile footprint. bool blocks(Tile_coord tile); // Do we block a given tile? // Find object blocking given tile. |