コード例 #1
0
ファイル: g_items.cpp プロジェクト: Clever-Boy/qfusion
static bool Pickup_Ammo( edict_t *other, const gsitem_t *item, int count, const int *invpack )
{
	// ammo packs are special
	if( item->tag == AMMO_PACK || item->tag == AMMO_PACK_WEAK || item->tag == AMMO_PACK_STRONG )
		return Pickup_AmmoPack( other, invpack );

	if( !count )
		count = item->quantity;

	if( !Add_Ammo( other->r.client, item, count, true ) )
		return false;

	return true;
}
コード例 #2
0
ファイル: g_items.c プロジェクト: hettoo/racesow
static qboolean Pickup_Ammo( edict_t *ent, edict_t *other )
{
	int oldcount;
	int count;
	qboolean weapon;

	// ammo packs are special
	if( ent->item->tag == AMMO_PACK || ent->item->tag == AMMO_PACK_WEAK || ent->item->tag == AMMO_PACK_STRONG )
		return Pickup_AmmoPack( ent, other );

	weapon = ( ent->item->type & IT_WEAPON );

	if( ent->count )
		count = ent->count;
	else
		count = ent->item->quantity;

	oldcount = other->r.client->ps.inventory[ent->item->tag];

	if( !Add_Ammo( other->r.client, ent->item, count, qtrue ) )
		return qfalse;

	return qtrue;
}