diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 348ba39b..f8c9c64c 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -600,7 +600,7 @@ ED_ParseField(const char *key, const char *value, edict_t *ent) } } - gi.dprintf("%s is not a field. Value is %s\n", key, value); + gi.dprintf("'%s' is not a field. Value is '%s'\n", key, value); } /* diff --git a/src/game/player/weapon.c b/src/game/player/weapon.c index c77c5491..783d95fe 100644 --- a/src/game/player/weapon.c +++ b/src/game/player/weapon.c @@ -379,7 +379,6 @@ qboolean Pickup_Weapon(edict_t *ent, edict_t *other) { int index; - gitem_t *ammo; if (!ent || !other) { @@ -402,18 +401,29 @@ Pickup_Weapon(edict_t *ent, edict_t *other) if (!(ent->spawnflags & DROPPED_ITEM)) { - /* give them some ammo with it */ - ammo = FindItem(ent->item->ammo); + if (ent->item->ammo) + { + gitem_t *ammo; - /* Don't get infinite ammo with trap */ - if (((int)dmflags->value & DF_INFINITE_AMMO) && - Q_stricmp(ent->item->pickup_name, "ammo_trap")) - { - Add_Ammo(other, ammo, 1000); - } - else - { - Add_Ammo(other, ammo, ammo->quantity); + /* give them some ammo with it */ + ammo = FindItem(ent->item->ammo); + if (!ammo) + { + gi.dprintf("Ammo %s for item %s has not be found\n", + ent->item->ammo, ent->item->classname); + return false; + } + + /* Don't get infinite ammo with trap */ + if (((int)dmflags->value & DF_INFINITE_AMMO) && + Q_stricmp(ent->item->pickup_name, "ammo_trap")) + { + Add_Ammo(other, ammo, 1000); + } + else + { + Add_Ammo(other, ammo, ammo->quantity); + } } if (!(ent->spawnflags & DROPPED_PLAYER_ITEM))