--- deliantra/server/random_maps/treasure.C 2007/01/15 01:55:22 1.16 +++ deliantra/server/random_maps/treasure.C 2007/01/15 15:54:19 1.17 @@ -214,6 +214,7 @@ the_chest->destroy (); return NULL; } + xl = x + freearr_x[i]; yl = y + freearr_y[i]; @@ -658,15 +659,19 @@ } } /* give up and return the closest free spot. */ - i = find_first_free_spot (&archetype::find ("chest")->clone, map, x, y); - if (i != -1 && i <= SIZEOFFREE1) + i = find_free_spot (&archetype::find ("chest")->clone, map, x, y, 1, SIZEOFFREE1 + 1); + + if (i != -1) { *cx = x + freearr_x[i]; *cy = y + freearr_y[i]; - return; } - /* indicate failure */ - *cx = *cy = -1; + else + { + /* indicate failure */ + *cx = -1; + *cy = -1; + } }