changeset 12978:af3281ea88c4 draft

(svn r17472) -Fix [FS#3182]: industry list was rebuilt too early during industry removal causing the removed industry to be still in the list after removal
author rubidium <rubidium@openttd.org>
date Tue, 08 Sep 2009 12:22:28 +0000
parents 45ddb1d44728
children 6266831f418a
files src/industry.h src/industry_cmd.cpp
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/industry.h
+++ b/src/industry.h
@@ -84,6 +84,7 @@
 	}
 
 	static Industry *GetRandom();
+	static void PostDestructor(size_t index);
 };
 
 void PlantRandomFarmField(const Industry *i);
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -176,10 +176,18 @@
 
 	DeleteIndustryNews(this->index);
 	DeleteWindowById(WC_INDUSTRY_VIEW, this->index);
-	InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
 
 	DeleteSubsidyWith(ST_INDUSTRY, this->index);
 	CargoPacket::InvalidateAllFrom(ST_INDUSTRY, this->index);
+}
+
+/**
+ * Invalidating some stuff after removing item from the pool.
+ * @param index index of deleted item
+ */
+void Industry::PostDestructor(size_t index)
+{
+	InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
 	Station::RecomputeIndustriesNearForAll();
 }