mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r6779) -Fix r6631: waypoint selector now correctly shows the current selected waypoint type (thx Maedhros)
This commit is contained in:
parent
678b44d976
commit
5a1ee9e02b
12
rail_gui.c
12
rail_gui.c
|
@ -1027,15 +1027,17 @@ static void ShowBuildTrainDepotPicker(void)
|
||||||
static void BuildWaypointWndProc(Window *w, WindowEvent *e)
|
static void BuildWaypointWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_CREATE: LowerWindowWidget(w, _cur_waypoint_type - w->hscroll.pos); break;
|
|
||||||
|
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
|
for (i = 0; i < w->hscroll.cap; i++) {
|
||||||
|
SetWindowWidgetLoweredState(w, i + 3, (w->hscroll.pos + i) == _cur_waypoint_type);
|
||||||
|
}
|
||||||
|
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < w->hscroll.cap; i++) {
|
||||||
if (w->hscroll.pos + i < _waypoint_count) {
|
if (w->hscroll.pos + i < w->hscroll.count) {
|
||||||
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, w->hscroll.pos + i);
|
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, w->hscroll.pos + i);
|
||||||
|
|
||||||
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype);
|
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype);
|
||||||
|
@ -1060,9 +1062,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
|
||||||
HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) &&
|
HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) &&
|
||||||
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return;
|
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return;
|
||||||
|
|
||||||
RaiseWindowWidget(w, _cur_waypoint_type - w->hscroll.pos);
|
|
||||||
_cur_waypoint_type = type;
|
_cur_waypoint_type = type;
|
||||||
LowerWindowWidget(w, _cur_waypoint_type - w->hscroll.pos);
|
|
||||||
SndPlayFx(SND_15_BEEP);
|
SndPlayFx(SND_15_BEEP);
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue