summaryrefslogtreecommitdiff
path: root/src/industry_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
committerfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
commita4557c7da4329188e3561d9404891c0346f8f70e (patch)
tree96e7ba45ee42e5b0d0c8ca2867b081a56ebef645 /src/industry_cmd.cpp
parentb7d065ce99886e2cf86883469a077f653428e5b8 (diff)
downloadopenttd-a4557c7da4329188e3561d9404891c0346f8f70e.tar.xz
(svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r--src/industry_cmd.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index ecb2a3c23..73fc7bb2d 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -164,6 +164,7 @@ Industry::~Industry()
DecIndustryTypeCount(this->type);
DeleteSubsidyWithIndustry(this->index);
+ DeleteIndustryNews(this->index);
DeleteWindowById(WC_INDUSTRY_VIEW, this->index);
InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, 0);
}
@@ -1693,7 +1694,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
} else {
SetDParam(1, ind->town->index);
}
- AddNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->xy, 0);
+ AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
}
@@ -1898,7 +1899,7 @@ static void MaybeNewIndustry()
} else {
SetDParam(1, ind->town->index);
}
- AddNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->xy, 0);
+ AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new AIEventIndustryOpen(ind->index));
}
@@ -2042,10 +2043,10 @@ static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int
SetDParam(2, abs(percent));
SetDParam(0, GetCargo(type)->name);
SetDParam(1, ind->index);
- AddNewsItem(
+ AddIndustryNewsItem(
percent >= 0 ? STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_SMOOTH : STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_SMOOTH,
ns,
- ind->xy + TileDiffXY(1, 1), 0
+ ind->index
);
}
@@ -2250,7 +2251,8 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
/* and report the news to the user */
AddNewsItem(str,
ns,
- i->xy + TileDiffXY(1, 1), 0);
+ closeit ? NR_TILE : NR_INDUSTRY,
+ closeit ? i->xy + TileDiffXY(1, 1) : i->index);
}
}