mirror of https://github.com/OpenTTD/OpenTTD
(svn r16765) -Codechange: give ViewportSign's width_1 and width_2 more self explaining names
parent
8275a98e1f
commit
3fb1506d6d
|
@ -791,17 +791,17 @@ public:
|
||||||
this->RemapX(TileX(t->xy)),
|
this->RemapX(TileX(t->xy)),
|
||||||
this->RemapY(TileY(t->xy)),
|
this->RemapY(TileY(t->xy)),
|
||||||
0);
|
0);
|
||||||
x = pt.x - this->subscroll + 3 - (t->sign.width_2 >> 1);
|
x = pt.x - this->subscroll + 3 - (t->sign.width_small >> 1);
|
||||||
y = pt.y;
|
y = pt.y;
|
||||||
|
|
||||||
/* Check if the town sign is within bounds */
|
/* Check if the town sign is within bounds */
|
||||||
if (x + t->sign.width_2 > dpi->left &&
|
if (x + t->sign.width_small > dpi->left &&
|
||||||
x < dpi->left + dpi->width &&
|
x < dpi->left + dpi->width &&
|
||||||
y + 6 > dpi->top &&
|
y + 6 > dpi->top &&
|
||||||
y < dpi->top + dpi->height) {
|
y < dpi->top + dpi->height) {
|
||||||
/* And draw it. */
|
/* And draw it. */
|
||||||
SetDParam(0, t->index);
|
SetDParam(0, t->index);
|
||||||
DrawString(x, x + t->sign.width_2, y, STR_SMALLMAP_TOWN);
|
DrawString(x, x + t->sign.width_small, y, STR_SMALLMAP_TOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ void Station::AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
|
||||||
|
|
||||||
void Station::MarkDirty() const
|
void Station::MarkDirty() const
|
||||||
{
|
{
|
||||||
if (this->sign.width_1 != 0) {
|
if (this->sign.width_normal != 0) {
|
||||||
InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_CAPTION);
|
InvalidateWindowWidget(WC_STATION_VIEW, index, SVW_CAPTION);
|
||||||
this->sign.MarkDirty();
|
this->sign.MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1438,7 +1438,6 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||||
if (Company::IsValidID(_current_company)) {
|
if (Company::IsValidID(_current_company)) {
|
||||||
SetBit(st->town->have_ratings, _current_company);
|
SetBit(st->town->have_ratings, _current_company);
|
||||||
}
|
}
|
||||||
st->sign.width_1 = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1795,7 +1794,6 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
if (Company::IsValidID(_current_company)) {
|
if (Company::IsValidID(_current_company)) {
|
||||||
SetBit(st->town->have_ratings, _current_company);
|
SetBit(st->town->have_ratings, _current_company);
|
||||||
}
|
}
|
||||||
st->sign.width_1 = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1931,7 +1929,6 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
if (Company::IsValidID(_current_company)) {
|
if (Company::IsValidID(_current_company)) {
|
||||||
SetBit(st->town->have_ratings, _current_company);
|
SetBit(st->town->have_ratings, _current_company);
|
||||||
}
|
}
|
||||||
st->sign.width_1 = 0;
|
|
||||||
st->dock_tile = tile;
|
st->dock_tile = tile;
|
||||||
st->facilities |= FACIL_DOCK;
|
st->facilities |= FACIL_DOCK;
|
||||||
/* Buoys are marked in the Station struct by this flag. Yes, it is this
|
/* Buoys are marked in the Station struct by this flag. Yes, it is this
|
||||||
|
@ -2947,7 +2944,6 @@ void BuildOilRig(TileIndex tile)
|
||||||
|
|
||||||
Station *st = new Station(tile);
|
Station *st = new Station(tile);
|
||||||
st->town = ClosestTownFromTile(tile, UINT_MAX);
|
st->town = ClosestTownFromTile(tile, UINT_MAX);
|
||||||
st->sign.width_1 = 0;
|
|
||||||
|
|
||||||
st->string_id = GenerateStationName(st, tile, STATIONNAMING_OILRIG);
|
st->string_id = GenerateStationName(st, tile, STATIONNAMING_OILRIG);
|
||||||
|
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > t->sign.top &&
|
if (bottom > t->sign.top &&
|
||||||
top < t->sign.top + 12 &&
|
top < t->sign.top + 12 &&
|
||||||
right > t->sign.left &&
|
right > t->sign.left &&
|
||||||
left < t->sign.left + t->sign.width_1) {
|
left < t->sign.left + t->sign.width_normal) {
|
||||||
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
|
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
|
||||||
_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
|
_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
|
||||||
t->index, t->population);
|
t->index, t->population);
|
||||||
|
@ -1059,7 +1059,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > t->sign.top &&
|
if (bottom > t->sign.top &&
|
||||||
top < t->sign.top + 24 &&
|
top < t->sign.top + 24 &&
|
||||||
right > t->sign.left &&
|
right > t->sign.left &&
|
||||||
left < t->sign.left + t->sign.width_1 * 2) {
|
left < t->sign.left + t->sign.width_normal * 2) {
|
||||||
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
|
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
|
||||||
_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
|
_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
|
||||||
t->index, t->population);
|
t->index, t->population);
|
||||||
|
@ -1076,7 +1076,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > t->sign.top &&
|
if (bottom > t->sign.top &&
|
||||||
top < t->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
top < t->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
||||||
right > t->sign.left &&
|
right > t->sign.left &&
|
||||||
left < t->sign.left + ScaleByZoom(t->sign.width_2, dpi->zoom)) {
|
left < t->sign.left + ScaleByZoom(t->sign.width_small, dpi->zoom)) {
|
||||||
AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_TOWN_LABEL_TINY_BLACK, t->index, 0);
|
AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_TOWN_LABEL_TINY_BLACK, t->index, 0);
|
||||||
AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_TOWN_LABEL_TINY_WHITE, t->index, 0);
|
AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_TOWN_LABEL_TINY_WHITE, t->index, 0);
|
||||||
}
|
}
|
||||||
|
@ -1113,8 +1113,8 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > st->sign.top &&
|
if (bottom > st->sign.top &&
|
||||||
top < st->sign.top + 12 &&
|
top < st->sign.top + 12 &&
|
||||||
right > st->sign.left &&
|
right > st->sign.left &&
|
||||||
left < st->sign.left + st->sign.width_1) {
|
left < st->sign.left + st->sign.width_normal) {
|
||||||
AddStation(st, STR_STATION_SIGN, st->sign.width_1);
|
AddStation(st, STR_STATION_SIGN, st->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1126,8 +1126,8 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > st->sign.top &&
|
if (bottom > st->sign.top &&
|
||||||
top < st->sign.top + 24 &&
|
top < st->sign.top + 24 &&
|
||||||
right > st->sign.left &&
|
right > st->sign.left &&
|
||||||
left < st->sign.left + st->sign.width_1 * 2) {
|
left < st->sign.left + st->sign.width_normal * 2) {
|
||||||
AddStation(st, STR_STATION_SIGN, st->sign.width_1);
|
AddStation(st, STR_STATION_SIGN, st->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1141,8 +1141,8 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
|
||||||
if (bottom > st->sign.top &&
|
if (bottom > st->sign.top &&
|
||||||
top < st->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
top < st->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
||||||
right > st->sign.left &&
|
right > st->sign.left &&
|
||||||
left < st->sign.left + ScaleByZoom(st->sign.width_2, dpi->zoom)) {
|
left < st->sign.left + ScaleByZoom(st->sign.width_small, dpi->zoom)) {
|
||||||
AddStation(st, STR_STATION_SIGN_TINY, st->sign.width_2 | 0x8000);
|
AddStation(st, STR_STATION_SIGN_TINY, st->sign.width_small | 0x8000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1177,8 +1177,8 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
|
||||||
if (bottom > si->sign.top &&
|
if (bottom > si->sign.top &&
|
||||||
top < si->sign.top + 12 &&
|
top < si->sign.top + 12 &&
|
||||||
right > si->sign.left &&
|
right > si->sign.left &&
|
||||||
left < si->sign.left + si->sign.width_1) {
|
left < si->sign.left + si->sign.width_normal) {
|
||||||
AddSign(si, STR_SIGN_WHITE, si->sign.width_1);
|
AddSign(si, STR_SIGN_WHITE, si->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1190,8 +1190,8 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
|
||||||
if (bottom > si->sign.top &&
|
if (bottom > si->sign.top &&
|
||||||
top < si->sign.top + 24 &&
|
top < si->sign.top + 24 &&
|
||||||
right > si->sign.left &&
|
right > si->sign.left &&
|
||||||
left < si->sign.left + si->sign.width_1 * 2) {
|
left < si->sign.left + si->sign.width_normal * 2) {
|
||||||
AddSign(si, STR_SIGN_WHITE, si->sign.width_1);
|
AddSign(si, STR_SIGN_WHITE, si->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1205,8 +1205,8 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
|
||||||
if (bottom > si->sign.top &&
|
if (bottom > si->sign.top &&
|
||||||
top < si->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
top < si->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
||||||
right > si->sign.left &&
|
right > si->sign.left &&
|
||||||
left < si->sign.left + ScaleByZoom(si->sign.width_2, dpi->zoom)) {
|
left < si->sign.left + ScaleByZoom(si->sign.width_small, dpi->zoom)) {
|
||||||
AddSign(si, IsTransparencySet(TO_SIGNS) ? STR_SIGN_SMALL_WHITE : STR_SIGN_SMALL_BLACK, si->sign.width_2 | 0x8000);
|
AddSign(si, IsTransparencySet(TO_SIGNS) ? STR_SIGN_SMALL_WHITE : STR_SIGN_SMALL_BLACK, si->sign.width_small | 0x8000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1241,8 +1241,8 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
|
||||||
if (bottom > wp->sign.top &&
|
if (bottom > wp->sign.top &&
|
||||||
top < wp->sign.top + 12 &&
|
top < wp->sign.top + 12 &&
|
||||||
right > wp->sign.left &&
|
right > wp->sign.left &&
|
||||||
left < wp->sign.left + wp->sign.width_1) {
|
left < wp->sign.left + wp->sign.width_normal) {
|
||||||
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1);
|
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1254,8 +1254,8 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
|
||||||
if (bottom > wp->sign.top &&
|
if (bottom > wp->sign.top &&
|
||||||
top < wp->sign.top + 24 &&
|
top < wp->sign.top + 24 &&
|
||||||
right > wp->sign.left &&
|
right > wp->sign.left &&
|
||||||
left < wp->sign.left + wp->sign.width_1 * 2) {
|
left < wp->sign.left + wp->sign.width_normal * 2) {
|
||||||
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1);
|
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1269,8 +1269,8 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
|
||||||
if (bottom > wp->sign.top &&
|
if (bottom > wp->sign.top &&
|
||||||
top < wp->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
top < wp->sign.top + ScaleByZoom(12, dpi->zoom) &&
|
||||||
right > wp->sign.left &&
|
right > wp->sign.left &&
|
||||||
left < wp->sign.left + ScaleByZoom(wp->sign.width_2, dpi->zoom)) {
|
left < wp->sign.left + ScaleByZoom(wp->sign.width_small, dpi->zoom)) {
|
||||||
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT_TINY, wp->sign.width_2 | 0x8000);
|
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT_TINY, wp->sign.width_small | 0x8000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1292,12 +1292,12 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str)
|
||||||
char buffer[DRAW_STRING_BUFFER];
|
char buffer[DRAW_STRING_BUFFER];
|
||||||
|
|
||||||
GetString(buffer, str, lastof(buffer));
|
GetString(buffer, str, lastof(buffer));
|
||||||
this->width_1 = GetStringBoundingBox(buffer).width + 3;
|
this->width_normal = GetStringBoundingBox(buffer).width + 3;
|
||||||
this->left = center - this->width_1 / 2;
|
this->left = center - this->width_normal / 2;
|
||||||
|
|
||||||
/* zoomed out version */
|
/* zoomed out version */
|
||||||
_cur_fontsize = FS_SMALL;
|
_cur_fontsize = FS_SMALL;
|
||||||
this->width_2 = GetStringBoundingBox(buffer).width + 3;
|
this->width_small = GetStringBoundingBox(buffer).width + 3;
|
||||||
_cur_fontsize = FS_NORMAL;
|
_cur_fontsize = FS_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1314,7 +1314,7 @@ void ViewportSign::MarkDirty() const
|
||||||
MarkAllViewportsDirty(
|
MarkAllViewportsDirty(
|
||||||
this->left - 6,
|
this->left - 6,
|
||||||
this->top - 3,
|
this->top - 3,
|
||||||
this->left + ScaleByZoom(this->width_1 + 12, ZOOM_LVL_MAX),
|
this->left + ScaleByZoom(this->width_normal + 12, ZOOM_LVL_MAX),
|
||||||
this->top + ScaleByZoom(12, ZOOM_LVL_MAX));
|
this->top + ScaleByZoom(12, ZOOM_LVL_MAX));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1845,7 +1845,7 @@ static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
|
||||||
if (y >= t->sign.top &&
|
if (y >= t->sign.top &&
|
||||||
y < t->sign.top + 12 &&
|
y < t->sign.top + 12 &&
|
||||||
x >= t->sign.left &&
|
x >= t->sign.left &&
|
||||||
x < t->sign.left + t->sign.width_1) {
|
x < t->sign.left + t->sign.width_normal) {
|
||||||
ShowTownViewWindow(t->index);
|
ShowTownViewWindow(t->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1859,7 +1859,7 @@ static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
|
||||||
if (y >= t->sign.top &&
|
if (y >= t->sign.top &&
|
||||||
y < t->sign.top + 24 &&
|
y < t->sign.top + 24 &&
|
||||||
x >= t->sign.left &&
|
x >= t->sign.left &&
|
||||||
x < t->sign.left + t->sign.width_1 * 2) {
|
x < t->sign.left + t->sign.width_normal * 2) {
|
||||||
ShowTownViewWindow(t->index);
|
ShowTownViewWindow(t->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1875,7 +1875,7 @@ static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
|
||||||
if (y >= t->sign.top &&
|
if (y >= t->sign.top &&
|
||||||
y < t->sign.top + ScaleByZoom(12, vp->zoom) &&
|
y < t->sign.top + ScaleByZoom(12, vp->zoom) &&
|
||||||
x >= t->sign.left &&
|
x >= t->sign.left &&
|
||||||
x < t->sign.left + ScaleByZoom(t->sign.width_2, vp->zoom)) {
|
x < t->sign.left + ScaleByZoom(t->sign.width_small, vp->zoom)) {
|
||||||
ShowTownViewWindow(t->index);
|
ShowTownViewWindow(t->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1903,7 +1903,7 @@ static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
|
||||||
if (y >= st->sign.top &&
|
if (y >= st->sign.top &&
|
||||||
y < st->sign.top + 12 &&
|
y < st->sign.top + 12 &&
|
||||||
x >= st->sign.left &&
|
x >= st->sign.left &&
|
||||||
x < st->sign.left + st->sign.width_1) {
|
x < st->sign.left + st->sign.width_normal) {
|
||||||
ShowStationViewWindow(st->index);
|
ShowStationViewWindow(st->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1917,7 +1917,7 @@ static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
|
||||||
if (y >= st->sign.top &&
|
if (y >= st->sign.top &&
|
||||||
y < st->sign.top + 24 &&
|
y < st->sign.top + 24 &&
|
||||||
x >= st->sign.left &&
|
x >= st->sign.left &&
|
||||||
x < st->sign.left + st->sign.width_1 * 2) {
|
x < st->sign.left + st->sign.width_normal * 2) {
|
||||||
ShowStationViewWindow(st->index);
|
ShowStationViewWindow(st->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1933,7 +1933,7 @@ static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
|
||||||
if (y >= st->sign.top &&
|
if (y >= st->sign.top &&
|
||||||
y < st->sign.top + ScaleByZoom(12, vp->zoom) &&
|
y < st->sign.top + ScaleByZoom(12, vp->zoom) &&
|
||||||
x >= st->sign.left &&
|
x >= st->sign.left &&
|
||||||
x < st->sign.left + ScaleByZoom(st->sign.width_2, vp->zoom)) {
|
x < st->sign.left + ScaleByZoom(st->sign.width_small, vp->zoom)) {
|
||||||
ShowStationViewWindow(st->index);
|
ShowStationViewWindow(st->index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1962,7 +1962,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
|
||||||
if (y >= si->sign.top &&
|
if (y >= si->sign.top &&
|
||||||
y < si->sign.top + 12 &&
|
y < si->sign.top + 12 &&
|
||||||
x >= si->sign.left &&
|
x >= si->sign.left &&
|
||||||
x < si->sign.left + si->sign.width_1) {
|
x < si->sign.left + si->sign.width_normal) {
|
||||||
HandleClickOnSign(si);
|
HandleClickOnSign(si);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1976,7 +1976,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
|
||||||
if (y >= si->sign.top &&
|
if (y >= si->sign.top &&
|
||||||
y < si->sign.top + 24 &&
|
y < si->sign.top + 24 &&
|
||||||
x >= si->sign.left &&
|
x >= si->sign.left &&
|
||||||
x < si->sign.left + si->sign.width_1 * 2) {
|
x < si->sign.left + si->sign.width_normal * 2) {
|
||||||
HandleClickOnSign(si);
|
HandleClickOnSign(si);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1992,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
|
||||||
if (y >= si->sign.top &&
|
if (y >= si->sign.top &&
|
||||||
y < si->sign.top + ScaleByZoom(12, vp->zoom) &&
|
y < si->sign.top + ScaleByZoom(12, vp->zoom) &&
|
||||||
x >= si->sign.left &&
|
x >= si->sign.left &&
|
||||||
x < si->sign.left + ScaleByZoom(si->sign.width_2, vp->zoom)) {
|
x < si->sign.left + ScaleByZoom(si->sign.width_small, vp->zoom)) {
|
||||||
HandleClickOnSign(si);
|
HandleClickOnSign(si);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2020,7 +2020,7 @@ static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
|
||||||
if (y >= wp->sign.top &&
|
if (y >= wp->sign.top &&
|
||||||
y < wp->sign.top + 12 &&
|
y < wp->sign.top + 12 &&
|
||||||
x >= wp->sign.left &&
|
x >= wp->sign.left &&
|
||||||
x < wp->sign.left + wp->sign.width_1) {
|
x < wp->sign.left + wp->sign.width_normal) {
|
||||||
ShowWaypointWindow(wp);
|
ShowWaypointWindow(wp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2034,7 +2034,7 @@ static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
|
||||||
if (y >= wp->sign.top &&
|
if (y >= wp->sign.top &&
|
||||||
y < wp->sign.top + 24 &&
|
y < wp->sign.top + 24 &&
|
||||||
x >= wp->sign.left &&
|
x >= wp->sign.left &&
|
||||||
x < wp->sign.left + wp->sign.width_1 * 2) {
|
x < wp->sign.left + wp->sign.width_normal * 2) {
|
||||||
ShowWaypointWindow(wp);
|
ShowWaypointWindow(wp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2050,7 +2050,7 @@ static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
|
||||||
if (y >= wp->sign.top &&
|
if (y >= wp->sign.top &&
|
||||||
y < wp->sign.top + ScaleByZoom(12, vp->zoom) &&
|
y < wp->sign.top + ScaleByZoom(12, vp->zoom) &&
|
||||||
x >= wp->sign.left &&
|
x >= wp->sign.left &&
|
||||||
x < wp->sign.left + ScaleByZoom(wp->sign.width_2, vp->zoom)) {
|
x < wp->sign.left + ScaleByZoom(wp->sign.width_small, vp->zoom)) {
|
||||||
ShowWaypointWindow(wp);
|
ShowWaypointWindow(wp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@ struct ViewPort {
|
||||||
ZoomLevel zoom;
|
ZoomLevel zoom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Location information about a sign as seen on the viewport */
|
||||||
struct ViewportSign {
|
struct ViewportSign {
|
||||||
int32 left;
|
int32 left; ///< The left most position of the sign
|
||||||
int32 top;
|
int32 top; ///< THe top of the sign
|
||||||
uint16 width_1, width_2;
|
uint16 width_normal; ///< The width when not zoomed out (normal font)
|
||||||
|
uint16 width_small; ///< The width when zoomed out (small font)
|
||||||
|
|
||||||
void UpdatePosition(int center, int top, StringID str);
|
void UpdatePosition(int center, int top, StringID str);
|
||||||
void MarkDirty() const;
|
void MarkDirty() const;
|
||||||
|
|
Loading…
Reference in New Issue