diff options
author | belugas <belugas@openttd.org> | 2007-05-20 00:50:06 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-05-20 00:50:06 +0000 |
commit | 2e65d6e4e76ca4a699a9c6981126fedf151992bf (patch) | |
tree | 3277eafe41782de6af787729bd5d655eb493ec97 /src/industry_cmd.cpp | |
parent | ecb8585bd4dcf75d536fd1214bbf6be807a5e366 (diff) | |
download | openttd-2e65d6e4e76ca4a699a9c6981126fedf151992bf.tar.xz |
(svn r9886) -Codechange: Cleanup of industries (Step-13). Include the sounds table into the industry's spec.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 48 |
1 files changed, 4 insertions, 44 deletions
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]); |