diff options
author | rubidium <rubidium@openttd.org> | 2007-07-07 08:53:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-07-07 08:53:19 +0000 |
commit | 9a55c79fd11e9075b937abe0a6a077fa77a72823 (patch) | |
tree | b284545aafd09cc7fb92b71fbb6207c155507b8f /src/industry_cmd.cpp | |
parent | c86015203aa7e85cd4e5d6044896a203028ca16a (diff) | |
download | openttd-9a55c79fd11e9075b937abe0a6a077fa77a72823.tar.xz |
(svn r10460) -Codechange: add some more variables needed for newindustries regarding to the creation of the industries.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 3deb5c673..0162f7ce5 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -792,7 +792,9 @@ static void GetProducedCargo_Industry(TileIndex tile, CargoID *b) static void ChangeTileOwner_Industry(TileIndex tile, PlayerID old_player, PlayerID new_player) { - /* not used */ + /* If the founder merges, the industry was created by the merged company */ + Industry *i = GetIndustryByTile(tile); + if (i->founder == old_player) i->founder = (new_player == PLAYER_SPECTATOR) ? OWNER_NONE : new_player; } static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; @@ -1411,6 +1413,10 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind i->last_prod_year = _cur_year; i->last_month_production[0] = i->production_rate[0] * 8; i->last_month_production[1] = i->production_rate[1] * 8; + i->founder = _current_player; + i->construction_date = _date; + i->construction_type = (_game_mode == GM_EDITOR) ? ICT_SCENARIO_EDITOR : + (_generating_world ? ICT_MAP_GENERATION : ICT_NORMAL_GAMEPLAY); if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0; @@ -1951,6 +1957,11 @@ static const SaveLoad _industry_desc[] = { SLE_CONDVAR(Industry, last_prod_year, SLE_INT32, 31, SL_MAX_VERSION), SLE_VAR(Industry, was_cargo_delivered, SLE_UINT8), + SLE_CONDVAR(Industry, owner, SLE_UINT8, 70, SL_MAX_VERSION), + 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), + /* reserve extra space in savegame here. (currently 32 bytes) */ SLE_CONDNULL(32, 2, SL_MAX_VERSION), |