mirror of https://github.com/OpenTTD/OpenTTD
(svn r3254) - Fix: graphical glitch with autorail tool on a certain tile-type.
- CodeChange: adhere the global variables in autorail.h to the coding style (eg. start with underscore).release/0.4.5
parent
214ed794a1
commit
bfeddf1db1
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
// table maps each of the six rail directions and tileh combinations to a sprite
|
// table maps each of the six rail directions and tileh combinations to a sprite
|
||||||
// invalid entries are required to make sure that this array can be quickly accessed
|
// invalid entries are required to make sure that this array can be quickly accessed
|
||||||
const int AutorailTilehSprite[31][6] = {
|
const int _AutorailTilehSprite[31][6] = {
|
||||||
// type 0 1 2 3 4 5
|
// type 0 1 2 3 4 5
|
||||||
{ 0, 8, 16, 25, 34, 42 }, // tileh = 0
|
{ 0, 8, 16, 25, 34, 42 }, // tileh = 0
|
||||||
{ 5, 13, RED(22), RED(31), 35, 42 }, // tileh = 1
|
{ 5, 13, RED(22), RED(31), 35, 42 }, // tileh = 1
|
||||||
|
@ -25,7 +25,7 @@ const int AutorailTilehSprite[31][6] = {
|
||||||
{ 1, 9, 17, 26, 35, 43 }, // tileh = 7
|
{ 1, 9, 17, 26, 35, 43 }, // tileh = 7
|
||||||
{ 2, 13, 17, 25, RED(40), RED(48) }, // tileh = 8
|
{ 2, 13, 17, 25, RED(40), RED(48) }, // tileh = 8
|
||||||
{ 1, 13, 17, RED(32), 35, RED(48) }, // tileh = 9
|
{ 1, 13, 17, RED(32), 35, RED(48) }, // tileh = 9
|
||||||
{ 2, 9, 17, 26, 35, 43 }, // tileh = 10
|
{ 1, 9, 17, 26, 35, 43 }, // tileh = 10
|
||||||
{ 1, 9, 17, 26, 35, 43 }, // tileh = 11
|
{ 1, 9, 17, 26, 35, 43 }, // tileh = 11
|
||||||
{ 2, 9, 17, RED(29), RED(40), 43 }, // tileh = 12
|
{ 2, 9, 17, RED(29), RED(40), 43 }, // tileh = 12
|
||||||
{ 1, 9, 17, 26, 35, 43 }, // tileh = 13
|
{ 1, 9, 17, 26, 35, 43 }, // tileh = 13
|
||||||
|
@ -52,7 +52,7 @@ const int AutorailTilehSprite[31][6] = {
|
||||||
|
|
||||||
// maps each pixel of a tile (16x16) to a selection type
|
// maps each pixel of a tile (16x16) to a selection type
|
||||||
// (0,0) is the top corner, (16,16) the bottom corner
|
// (0,0) is the top corner, (16,16) the bottom corner
|
||||||
const byte AutorailPiece[16][16] = {
|
const byte _AutorailPiece[16][16] = {
|
||||||
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
||||||
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
||||||
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
|
||||||
|
|
|
@ -614,7 +614,7 @@ static bool IsPartOfAutoLine(int px, int py)
|
||||||
}
|
}
|
||||||
|
|
||||||
// [direction][side]
|
// [direction][side]
|
||||||
static const int AutorailType[6][2] = {
|
static const int _AutorailType[6][2] = {
|
||||||
{ HT_DIR_X, HT_DIR_X },
|
{ HT_DIR_X, HT_DIR_X },
|
||||||
{ HT_DIR_Y, HT_DIR_Y },
|
{ HT_DIR_Y, HT_DIR_Y },
|
||||||
{ HT_DIR_HU, HT_DIR_HL },
|
{ HT_DIR_HU, HT_DIR_HL },
|
||||||
|
@ -661,7 +661,7 @@ static void DrawTileSelection(const TileInfo *ti)
|
||||||
// autorail highlight piece under cursor
|
// autorail highlight piece under cursor
|
||||||
uint type = _thd.drawstyle & 0xF;
|
uint type = _thd.drawstyle & 0xF;
|
||||||
assert(type <= 5);
|
assert(type <= 5);
|
||||||
image = SPR_AUTORAIL_BASE + AutorailTilehSprite[ti->tileh][AutorailType[type][0]];
|
image = SPR_AUTORAIL_BASE + _AutorailTilehSprite[ti->tileh][_AutorailType[type][0]];
|
||||||
|
|
||||||
if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED;
|
if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED;
|
||||||
DrawSelectionSprite(image, ti);
|
DrawSelectionSprite(image, ti);
|
||||||
|
@ -680,7 +680,7 @@ static void DrawTileSelection(const TileInfo *ti)
|
||||||
side = myabs(diffx - diffy);
|
side = myabs(diffx - diffy);
|
||||||
}
|
}
|
||||||
|
|
||||||
image = SPR_AUTORAIL_BASE + AutorailTilehSprite[ti->tileh][AutorailType[dir][side]];
|
image = SPR_AUTORAIL_BASE + _AutorailTilehSprite[ti->tileh][_AutorailType[dir][side]];
|
||||||
|
|
||||||
if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED;
|
if (_thd.make_square_red) image |= PALETTE_SEL_TILE_RED;
|
||||||
DrawSelectionSprite(image, ti);
|
DrawSelectionSprite(image, ti);
|
||||||
|
@ -1843,7 +1843,7 @@ void SetTileSelectBigSize(int ox, int oy, int sx, int sy)
|
||||||
/* returns the best autorail highlight type from map coordinates */
|
/* returns the best autorail highlight type from map coordinates */
|
||||||
static byte GetAutorailHT(int x, int y)
|
static byte GetAutorailHT(int x, int y)
|
||||||
{
|
{
|
||||||
return HT_RAIL | AutorailPiece[x & 0xF][y & 0xF];
|
return HT_RAIL | _AutorailPiece[x & 0xF][y & 0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
// called regular to update tile highlighting in all cases
|
// called regular to update tile highlighting in all cases
|
||||||
|
|
Loading…
Reference in New Issue