src/industry_cmd.cpp
changeset 7186 818eba1f20d5
parent 7185 1b6b21b69c2d
child 7199 e65a28455ee3
equal deleted inserted replaced
7185:1b6b21b69c2d 7186:818eba1f20d5
   790 	b[1] = i->produced_cargo[1];
   790 	b[1] = i->produced_cargo[1];
   791 }
   791 }
   792 
   792 
   793 static void ChangeTileOwner_Industry(TileIndex tile, PlayerID old_player, PlayerID new_player)
   793 static void ChangeTileOwner_Industry(TileIndex tile, PlayerID old_player, PlayerID new_player)
   794 {
   794 {
   795 	/* not used */
   795 	/* If the founder merges, the industry was created by the merged company */
       
   796 	Industry *i = GetIndustryByTile(tile);
       
   797 	if (i->founder == old_player) i->founder = (new_player == PLAYER_SPECTATOR) ? OWNER_NONE : new_player;
   796 }
   798 }
   797 
   799 
   798 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
   800 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
   799 
   801 
   800 static bool IsBadFarmFieldTile(TileIndex tile)
   802 static bool IsBadFarmFieldTile(TileIndex tile)
  1409 	i->last_month_transported[1] = 0;
  1411 	i->last_month_transported[1] = 0;
  1410 	i->was_cargo_delivered = false;
  1412 	i->was_cargo_delivered = false;
  1411 	i->last_prod_year = _cur_year;
  1413 	i->last_prod_year = _cur_year;
  1412 	i->last_month_production[0] = i->production_rate[0] * 8;
  1414 	i->last_month_production[0] = i->production_rate[0] * 8;
  1413 	i->last_month_production[1] = i->production_rate[1] * 8;
  1415 	i->last_month_production[1] = i->production_rate[1] * 8;
       
  1416 	i->founder = _current_player;
       
  1417 	i->construction_date = _date;
       
  1418 	i->construction_type = (_game_mode == GM_EDITOR) ? ICT_SCENARIO_EDITOR :
       
  1419 			(_generating_world ? ICT_MAP_GENERATION : ICT_NORMAL_GAMEPLAY);
  1414 
  1420 
  1415 	if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0;
  1421 	if (!_generating_world) i->last_month_production[0] = i->last_month_production[1] = 0;
  1416 
  1422 
  1417 	i->prod_level = 0x10;
  1423 	i->prod_level = 0x10;
  1418 
  1424 
  1949 	    SLE_VAR(Industry, random_color,               SLE_UINT8),
  1955 	    SLE_VAR(Industry, random_color,               SLE_UINT8),
  1950 	SLE_CONDVAR(Industry, last_prod_year,             SLE_FILE_U8 | SLE_VAR_I32,  0, 30),
  1956 	SLE_CONDVAR(Industry, last_prod_year,             SLE_FILE_U8 | SLE_VAR_I32,  0, 30),
  1951 	SLE_CONDVAR(Industry, last_prod_year,             SLE_INT32,                 31, SL_MAX_VERSION),
  1957 	SLE_CONDVAR(Industry, last_prod_year,             SLE_INT32,                 31, SL_MAX_VERSION),
  1952 	    SLE_VAR(Industry, was_cargo_delivered,        SLE_UINT8),
  1958 	    SLE_VAR(Industry, was_cargo_delivered,        SLE_UINT8),
  1953 
  1959 
       
  1960 	SLE_CONDVAR(Industry, owner,                      SLE_UINT8,                 70, SL_MAX_VERSION),
       
  1961 	SLE_CONDVAR(Industry, construction_date,          SLE_INT32,                 70, SL_MAX_VERSION),
       
  1962 	SLE_CONDVAR(Industry, construction_type,          SLE_UINT8,                 70, SL_MAX_VERSION),
       
  1963 	SLE_CONDVAR(Industry, last_cargo_accepted_at,     SLE_INT32,                 70, SL_MAX_VERSION),
       
  1964 
  1954 	/* reserve extra space in savegame here. (currently 32 bytes) */
  1965 	/* reserve extra space in savegame here. (currently 32 bytes) */
  1955 	SLE_CONDNULL(32, 2, SL_MAX_VERSION),
  1966 	SLE_CONDNULL(32, 2, SL_MAX_VERSION),
  1956 
  1967 
  1957 	SLE_END()
  1968 	SLE_END()
  1958 };
  1969 };