Changeset - r6468:72ff103cee5b
[Not reviewed]
master
0 1 0
belugas - 17 years ago 2007-04-16 02:56:48
belugas@openttd.org
(svn r9644) -Codechange: if else cascade into a switch case
1 file changed with 14 insertions and 15 deletions:
0 comments (0 inline, 0 general)
src/industry_cmd.cpp
Show inline comments
 
@@ -458,23 +458,22 @@ static void AnimateTile_Industry(TileInd
 
		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);
 
		}
0 comments (0 inline, 0 general)