diff --git a/docs/rh-log.txt b/docs/rh-log.txt index ed25d858d..93e4428c8 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ October 23, 2009 +- Fixed: When giving completely new ammo, the backpack did not clamp the + amount given to the ammo's max amount. - Fixed drawing of wide high resolution skies. (At least for the samples I received. I'm not convinced that it's yet fixed for the general case.) diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index e9d9e2003..eb0037793 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -1569,7 +1569,7 @@ void ABackpackItem::Serialize (FArchive &arc) AInventory *ABackpackItem::CreateCopy (AActor *other) { // Find every unique type of ammo. Give it to the player if - // he doesn't have it already, and double it's maximum capacity. + // he doesn't have it already, and double its maximum capacity. for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i) { const PClass *type = PClass::m_Types[i]; @@ -1588,7 +1588,14 @@ AInventory *ABackpackItem::CreateCopy (AActor *other) { // The player did not have the ammo. Add it. ammo = static_cast(Spawn (type, 0, 0, 0, NO_REPLACE)); ammo->Amount = bDepleted ? 0 : amount; - if (ammo->BackpackMaxAmount > ammo->MaxAmount) ammo->MaxAmount = ammo->BackpackMaxAmount; + if (ammo->BackpackMaxAmount > ammo->MaxAmount) + { + ammo->MaxAmount = ammo->BackpackMaxAmount; + } + if (ammo->Amount > ammo->MaxAmount) + { + ammo->Amount = ammo->MaxAmount; + } ammo->AttachToOwner (other); } else