From 8f8f937f9b4f8c74199bd984864ba3c38812d493 Mon Sep 17 00:00:00 2001
From: Randy Heit <rheit@zdoom.fake>
Date: Thu, 8 Mar 2012 23:34:00 +0000
Subject: [PATCH] - The "give artifacts" and "give puzzlepieces" commands now
 ignore items that have been replaced.   "give everything" continues to give
 replaced items, however.

SVN r3411 (trunk)
---
 src/m_cheat.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp
index cf7c844b6d..caac3b1af1 100644
--- a/src/m_cheat.cpp
+++ b/src/m_cheat.cpp
@@ -768,7 +768,11 @@ void cht_Give (player_t *player, const char *name, int amount)
 					!type->IsDescendantOf (RUNTIME_CLASS(APowerup)) &&
 					!type->IsDescendantOf (RUNTIME_CLASS(AArmor)))
 				{
-					GiveSpawner (player, type, amount <= 0 ? def->MaxAmount : amount);
+					// Do not give replaced items unless using "give everything"
+					if (giveall == ALL_YESYES || type->GetReplacement() == type)
+					{
+						GiveSpawner (player, type, amount <= 0 ? def->MaxAmount : amount);
+					}
 				}
 			}
 		}
@@ -786,7 +790,11 @@ void cht_Give (player_t *player, const char *name, int amount)
 				AInventory *def = (AInventory*)GetDefaultByType (type);
 				if (def->Icon.isValid())
 				{
-					GiveSpawner (player, type, amount <= 0 ? def->MaxAmount : amount);
+					// Do not give replaced items unless using "give everything"
+					if (giveall == ALL_YESYES || type->GetReplacement() == type)
+					{
+						GiveSpawner (player, type, amount <= 0 ? def->MaxAmount : amount);
+					}
 				}
 			}
 		}