From 2e65d6e4e76ca4a699a9c6981126fedf151992bf Mon Sep 17 00:00:00 2001 From: belugas Date: Sun, 20 May 2007 00:50:06 +0000 Subject: (svn r9886) -Codechange: Cleanup of industries (Step-13). Include the sounds table into the industry's spec. --- src/industry_cmd.cpp | 48 ++++-------------------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) (limited to 'src/industry_cmd.cpp') diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index c30ed3d4e..6b938bed8 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -905,57 +905,17 @@ static void ChopLumberMillTrees(Industry *i) i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo } -static const byte _industry_sounds[37][2] = { - {0}, - {0}, - {1, SND_28_SAWMILL}, - {0}, - {0}, - {0}, - {1, SND_03_FACTORY_WHISTLE}, - {1, SND_03_FACTORY_WHISTLE}, - {0}, - {3, SND_24_SHEEP}, - {0}, - {0}, - {0}, - {0}, - {1, SND_28_SAWMILL}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {1, SND_03_FACTORY_WHISTLE}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {0}, - {1, SND_33_PLASTIC_MINE}, - {0}, - {0}, - {0}, - {0}, -}; - - static void ProduceIndustryGoods(Industry *i) { uint32 r; uint num; + const IndustrySpec *indsp = GetIndustrySpec(i->type); /* play a sound? */ if ((i->counter & 0x3F) == 0) { - if (CHANCE16R(1, 14, r) && (num = _industry_sounds[i->type][0]) != 0) { + if (CHANCE16R(1, 14, r) && (num = indsp->number_of_sounds) != 0) { SndPlayTileFx( - (SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)), + (SoundFx)(indsp->random_sounds[((r >> 16) * num) >> 16]), i->xy); } } @@ -964,7 +924,7 @@ static void ProduceIndustryGoods(Industry *i) /* produce some cargo */ if ((i->counter & 0xFF) == 0) { - IndustyBehaviour indbehav = GetIndustrySpec(i->type)->behaviour; + IndustyBehaviour indbehav = indsp->behaviour; i->cargo_waiting[0] = min(0xffff, i->cargo_waiting[0] + i->production_rate[0]); i->cargo_waiting[1] = min(0xffff, i->cargo_waiting[1] + i->production_rate[1]); -- cgit v1.2.3-70-g09d2