src/gen-util.c
void vault_objects(struct chunk *c, int y, int x, int depth, int num)
{
    int i, j, k;

    /* Attempt to place 'num' objects */
    for (; num > 0; --num) {
		/* Try up to 11 spots looking for empty space */
		for (i = 0; i < 11; ++i) {
			/* Pick a random location */
			find_nearby_grid(c, &j, y, 2, &k, x, 3);

			/* Require "clean" floor space */
			if (!square_canputitem(c, j, k)) continue;

			/* Place an item or gold */
			if (randint0(100) < 75)
				place_object(c, j, k, depth, FALSE, FALSE, ORIGIN_SPECIAL, 0);
			else
				place_gold(c, j, k, depth, ORIGIN_VAULT);

			/* Placement accomplished */
			break;
		}
    }
}
/**
 * Create up to 'num' objects near the given coordinates in a vault.
 * \param c the current chunk
 * \param y
 * \param x co-ordinates
 * \param depth geneeration depth
 * \param num number of objects
 */
Create up to 'num' objects near the given coordinates in a vault.
Create up to ' num ' objects near the given coordinates in a vault .
void vault_objects(struct chunk *c, int y, int x, int depth, int num)
{
    int i, j, k;
    for (; num > 0; --num) {
		for (i = 0; i < 11; ++i) {
			find_nearby_grid(c, &j, y, 2, &k, x, 3);
			if (!square_canputitem(c, j, k)) continue;
			if (randint0(100) < 75)
				place_object(c, j, k, depth, FALSE, FALSE, ORIGIN_SPECIAL, 0);
			else
				place_gold(c, j, k, depth, ORIGIN_VAULT);
			break;
		}
    }
}
void vault_objects ( struct chunk * c , int y , int x , int depth , int num ) { int i , j , k ; for ( ; num > 0 ; -- num ) { for ( i = 0 ; i < 11 ; ++ i ) { find_nearby_grid ( c , & j , y , 2 , & k , x , 3 ) ; if ( ! square_canputitem ( c , j , k ) ) continue ; if ( randint0 ( 100 ) < 75 ) place_object ( c , j , k , depth , FALSE , FALSE , ORIGIN_SPECIAL , 0 ) ; else place_gold ( c , j , k , depth , ORIGIN_VAULT ) ; break ; } } }
Create up to 'num' objects near the given coordinates in a vault.
Create up to ' num ' objects near the given coordinates in a vault .
/* Attempt to place 'num' objects */ /* Try up to 11 spots looking for empty space */ /* Pick a random location */ /* Require "clean" floor space */ /* Place an item or gold */ /* Placement accomplished */