mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 03:12:41 +00:00
(svn r7673) -Backport from trunk (r7563):
- [FS#468] Removing towns in scenario editor didn't remove their subsidies.
This commit is contained in:
parent
6fa93f4a7a
commit
0adf61e7fa
15
economy.c
15
economy.c
@ -848,6 +848,19 @@ Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode)
|
||||
return tp;
|
||||
}
|
||||
|
||||
void DeleteSubsidyWithTown(TownID index)
|
||||
{
|
||||
Subsidy *s;
|
||||
|
||||
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||
if (s->cargo_type != CT_INVALID && s->age < 12 &&
|
||||
(((s->cargo_type == CT_PASSENGERS || s->cargo_type == CT_MAIL) && (index == s->from || index == s->to)) ||
|
||||
((s->cargo_type == CT_GOODS || s->cargo_type == CT_FOOD) && index == s->to))) {
|
||||
s->cargo_type = CT_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteSubsidyWithIndustry(IndustryID index)
|
||||
{
|
||||
Subsidy *s;
|
||||
@ -855,7 +868,7 @@ void DeleteSubsidyWithIndustry(IndustryID index)
|
||||
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||
if (s->cargo_type != CT_INVALID && s->age < 12 &&
|
||||
s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL &&
|
||||
(index == s->from || (s->cargo_type!=CT_GOODS && s->cargo_type!=CT_FOOD && index==s->to))) {
|
||||
(index == s->from || (s->cargo_type != CT_GOODS && s->cargo_type != CT_FOOD && index == s->to))) {
|
||||
s->cargo_type = CT_INVALID;
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,9 @@ int UpdateCompanyRatingAndValue(Player *p, bool update);
|
||||
|
||||
VARDEF Subsidy _subsidies[MAX_PLAYERS];
|
||||
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
|
||||
void DeleteSubsidyWithIndustry(uint16 index);
|
||||
void DeleteSubsidyWithStation(uint16 index);
|
||||
void DeleteSubsidyWithTown(TownID index);
|
||||
void DeleteSubsidyWithIndustry(IndustryID index);
|
||||
void DeleteSubsidyWithStation(StationID index);
|
||||
|
||||
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type);
|
||||
uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount);
|
||||
|
@ -79,6 +79,7 @@ void DestroyTown(Town *t)
|
||||
}
|
||||
|
||||
DeleteName(t->townnametype);
|
||||
DeleteSubsidyWithTown(t->index);
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user