|
@@ -144,13 +144,12 @@ void DestroyIndustry(Industry *i)
|
|
|
SetIndustryIndexOfField(tile_cur, INVALID_INDUSTRY);
|
|
|
}
|
|
|
} END_TILE_LOOP(tile_cur, 42, 42, i->xy - TileDiff(21, 21))
|
|
|
}
|
|
|
|
|
|
_industry_sort_dirty = true;
|
|
|
_total_industries--;
|
|
|
DecIndustryTypeCount(i->type);
|
|
|
|
|
|
DeleteSubsidyWithIndustry(i->index);
|
|
|
DeleteWindowById(WC_INDUSTRY_VIEW, i->index);
|
|
|
InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0);
|
|
|
}
|
|
@@ -1352,13 +1351,12 @@ static Industry *AllocateIndustry()
|
|
|
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, Owner owner)
|
|
|
{
|
|
|
const IndustrySpec *indspec = GetIndustrySpec(type);
|
|
|
uint32 r;
|
|
|
int j;
|
|
|
|
|
|
_total_industries++;
|
|
|
i->xy = tile;
|
|
|
i->width = i->height = 0;
|
|
|
i->type = type;
|
|
|
IncIndustryTypeCount(type);
|
|
|
|
|
|
i->production_rate[0] = indspec->production_rate[0];
|
|
@@ -1854,14 +1852,13 @@ void IndustryMonthlyLoop()
|
|
|
|
|
|
void InitializeIndustries()
|
|
|
{
|
|
|
CleanPool(&_Industry_pool);
|
|
|
AddBlockToPool(&_Industry_pool);
|
|
|
|
|
|
_total_industries = 0;
|
|
|
memset(&_industry_counts, 0, sizeof(_industry_counts));
|
|
|
ResetIndustryCounts();
|
|
|
_industry_sort_dirty = true;
|
|
|
_industry_sound_tile = 0;
|
|
|
}
|
|
|
|
|
|
extern const TileTypeProcs _tile_type_industry_procs = {
|
|
|
DrawTile_Industry, /* draw_tile_proc */
|
|
@@ -1923,25 +1920,23 @@ static void Save_INDY()
|
|
|
}
|
|
|
|
|
|
static void Load_INDY()
|
|
|
{
|
|
|
int index;
|
|
|
|
|
|
_total_industries = 0;
|
|
|
ResetIndustryCounts();
|
|
|
|
|
|
while ((index = SlIterateArray()) != -1) {
|
|
|
Industry *i;
|
|
|
|
|
|
if (!AddBlockIfNeeded(&_Industry_pool, index))
|
|
|
error("Industries: failed loading savegame: too many industries");
|
|
|
|
|
|
i = GetIndustry(index);
|
|
|
SlObject(i, _industry_desc);
|
|
|
IncIndustryTypeCount(i->type);
|
|
|
|
|
|
_total_industries++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern const ChunkHandler _industry_chunk_handlers[] = {
|
|
|
{ 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST},
|
|
|
};
|