From f48e05ec73ce64006d1d88b54597e48e748e2554 Mon Sep 17 00:00:00 2001 From: belugas Date: Wed, 15 Aug 2007 00:49:34 +0000 Subject: (svn r10903) -Feature: [NewGRF] Add support for variable 44 of Variational Action 2 for Industries --- src/industry_cmd.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/industry_cmd.cpp') diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index a592642dd..ce9e15ae8 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1396,7 +1396,7 @@ static bool CheckIfTooCloseToIndustry(TileIndex tile, int type) return true; } -static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, Owner owner) +static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, byte layout, const Town *t, Owner owner) { const IndustrySpec *indspec = GetIndustrySpec(type); uint32 r; @@ -1443,6 +1443,11 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind i->construction_type = (_game_mode == GM_EDITOR) ? ICT_SCENARIO_EDITOR : (_generating_world ? ICT_MAP_GENERATION : ICT_NORMAL_GAMEPLAY); + /* Adding 1 here makes it conform to specs of var44 of varaction2 for industries + * 0 = created prior of newindustries + * else, chosen layout + 1 */ + i->selected_layout = layout + 1; + if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0; i->prod_level = 0x10; @@ -1514,7 +1519,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint if (flags & DC_EXEC) { if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_EXEC, it, type); - DoCreateNewIndustry(i, tile, type, it, t, OWNER_NONE); + DoCreateNewIndustry(i, tile, type, it, itspec_index, t, OWNER_NONE); i_auto_delete.Detach(); } @@ -2017,6 +2022,7 @@ static const SaveLoad _industry_desc[] = { SLE_CONDVAR(Industry, construction_date, SLE_INT32, 70, SL_MAX_VERSION), SLE_CONDVAR(Industry, construction_type, SLE_UINT8, 70, SL_MAX_VERSION), SLE_CONDVAR(Industry, last_cargo_accepted_at, SLE_INT32, 70, SL_MAX_VERSION), + SLE_CONDVAR(Industry, selected_layout, SLE_UINT8, 73, SL_MAX_VERSION), /* reserve extra space in savegame here. (currently 32 bytes) */ SLE_CONDNULL(32, 2, SL_MAX_VERSION), -- cgit v1.2.3-54-g00ecf