industry_cmd.c
changeset 3321 4061bfef1830
parent 3320 e9e284ab853a
child 3326 00cf690a7fe1
equal deleted inserted replaced
3320:e9e284ab853a 3321:4061bfef1830
   261 static void IndustryDrawSugarMine(const TileInfo *ti)
   261 static void IndustryDrawSugarMine(const TileInfo *ti)
   262 {
   262 {
   263 	const DrawIndustrySpec1Struct *d;
   263 	const DrawIndustrySpec1Struct *d;
   264 	uint32 image;
   264 	uint32 image;
   265 
   265 
   266 	if (!(_m[ti->tile].m1 & 0x80)) return;
   266 	if (!IsIndustryCompleted(ti->tile)) return;
   267 
   267 
   268 	d = &_draw_industry_spec1[_m[ti->tile].m3];
   268 	d = &_draw_industry_spec1[_m[ti->tile].m3];
   269 
   269 
   270 	AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, d->x, 0);
   270 	AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, d->x, 0);
   271 
   271 
   281 
   281 
   282 static void IndustryDrawToffeeQuarry(const TileInfo *ti)
   282 static void IndustryDrawToffeeQuarry(const TileInfo *ti)
   283 {
   283 {
   284 	int x = 0;
   284 	int x = 0;
   285 
   285 
   286 	if (_m[ti->tile].m1 & 0x80) {
   286 	if (IsIndustryCompleted(ti->tile)) {
   287 		x = _industry_anim_offs[_m[ti->tile].m3];
   287 		x = _industry_anim_offs[_m[ti->tile].m3];
   288 		if ( (byte)x == 0xFF)
   288 		if ( (byte)x == 0xFF)
   289 			x = 0;
   289 			x = 0;
   290 	}
   290 	}
   291 
   291 
   293 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, 6, 14);
   293 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, 6, 14);
   294 }
   294 }
   295 
   295 
   296 static void IndustryDrawBubbleGenerator( const TileInfo *ti)
   296 static void IndustryDrawBubbleGenerator( const TileInfo *ti)
   297 {
   297 {
   298 	if (_m[ti->tile].m1 & 0x80) {
   298 	if (IsIndustryCompleted(ti->tile)) {
   299 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, 5, _industry_anim_offs_2[_m[ti->tile].m3]);
   299 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, 5, _industry_anim_offs_2[_m[ti->tile].m3]);
   300 	} else {
   300 	} else {
   301 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, 3, 67);
   301 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, 3, 67);
   302 	}
   302 	}
   303 }
   303 }
   320 	AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP_HOLDER, 0, 42);
   320 	AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP_HOLDER, 0, 42);
   321 }
   321 }
   322 
   322 
   323 static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
   323 static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
   324 {
   324 {
   325 	int image = _m[ti->tile].m1;
   325 	if (IsIndustryCompleted(ti->tile)) {
   326 	if (image & 0x80) {
   326 		uint image = GB(_m[ti->tile].m1, 2, 5);
   327 		image = GB(image, 2, 5);
   327 
   328 		if (image != 0 && image < 7) {
   328 		if (image != 0 && image < 7) {
   329 			AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
   329 			AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
   330 				_coal_plant_sparks_x[image - 1],
   330 				_coal_plant_sparks_x[image - 1],
   331 				_coal_plant_sparks_y[image - 1]
   331 				_coal_plant_sparks_y[image - 1]
   332 			);
   332 			);
   427 {
   427 {
   428 	const Industry* i = GetIndustryByTile(tile);
   428 	const Industry* i = GetIndustryByTile(tile);
   429 
   429 
   430 	td->owner = i->owner;
   430 	td->owner = i->owner;
   431 	td->str = STR_4802_COAL_MINE + i->type;
   431 	td->str = STR_4802_COAL_MINE + i->type;
   432 	if ((_m[tile].m1 & 0x80) == 0) {
   432 	if (!IsIndustryCompleted(tile)) {
   433 		SetDParamX(td->dparam, 0, td->str);
   433 		SetDParamX(td->dparam, 0, td->str);
   434 		td->str = STR_2058_UNDER_CONSTRUCTION;
   434 		td->str = STR_2058_UNDER_CONSTRUCTION;
   435 	}
   435 	}
   436 }
   436 }
   437 
   437 
   688 	if (size == 3) size |= 0x80;
   688 	if (size == 3) size |= 0x80;
   689 	_m[tile].m1 = size | b;
   689 	_m[tile].m1 = size | b;
   690 
   690 
   691 	MarkTileDirtyByTile(tile);
   691 	MarkTileDirtyByTile(tile);
   692 
   692 
   693 	if (!(_m[tile].m1 & 0x80))
   693 	if (!IsIndustryCompleted(tile)) return;
   694 		return;
       
   695 
   694 
   696 	switch (_m[tile].m5) {
   695 	switch (_m[tile].m5) {
   697 	case 8:
   696 	case 8:
   698 		CreateIndustryEffectSmoke(tile);
   697 		CreateIndustryEffectSmoke(tile);
   699 		break;
   698 		break;
   743 
   742 
   744 static void TileLoop_Industry(TileIndex tile)
   743 static void TileLoop_Industry(TileIndex tile)
   745 {
   744 {
   746 	byte n;
   745 	byte n;
   747 
   746 
   748 	if (!(_m[tile].m1 & 0x80)) {
   747 	if (!IsIndustryCompleted(tile)) {
   749 		MakeIndustryTileBigger(tile, _m[tile].m1);
   748 		MakeIndustryTileBigger(tile, _m[tile].m1);
   750 		return;
   749 		return;
   751 	}
   750 	}
   752 
   751 
   753 	if (_game_mode == GM_EDITOR) return;
   752 	if (_game_mode == GM_EDITOR) return;
  1006 	};
  1005 	};
  1007 
  1006 
  1008 	TileIndex tile = i->xy;
  1007 	TileIndex tile = i->xy;
  1009 	int a;
  1008 	int a;
  1010 
  1009 
  1011 	if ((_m[tile].m1 & 0x80) == 0) return;
  1010 	if (!IsIndustryCompleted(tile)) return;
  1012 
  1011 
  1013 	/* search outwards as a rectangular spiral */
  1012 	/* search outwards as a rectangular spiral */
  1014 	for (a = 1; a != 41; a += 2) {
  1013 	for (a = 1; a != 41; a += 2) {
  1015 		uint dir;
  1014 		uint dir;
  1016 
  1015