(svn r10639) -Codechange: Give meaninfull name to a magic number
authorbelugas
Fri, 20 Jul 2007 17:14:03 +0000
changeset 7787 6e0b6ea38850
parent 7786 7a03d776107a
child 7788 0728ab7b5253
(svn r10639) -Codechange: Give meaninfull name to a magic number
src/industry.h
src/industry_cmd.cpp
--- a/src/industry.h	Fri Jul 20 16:50:11 2007 +0000
+++ b/src/industry.h	Fri Jul 20 17:14:03 2007 +0000
@@ -20,6 +20,7 @@
 	INVALID_INDUSTRYTYPE   = NUM_INDUSTRYTYPES,          ///< one above amount is considered invalid
 	NUM_INDUSTRYTILES      = NEW_INDUSTRYTILEOFFSET,     ///< total number of industry tiles, new and old
 	INVALID_INDUSTRYTILE   = NUM_INDUSTRYTILES,          ///< one above amount is considered invalid
+	INDUSTRY_COMPLETED     = 3,                          ///< final stage of industry construction.
 };
 
 enum {
--- a/src/industry_cmd.cpp	Fri Jul 20 16:50:11 2007 +0000
+++ b/src/industry_cmd.cpp	Fri Jul 20 17:14:03 2007 +0000
@@ -276,7 +276,7 @@
 	}
 
 	dits = &_industry_draw_tile_data[gfx << 2 | (indts->anim_state ?
-			GetIndustryAnimationState(ti->tile) & 3 :
+			GetIndustryAnimationState(ti->tile) & INDUSTRY_COMPLETED :
 			GetIndustryConstructionStage(ti->tile))];
 
 	image = dits->ground.sprite;
@@ -642,9 +642,7 @@
 	SetIndustryConstructionCounter(tile, 0);
 	SetIndustryConstructionStage(tile, stage);
 	StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
-	if (stage == 3) {
-		SetIndustryCompleted(tile, true);
-	}
+	if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile, true);
 
 	MarkTileDirtyByTile(tile);