(svn r10889) [NewGRF_ports] -Feature: Colour of highlight for FSMs with placement masks shows Green for land tiles, and Blue for water tiles.
Binary file bin/data/airports.grf has changed
--- a/src/airport_gui.cpp Mon Aug 13 21:11:21 2007 +0000
+++ b/src/airport_gui.cpp Tue Aug 14 15:34:53 2007 +0000
@@ -227,6 +227,8 @@
DrawFSMportsTile(9, 106, preview_sprite, _airport.fsmports_class, _airport.station_type);
}
_thd.FSMportLayout = &fsmportspec->layouts[_airport.layout_set]; // irregular airport support
+ _thd.FSMportMask = NULL;
+ if (fsmportspec->layout_mask != NULL) _thd.FSMportMask = &fsmportspec->layout_mask[_airport.layout_set]; // irregular airport support
int rad = _patches.modified_catchment ? fsmportspec->portFSM->catchment : 4;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
--- a/src/dock_gui.cpp Mon Aug 13 21:11:21 2007 +0000
+++ b/src/dock_gui.cpp Tue Aug 14 15:34:53 2007 +0000
@@ -251,6 +251,7 @@
}
_thd.FSMportLayout = NULL; // ensure irregular airport support disabled
+ _thd.FSMportMask = NULL;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
--- a/src/rail_gui.cpp Mon Aug 13 21:11:21 2007 +0000
+++ b/src/rail_gui.cpp Tue Aug 14 15:34:53 2007 +0000
@@ -724,6 +724,7 @@
if (WP(w,def_d).close) return;
_thd.FSMportLayout = NULL; // ensure irregular airport support disabled
+ _thd.FSMportMask = NULL;
if (_railstation.dragdrop) {
SetTileSelectSize(1, 1);
--- a/src/road_gui.cpp Mon Aug 13 21:11:21 2007 +0000
+++ b/src/road_gui.cpp Tue Aug 14 15:34:53 2007 +0000
@@ -559,6 +559,7 @@
DrawWindowWidgets(w);
_thd.FSMportLayout = NULL; // ensure irregular airport support disabled
+ _thd.FSMportMask = NULL;
if (_station_show_coverage) {
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : 4;
--- a/src/table/sprites.h Mon Aug 13 21:11:21 2007 +0000
+++ b/src/table/sprites.h Tue Aug 14 15:34:53 2007 +0000
@@ -130,7 +130,8 @@
SPR_IMG_ARROW_SE_WHITE = SPR_AIRPORTX_BASE + 20,
SPR_IMG_ARROW_SW_WHITE = SPR_AIRPORTX_BASE + 21,
SPR_IMG_ARROW_NW_WHITE = SPR_AIRPORTX_BASE + 22,
- SPR_ROADSTOP_BASE = SPR_AIRPORTX_BASE + 23, // The sprites used for drive-through road stops
+ PALETTE_SEL_TILE_GREEN = SPR_AIRPORTX_BASE + 23, // used to recolour the airport placement highlight to green for land/blue for water
+ SPR_ROADSTOP_BASE = SPR_AIRPORTX_BASE + 24, // The sprites used for drive-through road stops
SPR_BUS_STOP_DT_Y_W = SPR_ROADSTOP_BASE,
SPR_BUS_STOP_DT_Y_E = SPR_ROADSTOP_BASE + 1,
SPR_BUS_STOP_DT_X_W = SPR_ROADSTOP_BASE + 2,
--- a/src/viewport.cpp Mon Aug 13 21:11:21 2007 +0000
+++ b/src/viewport.cpp Tue Aug 14 15:34:53 2007 +0000
@@ -692,14 +692,25 @@
if (_thd.drawstyle & HT_RECT) {
if (_thd.FSMportLayout != NULL) {
byte *b = *_thd.FSMportLayout;
+ byte *m;
+ if (_thd.FSMportMask != NULL) m = *_thd.FSMportMask;
b++; b++;
- for (uint i = 0; i < ((ti->y - _thd.pos.y) / TILE_SIZE * _thd.size.x / TILE_SIZE); i++)
+ if (_thd.FSMportMask != NULL) { m++; m++; } //skip orientation and minipic bytes
+ for (uint i = 0; i < ((ti->y - _thd.pos.y) / TILE_SIZE * _thd.size.x / TILE_SIZE); i++) {
b++;
- for (uint j = 0; j < ((ti->x - _thd.pos.x) / TILE_SIZE ); j++)
+ if (_thd.FSMportMask != NULL) m++;
+ }
+ for (uint j = 0; j < ((ti->x - _thd.pos.x) / TILE_SIZE ); j++) {
b++;
+ if (_thd.FSMportMask != NULL) m++;
+ }
if (*b != 255) {
image = SPR_SELECT_TILE + _tileh_to_sprite[ti->tileh];
- DrawSelectionSprite(image, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE, ti);
+ if (_thd.FSMportMask != NULL) {
+ DrawSelectionSprite(image, *m & 0x80 ? PALETTE_SEL_TILE_BLUE : PALETTE_SEL_TILE_GREEN, ti);
+ } else {
+ DrawSelectionSprite(image, PAL_NONE, ti);
+ }
}
}
if (_thd.FSMportLayout == NULL) {
--- a/src/viewport.h Mon Aug 13 21:11:21 2007 +0000
+++ b/src/viewport.h Tue Aug 14 15:34:53 2007 +0000
@@ -134,6 +134,7 @@
byte next_drawstyle; // queued, but not yet drawn style
FSMportsLayout *FSMportLayout; ///< used to identify the airport construction data to allow for holes in airport designs
+ FSMportsLayout *FSMportMask; ///< used to identify the airport construction mask for blue/green water/land colouring of highlight
byte place_mode;
bool make_square_red;