Changeset - r3553:d56121775215
[Not reviewed]
master
0 3 0
belugas - 19 years ago 2006-04-15 01:06:53
belugas@openttd.org
(svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
Thanks to Richk67 for finding it.
Also, more Gfx define and use.
3 files changed with 19 insertions and 7 deletions:
0 comments (0 inline, 0 general)
industry_cmd.c
Show inline comments
 
@@ -268,13 +268,13 @@ IndustryType GetIndustryType(TileIndex t
 
	IndustryType iloop;
 

	
 
	assert(IsTileType(tile, MP_INDUSTRY));
 

	
 
	for (iloop = IT_COAL_MINE; iloop < IT_END; iloop += 1) {
 
		if (IS_BYTE_INSIDE(this_type, industry_gfx_Solver[iloop].MinGfx,
 
				industry_gfx_Solver[iloop].MaxGfx)) {
 
				industry_gfx_Solver[iloop].MaxGfx+1)) {
 
			return iloop;
 
		}
 
	}
 

	
 
	return IT_INVALID;  //we have not found equivalent, whatever the reason
 
}
 
@@ -630,21 +630,23 @@ static void AnimateTile_Industry(TileInd
 
			gfx = (gfx < 155) ? gfx + 1 : 148;
 
			SetIndustryGfx(tile, gfx);
 
			MarkTileDirtyByTile(tile);
 
		}
 
		break;
 

	
 
	case 30: case 31: case 32:
 
	case GFX_OILWELL_ANIM1:
 
	case GFX_OILWELL_ANIM2:
 
	case GFX_OILWELL_ANIM3:
 
		if ((_tick_counter & 7) == 0) {
 
			bool b = CHANCE16(1,7);
 
			IndustryGfx gfx = GetIndustryGfx(tile);
 

	
 
			m = GB(_m[tile].m1, 0, 2) + 1;
 
			if (m == 4 && (m = 0, ++gfx) == 32 + 1 && (gfx = 30, b)) {
 
			if (m == 4 && (m = 0, ++gfx) == GFX_OILWELL_ANIM3 + 1 && (gfx = GFX_OILWELL_ANIM1, b)) {
 
				_m[tile].m1 = 0x83;
 
				SetIndustryGfx(tile, 29);
 
				SetIndustryGfx(tile, GFX_OILWELL_BASE);
 
				DeleteAnimatedTile(tile);
 
			} else {
 
				SB(_m[tile].m1, 0, 2, m);
 
				SetIndustryGfx(tile, gfx);
 
				MarkTileDirtyByTile(tile);
 
			}
industry_map.h
Show inline comments
 
@@ -8,14 +8,24 @@
 
#include "industry.h"
 
#include "macros.h"
 
#include "tile.h"
 

	
 
typedef byte IndustryGfx;
 

	
 

	
 
/**
 
 * The following enums are indices used to know what to draw for this industry tile.
 
 * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
 
 * How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3)
 
 */
 
enum {
 
	GFX_POWERPLANT_SPARKS =  10,
 
	GFX_OILWELL_BASE      =  29,
 
	GFX_OILWELL_ANIM1     =  30,
 
	GFX_OILWELL_ANIM2     =  31,
 
	GFX_OILWELL_ANIM3     =  32,
 
	GFX_BUBBLE_CATCHER    = 162,
 
	GFX_TOFFEE_QUARY      = 165,
 
	GFX_SUGAR_MINE_SIEVE  = 174,
 
	GFX_TOY_FACTORY       = 143
 
};
 

	
station_cmd.c
Show inline comments
 
@@ -2088,23 +2088,23 @@ static void AnimateTile_Station(TileInde
 
{
 
	StationGfx gfx = GetStationGfx(tile);
 
	//FIXME -- AnimateTile_Station -> not nice code, lots of things double
 
	// again hardcoded...was a quick hack
 

	
 
	// turning radar / windsack on airport
 
	if (IS_BYTE_INSIDE(gfx, GFX_RADAR_LARGE_FIRST, GFX_RADAR_LARGE_LAST)) {
 
	if (IS_BYTE_INSIDE(gfx, GFX_RADAR_LARGE_FIRST, GFX_RADAR_LARGE_LAST+1)) {
 
		if (_tick_counter & 3)
 
			return;
 

	
 
		if (++gfx == GFX_RADAR_LARGE_LAST+1)
 
			gfx = GFX_RADAR_LARGE_FIRST;
 

	
 
		SetStationGfx(tile, gfx);
 
		MarkTileDirtyByTile(tile);
 
	//added - begin
 
	} else if (IS_BYTE_INSIDE(gfx, GFX_RADAR_INTERNATIONAL_FIRST, GFX_RADAR_METROPOLITAN_LAST)) {
 
	} else if (IS_BYTE_INSIDE(gfx, GFX_RADAR_INTERNATIONAL_FIRST, GFX_RADAR_METROPOLITAN_LAST+1)) {
 
		if (_tick_counter & 3)
 
			return;
 

	
 
		gfx++;
 

	
 
		if (gfx == GFX_RADAR_INTERNATIONAL_LAST+1) {
 
@@ -2114,13 +2114,13 @@ static void AnimateTile_Station(TileInde
 
			gfx = GFX_RADAR_METROPOLITAN_FIRST;
 
		}
 

	
 
		SetStationGfx(tile, gfx);
 
		MarkTileDirtyByTile(tile);
 
	//added - end
 
	} else if (IS_BYTE_INSIDE(gfx, GFX_WINDSACK_FIRST, GFX_WINDSACK_LAST)) {
 
	} else if (IS_BYTE_INSIDE(gfx, GFX_WINDSACK_FIRST, GFX_WINDSACK_LAST+1)) {
 
		if (_tick_counter & 1)
 
			return;
 

	
 
		if (++gfx == GFX_WINDSACK_LAST+1) {
 
			gfx = GFX_WINDSACK_FIRST;
 
		}
0 comments (0 inline, 0 general)