AInventory *AAmmo::CreateCopy (AActor *other) { AInventory *copy; int amount = Amount; // extra ammo in baby mode and nightmare mode if (!(ItemFlags&IF_IGNORESKILL)) { amount = FixedMul(amount, G_SkillProperty(SKILLP_AmmoFactor)); } if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo) && GetClass() != RUNTIME_CLASS(AAmmo)) { const PClass *type = GetParentAmmo(); assert (type->ActorInfo != NULL); if (!GoAway ()) { Destroy (); } copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE)); copy->Amount = amount; copy->BecomeItem (); } else { copy = Super::CreateCopy (other); copy->Amount = amount; } if (copy->Amount > copy->MaxAmount) { // Don't pick up more ammo than you're supposed to be able to carry. copy->Amount = copy->MaxAmount; } return copy; }
AInventory *AAmmo::CreateCopy (AActor *other) { AInventory *copy; if (GetClass()->ParentType != RUNTIME_CLASS(AAmmo)) { const TypeInfo *type = GetParentAmmo(); if (!GoAway ()) { Destroy (); } copy = static_cast<AInventory *>(Spawn (type, 0, 0, 0)); copy->Amount = Amount; copy->BecomeItem (); } else { copy = Super::CreateCopy (other); } if (copy->Amount > copy->MaxAmount) { // Don't pick up more ammo than you're supposed to be able to carry. copy->Amount = copy->MaxAmount; } return copy; }