src/industry_cmd.cpp
changeset 6655 3d46f5ba9b6e
parent 6639 d9e4445b518d
child 6656 17d684b981bf
equal deleted inserted replaced
6654:31d17823506f 6655:3d46f5ba9b6e
   903 
   903 
   904 	if (CircularTileSearch(tile, 40, SearchLumberMillTrees, 0)) ///< 40x40 tiles  to search
   904 	if (CircularTileSearch(tile, 40, SearchLumberMillTrees, 0)) ///< 40x40 tiles  to search
   905 		i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo
   905 		i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo
   906 }
   906 }
   907 
   907 
   908 static const byte _industry_sounds[37][2] = {
       
   909 	{0},
       
   910 	{0},
       
   911 	{1, SND_28_SAWMILL},
       
   912 	{0},
       
   913 	{0},
       
   914 	{0},
       
   915 	{1, SND_03_FACTORY_WHISTLE},
       
   916 	{1, SND_03_FACTORY_WHISTLE},
       
   917 	{0},
       
   918 	{3, SND_24_SHEEP},
       
   919 	{0},
       
   920 	{0},
       
   921 	{0},
       
   922 	{0},
       
   923 	{1, SND_28_SAWMILL},
       
   924 	{0},
       
   925 	{0},
       
   926 	{0},
       
   927 	{0},
       
   928 	{0},
       
   929 	{0},
       
   930 	{0},
       
   931 	{0},
       
   932 	{1, SND_03_FACTORY_WHISTLE},
       
   933 	{0},
       
   934 	{0},
       
   935 	{0},
       
   936 	{0},
       
   937 	{0},
       
   938 	{0},
       
   939 	{0},
       
   940 	{0},
       
   941 	{1, SND_33_PLASTIC_MINE},
       
   942 	{0},
       
   943 	{0},
       
   944 	{0},
       
   945 	{0},
       
   946 };
       
   947 
       
   948 
       
   949 static void ProduceIndustryGoods(Industry *i)
   908 static void ProduceIndustryGoods(Industry *i)
   950 {
   909 {
   951 	uint32 r;
   910 	uint32 r;
   952 	uint num;
   911 	uint num;
       
   912 	const IndustrySpec *indsp = GetIndustrySpec(i->type);
   953 
   913 
   954 	/* play a sound? */
   914 	/* play a sound? */
   955 	if ((i->counter & 0x3F) == 0) {
   915 	if ((i->counter & 0x3F) == 0) {
   956 		if (CHANCE16R(1, 14, r) && (num = _industry_sounds[i->type][0]) != 0) {
   916 		if (CHANCE16R(1, 14, r) && (num = indsp->number_of_sounds) != 0) {
   957 			SndPlayTileFx(
   917 			SndPlayTileFx(
   958 				(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
   918 				(SoundFx)(indsp->random_sounds[((r >> 16) * num) >> 16]),
   959 				i->xy);
   919 				i->xy);
   960 		}
   920 		}
   961 	}
   921 	}
   962 
   922 
   963 	i->counter--;
   923 	i->counter--;
   964 
   924 
   965 	/* produce some cargo */
   925 	/* produce some cargo */
   966 	if ((i->counter & 0xFF) == 0) {
   926 	if ((i->counter & 0xFF) == 0) {
   967 		IndustyBehaviour indbehav = GetIndustrySpec(i->type)->behaviour;
   927 		IndustyBehaviour indbehav = indsp->behaviour;
   968 		i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + i->production_rate[0]);
   928 		i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + i->production_rate[0]);
   969 		i->cargo_waiting[1] = min(0xffff, i->cargo_waiting[1] + i->production_rate[1]);
   929 		i->cargo_waiting[1] = min(0xffff, i->cargo_waiting[1] + i->production_rate[1]);
   970 
   930 
   971 		if (indbehav & INDUSTRYBEH_PLANT_FIELDS) {
   931 		if (indbehav & INDUSTRYBEH_PLANT_FIELDS) {
   972 			MaybePlantFarmField(i);
   932 			MaybePlantFarmField(i);