summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-04-16 02:56:48 +0000
committerbelugas <belugas@openttd.org>2007-04-16 02:56:48 +0000
commitcfaaad63841364098b0f25f3479699bd416ac144 (patch)
tree3bb7543c4ee9b2268c72d9973b6bee7d82c17615 /src
parent436cb4296b15401815b058ed80a6a49b7eafada3 (diff)
downloadopenttd-cfaaad63841364098b0f25f3479699bd416ac144.tar.xz
(svn r9644) -Codechange: if else cascade into a switch case
Diffstat (limited to 'src')
-rw-r--r--src/industry_cmd.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 2a403c74a..d22c7a5e4 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -458,23 +458,22 @@ static void AnimateTile_Industry(TileIndex tile)
if ((_tick_counter & 1) == 0) {
m = GetIndustryAnimationState(tile) + 1;
- if (m == 1) {
- SndPlayTileFx(SND_2C_MACHINERY, tile);
- } else if (m == 23) {
- SndPlayTileFx(SND_2B_COMEDY_HIT, tile);
- } else if (m == 28) {
- SndPlayTileFx(SND_2A_EXTRACT_AND_POP, tile);
+ switch (m) {
+ case 1: SndPlayTileFx(SND_2C_MACHINERY, tile); break;
+ case 23: SndPlayTileFx(SND_2B_COMEDY_HIT, tile); break;
+ case 28: SndPlayTileFx(SND_2A_EXTRACT_AND_POP, tile); break;
+ default:
+ if (m >= 50) {
+ int n = GetIndustryAnimationLoop(tile) + 1;
+ m = 0;
+ if (n >= 8) {
+ n = 0;
+ DeleteAnimatedTile(tile);
+ }
+ SetIndustryAnimationLoop(tile, n);
+ }
}
- if (m >= 50) {
- int n = GetIndustryAnimationLoop(tile) + 1;
- m = 0;
- if (n >= 8) {
- n = 0;
- DeleteAnimatedTile(tile);
- }
- SetIndustryAnimationLoop(tile, n);
- }
SetIndustryAnimationState(tile, m);
MarkTileDirtyByTile(tile);
}