annotate src/waypoint_gui.cpp @ 11084:e07c7d3925c8 draft

(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
author rubidium <rubidium@openttd.org>
date Mon, 09 Feb 2009 02:33:10 +0000 (2009-02-09)
parents f68131a5cf7e
children bdc647e0c208
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
1 /* $Id$ */
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
2
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
3 /** @file waypoint_gui.cpp Handling of waypoints gui. */
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
4
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
6 #include "window_gui.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
7 #include "gui.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
8 #include "textbuf_gui.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
9 #include "vehicle_gui.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
10 #include "viewport_func.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
11 #include "strings_func.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
12 #include "gfx_func.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
13 #include "command_func.h"
11058
f68131a5cf7e (svn r15398) -Fix (r14135): _current_company shouldn't be used in GUI code (Swallow)
smatz <smatz@openttd.org>
parents: 10960
diff changeset
14 #include "company_func.h"
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
15 #include "functions.h"
10120
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
16 #include "window_func.h"
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
17
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
18 #include "table/strings.h"
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
19
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
20 struct WaypointWindow : Window {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
21 private:
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
22 Waypoint *wp;
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
23
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
24 enum WaypointViewWidget {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
25 WAYPVW_CLOSEBOX = 0,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
26 WAYPVW_CAPTION,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
27 WAYPVW_STICKY,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
28 WAYPVW_VIEWPORTPANEL,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
29 WAYPVW_SPACER,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
30 WAYPVW_CENTERVIEW,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
31 WAYPVW_RENAME,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
32 WAYPVW_SHOW_TRAINS,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
33 };
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
34
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
35 public:
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
36 WaypointWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
37 {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
38 this->wp = GetWaypoint(this->window_number);
11084
e07c7d3925c8 (svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents: 11058
diff changeset
39 this->owner = this->wp->owner;
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
40
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
41 this->flags4 |= WF_DISABLE_VP_SCROLL;
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
42 InitializeWindowViewport(this, 3, 17, 254, 86, this->wp->xy, ZOOM_LVL_MIN);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
43
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
44 this->FindWindowPlacementAndResize(desc);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
45 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
46
10120
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
47 ~WaypointWindow()
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
48 {
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
49 DeleteWindowById(WC_TRAINS_LIST, (this->window_number << 16) | (VEH_TRAIN << 11) | VLW_WAYPOINT_LIST | this->wp->owner);
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
50 }
e429d7f88beb (svn r14304) -Fix (r14104): waypoint train list wasn't closed with the waypoint window (crashes since r14296)
smatz <smatz@openttd.org>
parents: 9986
diff changeset
51
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
52 virtual void OnPaint()
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
53 {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
54 /* You can only change your own waypoints */
11058
f68131a5cf7e (svn r15398) -Fix (r14135): _current_company shouldn't be used in GUI code (Swallow)
smatz <smatz@openttd.org>
parents: 10960
diff changeset
55 this->SetWidgetDisabledState(WAYPVW_RENAME, this->wp->owner != _local_company);
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
56 SetDParam(0, this->wp->index);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
57 this->DrawWidgets();
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
58
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
59 this->DrawViewport();
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
60 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
61
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
62 virtual void OnClick(Point pt, int widget)
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
63 {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
64 switch (widget) {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
65 case WAYPVW_CENTERVIEW: /* scroll to location */
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
66 if (_ctrl_pressed) {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
67 ShowExtraViewPortWindow(this->wp->xy);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
68 } else {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
69 ScrollMainWindowToTile(this->wp->xy);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
70 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
71 break;
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
72
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
73 case WAYPVW_RENAME: /* rename */
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
74 SetDParam(0, this->wp->index);
10148
81642658c8be (svn r14334) -Feature: ability to reset name to default/automatic value (for vehicles, engines, towns, groups, stations, waypoints, managers and companies)
smatz <smatz@openttd.org>
parents: 10145
diff changeset
75 ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_WAYPOINT_NAME_BYTES, MAX_LENGTH_WAYPOINT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT);
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
76 break;
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
77
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
78 case WAYPVW_SHOW_TRAINS: /* show list of trains having this waypoint in their orders*/
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
79 ShowVehicleListWindow(this->wp);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
80 break;
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
81 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
82 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
83
9986
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
84 virtual void OnInvalidateData(int data)
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
85 {
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
86 int x = TileX(this->wp->xy) * TILE_SIZE;
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
87 int y = TileY(this->wp->xy) * TILE_SIZE;
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
88 ScrollWindowTo(x,y, this);
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
89 }
c218d2656349 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint.
frosch <frosch@openttd.org>
parents: 9978
diff changeset
90
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
91 virtual void OnQueryTextFinished(char *str)
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
92 {
10148
81642658c8be (svn r14334) -Feature: ability to reset name to default/automatic value (for vehicles, engines, towns, groups, stations, waypoints, managers and companies)
smatz <smatz@openttd.org>
parents: 10145
diff changeset
93 if (str == NULL) return;
81642658c8be (svn r14334) -Feature: ability to reset name to default/automatic value (for vehicles, engines, towns, groups, stations, waypoints, managers and companies)
smatz <smatz@openttd.org>
parents: 10145
diff changeset
94
10499
45ca88a8de7d (svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents: 10148
diff changeset
95 DoCommandP(0, this->window_number, 0, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME), NULL, str);
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
96 }
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
97
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
98 };
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
99
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
100 static const Widget _waypoint_view_widgets[] = {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
101 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // WAYPVW_CLOSEBOX
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
102 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 247, 0, 13, STR_WAYPOINT_VIEWPORT, STR_018C_WINDOW_TITLE_DRAG_THIS}, // WAYPVW_CAPTION
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
103 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, // WAYPVW_STICKY
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
104 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 259, 14, 105, 0x0, STR_NULL}, // WAYPVW_VIEWPORTPANEL
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
105 { WWT_INSET, RESIZE_NONE, COLOUR_GREY, 2, 257, 16, 103, 0x0, STR_NULL}, // WAYPVW_SPACER
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
106 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 121, 106, 117, STR_00E4_LOCATION, STR_3053_CENTER_MAIN_VIEW_ON_STATION}, // WAYPVW_CENTERVIEW
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
107 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 122, 244, 106, 117, STR_0130_RENAME, STR_CHANGE_WAYPOINT_NAME}, // WAYPVW_RENAME
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
108 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 245, 259, 106, 117, STR_TRAIN, STR_SCHEDULED_TRAINS_TIP }, // WAYPVW_SHOW_TRAINS
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
109 { WIDGETS_END},
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
110 };
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
111
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
112 static const WindowDesc _waypoint_view_desc = {
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
113 WDP_AUTO, WDP_AUTO, 260, 118, 260, 118,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
114 WC_WAYPOINT_VIEW, WC_NONE,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
115 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
116 _waypoint_view_widgets,
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
117 };
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
118
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
119 void ShowWaypointWindow(const Waypoint *wp)
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
120 {
9970
043f2b16901d (svn r14127) -Feature(ette): Give the the player's colour to the waypoint window been shown
belugas <belugas@openttd.org>
parents: 9953
diff changeset
121 if (!wp->IsValid()) return; // little safety
9953
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
122 AllocateWindowDescFront<WaypointWindow>(&_waypoint_view_desc, wp->index);
9f5e3b4f4caf (svn r14108) -Fix(r14104): Give a more consistent naming of the new gui file
belugas <belugas@openttd.org>
parents:
diff changeset
123 }