From 5e9a97cd20f99cb92be306e506f8f8833d10aa85 Mon Sep 17 00:00:00 2001
From: jsalmon3 <>
Date: Thu, 20 Feb 2003 21:01:48 +0000
Subject: [PATCH] Fixed bug #690171: Crash building oil platofrm with
 UNITS_ON_MAP

---
 doc/ChangeLog.html |  2 ++
 src/unit/unit.cpp  | 14 +++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index bd43f10d6..109382094 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -1079,6 +1079,8 @@
     <LI>Added middle-click pasting support in X11 (from Juan Pablo).
     <LI>Fixed bug when destroying a unit with another unit inside it (from
 	Jimmy Salmon).
+    <LI>Fixed bug #690171: Crash building oil platform with UNITS_ON_MAP
+	(from Jimmy Salmon).
     <LI>+++
     </UL>
 </UL>
diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp
index 9a8b06c39..5be4b2984 100644
--- a/src/unit/unit.cpp
+++ b/src/unit/unit.cpp
@@ -558,13 +558,6 @@ global void PlaceUnit(Unit* unit,int x,int y)
 	}
     }
     
-    unit->Removed=0;
-    UnitCacheInsert(unit);
-
-    MustRedraw|=RedrawMinimap;
-    CheckUnitToBeDrawn(unit);
-    UnitMarkSeen(unit);
-
     //
     //	Building oil-platform, must remove oil-patch.
     //
@@ -580,6 +573,13 @@ global void PlaceUnit(Unit* unit,int x,int y)
 	    DebugLevel0Fn("No oil-patch to remove.\n");
 	}
     }
+
+    unit->Removed=0;
+    UnitCacheInsert(unit);
+
+    MustRedraw|=RedrawMinimap;
+    CheckUnitToBeDrawn(unit);
+    UnitMarkSeen(unit);
 }
 
 /**