src/industry_cmd.cpp
changeset 7725 e3892b38aa14
parent 7723 e6785e8fec08
child 7757 6335bd827212
equal deleted inserted replaced
7724:879d459ecb0c 7725:e3892b38aa14
   411 
   411 
   412 		i->this_month_production[0] += cw;
   412 		i->this_month_production[0] += cw;
   413 
   413 
   414 		am = MoveGoodsToStation(i->xy, i->width, i->height, indspec->produced_cargo[0], cw);
   414 		am = MoveGoodsToStation(i->xy, i->width, i->height, indspec->produced_cargo[0], cw);
   415 		i->this_month_transported[0] += am;
   415 		i->this_month_transported[0] += am;
   416 		if (am != 0) {
   416 		if (am != 0 && !StartStopIndustryTileAnimation(i, IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
   417 			uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
   417 			uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
   418 
   418 
   419 			if (newgfx != INDUSTRYTILE_NOANIM) {
   419 			if (newgfx != INDUSTRYTILE_NOANIM) {
   420 				ResetIndustryConstructionStage(tile);
   420 				ResetIndustryConstructionStage(tile);
   421 				SetIndustryCompleted(tile, true);
   421 				SetIndustryCompleted(tile, true);
   440 
   440 
   441 
   441 
   442 static void AnimateTile_Industry(TileIndex tile)
   442 static void AnimateTile_Industry(TileIndex tile)
   443 {
   443 {
   444 	byte m;
   444 	byte m;
   445 
   445 	IndustryGfx gfx = GetIndustryGfx(tile);
   446 	switch (GetIndustryGfx(tile)) {
   446 
       
   447 	if (GetIndustryTileSpec(gfx)->animation_info != 0xFFFF) {
       
   448 		AnimateNewIndustryTile(tile);
       
   449 		return;
       
   450 	}
       
   451 
       
   452 	switch (gfx) {
   447 	case GFX_SUGAR_MINE_SIEVE:
   453 	case GFX_SUGAR_MINE_SIEVE:
   448 		if ((_tick_counter & 1) == 0) {
   454 		if ((_tick_counter & 1) == 0) {
   449 			m = GetIndustryAnimationState(tile) + 1;
   455 			m = GetIndustryAnimationState(tile) + 1;
   450 
   456 
   451 			switch (m & 7) {
   457 			switch (m & 7) {
   627 	}
   633 	}
   628 
   634 
   629 	stage = GetIndustryConstructionStage(tile) + 1;
   635 	stage = GetIndustryConstructionStage(tile) + 1;
   630 	SetIndustryConstructionCounter(tile, 0);
   636 	SetIndustryConstructionCounter(tile, 0);
   631 	SetIndustryConstructionStage(tile, stage);
   637 	SetIndustryConstructionStage(tile, stage);
       
   638 	StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STATE_CHANGE);
   632 	if (stage == 3) {
   639 	if (stage == 3) {
   633 		SetIndustryCompleted(tile, true);
   640 		SetIndustryCompleted(tile, true);
   634 	}
   641 	}
   635 
   642 
   636 	MarkTileDirtyByTile(tile);
   643 	MarkTileDirtyByTile(tile);
   637 
   644 
   638 	if (!IsIndustryCompleted(tile)) return;
   645 	if (!IsIndustryCompleted(tile)) return;
   639 
   646 
   640 	switch (GetIndustryGfx(tile)) {
   647 	IndustryGfx gfx = GetIndustryGfx(tile);
       
   648 	if (gfx >= NEW_INDUSTRYTILEOFFSET) {
       
   649 		/* New industry */
       
   650 		const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
       
   651 		if (its->animation_info != 0xFFFF) AddAnimatedTile(tile);
       
   652 		return;
       
   653 	}
       
   654 
       
   655 	switch (gfx) {
   641 	case GFX_POWERPLANT_CHIMNEY:
   656 	case GFX_POWERPLANT_CHIMNEY:
   642 		CreateIndustryEffectSmoke(tile);
   657 		CreateIndustryEffectSmoke(tile);
   643 		break;
   658 		break;
   644 
   659 
   645 	case GFX_OILRIG_1:
   660 	case GFX_OILRIG_1:
   698 	}
   713 	}
   699 
   714 
   700 	if (_game_mode == GM_EDITOR) return;
   715 	if (_game_mode == GM_EDITOR) return;
   701 
   716 
   702 	TransportIndustryGoods(tile);
   717 	TransportIndustryGoods(tile);
       
   718 
       
   719 	if (StartStopIndustryTileAnimation(tile, IAT_TILELOOP)) return;
   703 
   720 
   704 	newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
   721 	newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
   705 	if (newgfx != INDUSTRYTILE_NOANIM) {
   722 	if (newgfx != INDUSTRYTILE_NOANIM) {
   706 		ResetIndustryConstructionStage(tile);
   723 		ResetIndustryConstructionStage(tile);
   707 		SetIndustryGfx(tile, newgfx);
   724 		SetIndustryGfx(tile, newgfx);
  1030 	}
  1047 	}
  1031 
  1048 
  1032 	if (_game_mode == GM_EDITOR) return;
  1049 	if (_game_mode == GM_EDITOR) return;
  1033 
  1050 
  1034 	FOR_ALL_INDUSTRIES(i) {
  1051 	FOR_ALL_INDUSTRIES(i) {
       
  1052 		StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
  1035 		ProduceIndustryGoods(i);
  1053 		ProduceIndustryGoods(i);
  1036 	}
  1054 	}
  1037 }
  1055 }
  1038 
  1056 
  1039 
  1057