src/industry_cmd.cpp
changeset 7229 a5f262f6df1b
parent 7227 76ebda957d0e
child 7261 a39e79710d5a
--- a/src/industry_cmd.cpp	Wed Jul 11 08:35:14 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Jul 11 15:03:29 2007 +0000
@@ -413,7 +413,7 @@
 
 		am = MoveGoodsToStation(i->xy, i->width, i->height, indspec->produced_cargo[0], cw);
 		i->this_month_transported[0] += am;
-		if (am != 0) {
+		if (am != 0 && !StartStopIndustryTileAnimation(i, IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
 			uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
 
 			if (newgfx != INDUSTRYTILE_NOANIM) {
@@ -442,8 +442,14 @@
 static void AnimateTile_Industry(TileIndex tile)
 {
 	byte m;
+	IndustryGfx gfx = GetIndustryGfx(tile);
 
-	switch (GetIndustryGfx(tile)) {
+	if (GetIndustryTileSpec(gfx)->animation_info != 0xFFFF) {
+		AnimateNewIndustryTile(tile);
+		return;
+	}
+
+	switch (gfx) {
 	case GFX_SUGAR_MINE_SIEVE:
 		if ((_tick_counter & 1) == 0) {
 			m = GetIndustryAnimationState(tile) + 1;
@@ -629,6 +635,7 @@
 	stage = GetIndustryConstructionStage(tile) + 1;
 	SetIndustryConstructionCounter(tile, 0);
 	SetIndustryConstructionStage(tile, stage);
+	StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
 	if (stage == 3) {
 		SetIndustryCompleted(tile, true);
 	}
@@ -637,7 +644,15 @@
 
 	if (!IsIndustryCompleted(tile)) return;
 
-	switch (GetIndustryGfx(tile)) {
+	IndustryGfx gfx = GetIndustryGfx(tile);
+	if (gfx >= NEW_INDUSTRYTILEOFFSET) {
+		/* New industry */
+		const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
+		if (its->animation_info != 0xFFFF) AddAnimatedTile(tile);
+		return;
+	}
+
+	switch (gfx) {
 	case GFX_POWERPLANT_CHIMNEY:
 		CreateIndustryEffectSmoke(tile);
 		break;
@@ -701,6 +716,8 @@
 
 	TransportIndustryGoods(tile);
 
+	if (StartStopIndustryTileAnimation(tile, IAT_TILELOOP)) return;
+
 	newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
 	if (newgfx != INDUSTRYTILE_NOANIM) {
 		ResetIndustryConstructionStage(tile);
@@ -1032,6 +1049,7 @@
 	if (_game_mode == GM_EDITOR) return;
 
 	FOR_ALL_INDUSTRIES(i) {
+		StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
 		ProduceIndustryGoods(i);
 	}
 }