mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22390) [1.1] -Backport from trunk:
- Fix: When drawing the town authority window, check whether the availability of the actions changed, and force a complete redraw in that case (r22307) - Fix: The 'freeform edges' setting could be enabled when there were buoys on the northern border [FS#4580] (r22297) - Fix: Reset Window::scrolling_scrollbar when raising scrollbar buttons [FS#4571] (r22294) - Fix: [NewGRF] the c and p parts of station vars 40, 41 and 49 were incorrect for large stations (r22286)
This commit is contained in:
parent
ad37641fee
commit
41fe2dea36
|
@ -110,24 +110,21 @@ uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, i
|
|||
Swap(x, y);
|
||||
}
|
||||
|
||||
/* Limit our sizes to 4 bits */
|
||||
platforms = min(15, platforms);
|
||||
length = min(15, length);
|
||||
x = min(15, x);
|
||||
y = min(15, y);
|
||||
if (centred) {
|
||||
x -= platforms / 2;
|
||||
y -= length / 2;
|
||||
x = Clamp(x, -8, 7);
|
||||
y = Clamp(x, -8, 7);
|
||||
SB(retval, 0, 4, y & 0xF);
|
||||
SB(retval, 4, 4, x & 0xF);
|
||||
} else {
|
||||
SB(retval, 0, 4, y);
|
||||
SB(retval, 4, 4, length - y - 1);
|
||||
SB(retval, 8, 4, x);
|
||||
SB(retval, 12, 4, platforms - x - 1);
|
||||
SB(retval, 0, 4, min(15, y));
|
||||
SB(retval, 4, 4, min(15, length - y - 1));
|
||||
SB(retval, 8, 4, min(15, x));
|
||||
SB(retval, 12, 4, min(15, platforms - x - 1));
|
||||
}
|
||||
SB(retval, 16, 4, length);
|
||||
SB(retval, 20, 4, platforms);
|
||||
SB(retval, 16, 4, min(15, length));
|
||||
SB(retval, 20, 4, min(15, platforms));
|
||||
SB(retval, 24, 4, tile);
|
||||
|
||||
return retval;
|
||||
|
|
|
@ -1071,13 +1071,15 @@ static bool CheckFreeformEdges(int32 p1)
|
|||
if (p1 != 0) {
|
||||
Ship *s;
|
||||
FOR_ALL_SHIPS(s) {
|
||||
/* Check if there is a ship on the northern border. */
|
||||
if (TileX(s->tile) == 0 || TileY(s->tile) == 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Station *st;
|
||||
FOR_ALL_STATIONS(st) {
|
||||
BaseStation *st;
|
||||
FOR_ALL_BASE_STATIONS(st) {
|
||||
/* Check if there is a buoy on the northern border. */
|
||||
if (TileX(st->xy) == 0 || TileY(st->xy) == 0) {
|
||||
ShowErrorMessage(STR_CONFIG_SETTING_EDGES_NOT_EMPTY, INVALID_STRING_ID, WL_ERROR);
|
||||
return false;
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
Town *town; ///< Town being displayed.
|
||||
int sel_index; ///< Currently selected town action, \c 0 to \c TACT_COUNT-1, \c -1 means no action selected.
|
||||
Scrollbar *vscroll;
|
||||
uint displayed_actions_on_previous_painting; ///< Actions that were available on the previous call to OnPaint()
|
||||
|
||||
/**
|
||||
* Get the position of the Nth set bit.
|
||||
|
@ -96,7 +97,7 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
TownAuthorityWindow(const WindowDesc *desc, WindowNumber window_number) : Window(), sel_index(-1)
|
||||
TownAuthorityWindow(const WindowDesc *desc, WindowNumber window_number) : Window(), sel_index(-1), displayed_actions_on_previous_painting(0)
|
||||
{
|
||||
this->town = Town::Get(window_number);
|
||||
this->InitNested(desc, window_number);
|
||||
|
@ -108,6 +109,8 @@ public:
|
|||
{
|
||||
int numact;
|
||||
uint buttons = GetMaskOfTownActions(&numact, _local_company, this->town);
|
||||
if (buttons != displayed_actions_on_previous_painting) this->SetDirty();
|
||||
displayed_actions_on_previous_painting = buttons;
|
||||
|
||||
this->vscroll->SetCount(numact + 1);
|
||||
|
||||
|
|
|
@ -1392,6 +1392,7 @@ static void DecreaseWindowCounters()
|
|||
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
|
||||
if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
|
||||
sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
|
||||
w->scrolling_scrollbar = -1;
|
||||
sb->SetDirty(w);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue