If I misunderstood and this is still up for debate, my apologies and please revert.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@462 c06c8d41-db1a-0410-9941-cceddc491573
27JBFXYGCM6RU42Y5A4ZZ6I3RXXBY5A3B252YPAPSADTN6SFTH2QC
//---------------------------------------------------------------
//
// drop_gold
//
//---------------------------------------------------------------
static void drop_gold(unsigned int amount)
{
const unsigned long BIGGEST_QUANT_VALUE =
((1L << (sizeof(mitm[0].quantity)*8 - 1)) - 1000);
if (you.gold > 0)
{
if (amount > you.gold)
amount = you.gold;
snprintf( info, INFO_SIZE, "You drop %d gold piece%s.",
amount, (amount > 1) ? "s" : "" );
mpr(info);
// loop through items at grid location, look for gold
int i = igrd[you.x_pos][you.y_pos];
while(i != NON_ITEM)
{
if (mitm[i].base_type == OBJ_GOLD)
{
if ( mitm[i].quantity + amount > BIGGEST_QUANT_VALUE ) {
amount = BIGGEST_QUANT_VALUE - mitm[i].quantity;
snprintf(info, INFO_SIZE,
"But there's only room for %d.", amount);
mpr(info);
}
inc_mitm_item_quantity( i, amount );
you.gold -= amount;
you.redraw_gold = 1;
you.turn_is_over = true;
return;
}
// follow link
i = mitm[i].link;
}
// place on top.
i = get_item_slot(10);
if (i == NON_ITEM)
{
mpr( "Too many items on this level, not dropping the gold." );
return;
}
if (amount > BIGGEST_QUANT_VALUE) {
amount = BIGGEST_QUANT_VALUE;
snprintf(info, INFO_SIZE,
"But there's only room for %d.", amount);
mpr(info);
}
mitm[i].base_type = OBJ_GOLD;
mitm[i].quantity = amount;
// [ds] #&^#@&#!
mitm[i].colour = YELLOW;
mitm[i].flags = 0;
move_item_to_grid( &i, you.x_pos, you.y_pos );
you.gold -= amount;
you.redraw_gold = 1;
you.turn_is_over = true;
}
else
{
mpr("You don't have any money.");
}
} // end drop_gold()
if (item_dropped == PROMPT_GOT_SPECIAL) // ie '$' for gold
{
// drop gold
if (quant_drop < 0 || quant_drop > static_cast< int >( you.gold ))
quant_drop = you.gold;
drop_gold( quant_drop );
return (true);
}