industry_cmd.c
changeset 4942 7fb6c39eb421
parent 4924 b6fa01b5a80d
child 4965 a09db997a1f3
equal deleted inserted replaced
4941:abae74082807 4942:7fb6c39eb421
   213 	byte z;
   213 	byte z;
   214 	uint32 image, ormod;
   214 	uint32 image, ormod;
   215 
   215 
   216 	/* Pointer to industry */
   216 	/* Pointer to industry */
   217 	ind = GetIndustryByTile(ti->tile);
   217 	ind = GetIndustryByTile(ti->tile);
   218 	ormod = GENERAL_SPRITE_COLOR(ind->color_map);
   218 	ormod = GENERAL_SPRITE_COLOR(ind->random_color);
   219 
   219 
   220 	/* Retrieve pointer to the draw industry tile struct */
   220 	/* Retrieve pointer to the draw industry tile struct */
   221 	dits = &_industry_draw_tile_data[GetIndustryGfx(ti->tile) << 2 | GetIndustryConstructionStage(ti->tile)];
   221 	dits = &_industry_draw_tile_data[GetIndustryGfx(ti->tile) << 2 | GetIndustryConstructionStage(ti->tile)];
   222 
   222 
   223 	image = dits->ground;
   223 	image = dits->ground;
   288 static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
   288 static void GetTileDesc_Industry(TileIndex tile, TileDesc *td)
   289 {
   289 {
   290 	const Industry *i = GetIndustryByTile(tile);
   290 	const Industry *i = GetIndustryByTile(tile);
   291 
   291 
   292 	td->owner = i->owner;
   292 	td->owner = i->owner;
   293 	td->str = STR_4802_COAL_MINE + i->type;
   293 	td->str = GetIndustrySpec(i->type)->name;
   294 	if (!IsIndustryCompleted(tile)) {
   294 	if (!IsIndustryCompleted(tile)) {
   295 		SetDParamX(td->dparam, 0, td->str);
   295 		SetDParamX(td->dparam, 0, td->str);
   296 		td->str = STR_2058_UNDER_CONSTRUCTION;
   296 		td->str = STR_2058_UNDER_CONSTRUCTION;
   297 	}
   297 	}
   298 }
   298 }
   307 	 * (area around OILRIG is water, so water shouldn't flood it
   307 	 * (area around OILRIG is water, so water shouldn't flood it
   308 	 */
   308 	 */
   309 	if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR &&
   309 	if ((_current_player != OWNER_WATER && _game_mode != GM_EDITOR &&
   310 			!_cheats.magic_bulldozer.value) ||
   310 			!_cheats.magic_bulldozer.value) ||
   311 			(_current_player == OWNER_WATER && i->type == IT_OIL_RIG)) {
   311 			(_current_player == OWNER_WATER && i->type == IT_OIL_RIG)) {
   312 		SetDParam(0, STR_4802_COAL_MINE + i->type);
   312 		SetDParam(0, GetIndustrySpec(i->type)->name);
   313 		return_cmd_error(STR_4800_IN_THE_WAY);
   313 		return_cmd_error(STR_4800_IN_THE_WAY);
   314 	}
   314 	}
   315 
   315 
   316 	if (flags & DC_EXEC) DeleteIndustry(i);
   316 	if (flags & DC_EXEC) DeleteIndustry(i);
   317 	return 0;
   317 	return 0;
  1411 
  1411 
  1412 	i->town = t;
  1412 	i->town = t;
  1413 	i->owner = owner;
  1413 	i->owner = owner;
  1414 
  1414 
  1415 	r = Random();
  1415 	r = Random();
  1416 	i->color_map = GB(r, 8, 4);
  1416 	i->random_color = GB(r, 8, 4);
  1417 	i->counter = GB(r, 0, 12);
  1417 	i->counter = GB(r, 0, 12);
  1418 	i->cargo_waiting[0] = 0;
  1418 	i->cargo_waiting[0] = 0;
  1419 	i->cargo_waiting[1] = 0;
  1419 	i->cargo_waiting[1] = 0;
  1420 	i->last_mo_production[0] = 0;
  1420 	i->last_mo_production[0] = 0;
  1421 	i->last_mo_production[1] = 0;
  1421 	i->last_mo_production[1] = 0;
  1752 		i = CreateNewIndustry(RandomTile(), type);
  1752 		i = CreateNewIndustry(RandomTile(), type);
  1753 		if (i != NULL) break;
  1753 		if (i != NULL) break;
  1754 		if (--j == 0) return;
  1754 		if (--j == 0) return;
  1755 	}
  1755 	}
  1756 
  1756 
  1757 	SetDParam(0, type + STR_4802_COAL_MINE);
  1757 	SetDParam(0, GetIndustrySpec(type)->name);
  1758 	SetDParam(1, i->town->index);
  1758 	SetDParam(1, i->town->index);
  1759 	AddNewsItem(
  1759 	AddNewsItem(
  1760 		(type != IT_FOREST && type != IT_FRUIT_PLANTATION && type != IT_RUBBER_PLANTATION && type != IT_COTTON_CANDY) ?
  1760 		(type != IT_FOREST && type != IT_FRUIT_PLANTATION && type != IT_RUBBER_PLANTATION && type != IT_COTTON_CANDY) ?
  1761 			STR_482D_NEW_UNDER_CONSTRUCTION : STR_482E_NEW_BEING_PLANTED_NEAR,
  1761 			STR_482D_NEW_UNDER_CONSTRUCTION : STR_482E_NEW_BEING_PLANTED_NEAR,
  1762 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY,0), i->xy, 0
  1762 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY,0), i->xy, 0
  1902 
  1902 
  1903 	    SLE_VAR(Industry, counter,             SLE_UINT16),
  1903 	    SLE_VAR(Industry, counter,             SLE_UINT16),
  1904 
  1904 
  1905 	    SLE_VAR(Industry, type,                SLE_UINT8),
  1905 	    SLE_VAR(Industry, type,                SLE_UINT8),
  1906 	    SLE_VAR(Industry, owner,               SLE_UINT8),
  1906 	    SLE_VAR(Industry, owner,               SLE_UINT8),
  1907 	    SLE_VAR(Industry, color_map,           SLE_UINT8),
  1907 	    SLE_VAR(Industry, random_color,        SLE_UINT8),
  1908 	SLE_CONDVAR(Industry, last_prod_year,      SLE_FILE_U8 | SLE_VAR_I32,  0, 30),
  1908 	SLE_CONDVAR(Industry, last_prod_year,      SLE_FILE_U8 | SLE_VAR_I32,  0, 30),
  1909 	SLE_CONDVAR(Industry, last_prod_year,      SLE_INT32,                 31, SL_MAX_VERSION),
  1909 	SLE_CONDVAR(Industry, last_prod_year,      SLE_INT32,                 31, SL_MAX_VERSION),
  1910 	    SLE_VAR(Industry, was_cargo_delivered, SLE_UINT8),
  1910 	    SLE_VAR(Industry, was_cargo_delivered, SLE_UINT8),
  1911 
  1911 
  1912 	// reserve extra space in savegame here. (currently 32 bytes)
  1912 	// reserve extra space in savegame here. (currently 32 bytes)