From f9a54f86aecf78512f5829efdbdafded4a205105 Mon Sep 17 00:00:00 2001
From: johns <>
Date: Sun, 21 May 2000 15:49:29 +0000
Subject: [PATCH] Oil patch correct removed/set from David Slimp. No death
 sound for oil patch or removed units.

---
 doc/ChangeLog.html |  1 +
 src/unit/unit.cpp  | 23 ++++++++++-------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index 3417d7131..0c280d9f8 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -493,6 +493,7 @@
     <LI>Building of walls only in network game allowed.
     <LI>Fixed bug: cancel gives back more than the unit/upgrade has cost.
     <LI>Network code finished, most bugs found, works now with firewalls.
+    <LI>Fixed bug: Placement and removement of oil patch from David Slimp.
     <LI>+++
     </UL>
 
diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp
index 3a3ad838c..8be0c6f39 100644
--- a/src/unit/unit.cpp
+++ b/src/unit/unit.cpp
@@ -603,17 +603,13 @@ global void UnitLost(const Unit* unit)
     }
 
     //
-    //	Destroy oil-platform, must update oil.
+    //	Destroy oil-platform, must re-make oil patch.
     //
-    if( type->GivesOil ) {
-	temp=OilPatchOnMap(unit->X,unit->Y);
-	if( temp ) {
-	    // JOHNS: copy remaining oil value
-	    temp->Value=unit->Value;
-	    temp->Removed=0;
-	} else {
-	    DebugLevel0(__FUNCTION__": Update no oil-patch %s\n",type->Ident);
-	}
+    if( type->GivesOil && unit->Value > 0 ) {
+	// NOTE: I wasn't sure the best UnitType/Player
+	// NOTE: This should really NOT be hardcoded?!
+	temp=MakeUnitAndPlace(unit->X,unit->Y,UnitTypeByWcNum(93),&Players[15]);
+	temp->Value=unit->Value;
     }
 
     player->UnitTypesCount[type->Type]--;
@@ -2350,11 +2346,10 @@ global void DestroyUnit(Unit* unit)
     unit->HP=0;
     unit->Moving=0;
 
-    type=unit->Type;
-    PlayUnitSound(unit,VoiceDying);
-
     MustRedraw|=RedrawResources; // for food usage indicator
 
+    type=unit->Type;
+
     //
     //	Oil patch or removed units,  just remove.
     //
@@ -2365,6 +2360,8 @@ global void DestroyUnit(Unit* unit)
 	return;
     }
 
+    PlayUnitSound(unit,VoiceDying);
+
     //
     //	Catapults,... explodes.
     //