OpenTTD Source  1.11.0-beta2
object_gui.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "stdafx.h"
11 #include "command_func.h"
12 #include "newgrf.h"
13 #include "newgrf_object.h"
14 #include "newgrf_text.h"
15 #include "querystring_gui.h"
16 #include "sortlist_type.h"
17 #include "stringfilter_type.h"
18 #include "string_func.h"
19 #include "strings_func.h"
20 #include "viewport_func.h"
21 #include "tilehighlight_func.h"
22 #include "window_gui.h"
23 #include "window_func.h"
24 #include "zoom_func.h"
25 
26 #include "widgets/object_widget.h"
27 
28 #include "table/strings.h"
29 
30 #include "safeguards.h"
31 
34 static uint8 _selected_object_view;
35 
37 class BuildObjectWindow : public Window {
39 
40  static const uint EDITBOX_MAX_SIZE = 16;
41  static const int OBJECT_MARGIN = 4;
42 
46 
54 
57  {
58  uint pos = 0;
59  for (auto objclass : this->object_classes) {
60  if (objclass == _selected_object_class) break;
61  pos++;
62  }
63  this->vscroll->ScrollTowards(pos);
64  }
65 
71  {
72  if (_selected_object_index == -1) return false;
73 
74  if ((int)_selected_object_class->GetSpecCount() <= _selected_object_index) return false;
75 
76  return _selected_object_class->GetSpec(_selected_object_index)->IsAvailable();
77  }
78 
84  {
85  const NWidgetBase *matrix = this->GetWidget<NWidgetBase>(WID_BO_SELECT_MATRIX);
86  return 1 + (matrix->current_x - matrix->smallest_x) / matrix->resize_x;
87  }
88 
89 public:
91  {
92  this->CreateNestedTree();
93 
94  this->vscroll = this->GetScrollbar(WID_BO_SCROLLBAR);
95 
97 
98  this->object_classes.SetListing(this->last_sorting);
99  this->object_classes.SetFiltering(this->last_filtering);
100  this->object_classes.SetSortFuncs(this->sorter_funcs);
101  this->object_classes.SetFilterFuncs(this->filter_funcs);
102  this->object_classes.ForceRebuild();
103 
106 
107  this->FinishInitNested(number);
108 
109  NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
111 
113  this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
114 
116 
117  this->vscroll->SetCount((int)this->object_classes.size());
118 
120 
121  this->InvalidateData();
122  }
123 
125  static bool NameSorter(const ObjectClass * const &a, const ObjectClass * const &b)
126  {
127  char buffer_a[DRAW_STRING_BUFFER];
128  GetString(buffer_a, a->name, lastof(buffer_a));
129 
130  char buffer_b[DRAW_STRING_BUFFER];
131  GetString(buffer_b, b->name, lastof(buffer_b));
132 
133  return strnatcmp(buffer_a, buffer_b, true) < 0; // Sort by name (natural sorting).
134  }
135 
137  static bool CDECL TagNameFilter(const ObjectClass * const *oc, StringFilter &filter)
138  {
139  char buffer[DRAW_STRING_BUFFER];
140  GetString(buffer, (*oc)->name, lastof(buffer));
141 
142  filter.ResetState();
143  filter.AddLine(buffer);
144  return filter.GetState();
145  }
146 
149  {
150  if (!this->object_classes.NeedRebuild()) return;
151 
152  this->object_classes.clear();
153 
154  for (uint i = 0; i < ObjectClass::GetClassCount(); i++) {
156  if (objclass->GetUISpecCount() == 0) continue; // Is this needed here?
157  object_classes.push_back(objclass);
158  }
159 
160  this->object_classes.Filter(this->string_filter);
161  this->object_classes.shrink_to_fit();
162  this->object_classes.RebuildDone();
163  this->object_classes.Sort();
164 
165  this->vscroll->SetCount((uint)this->object_classes.size());
166  }
167 
173  {
174  assert(!this->object_classes.empty()); // object GUI should be disabled elsewise
175  if (_selected_object_class == nullptr) {
176  /* This happens during the first time the window is open during the game life cycle. */
177  this->SelectOtherClass(this->object_classes[0]);
178  } else {
179  /* Check if the previously selected object class is not available anymore as a
180  * result of starting a new game without the corresponding NewGRF. */
181  bool available = false;
182  for (uint i = 0; ObjectClass::GetClassCount(); ++i) {
184  if (objclass == _selected_object_class) {
185  available = true;
186  break;
187  }
188  }
189 
190  if (available) {
191  this->SelectOtherClass(_selected_object_class);
192  } else {
193  this->SelectOtherClass(this->object_classes[0]);
194  }
195  }
196 
197  if (this->CanRestoreSelectedObject()) {
199  } else {
200  this->SelectFirstAvailableObject(true);
201  }
202  assert(_selected_object_class->GetUISpecCount() > 0); // object GUI should be disabled elsewise
203  }
204 
205  void SetStringParameters(int widget) const override
206  {
207  switch (widget) {
208  case WID_BO_OBJECT_NAME: {
210  SetDParam(0, spec != nullptr ? spec->name : STR_EMPTY);
211  break;
212  }
213 
214  case WID_BO_OBJECT_SIZE: {
216  int size = spec == nullptr ? 0 : spec->size;
217  SetDParam(0, GB(size, HasBit(_selected_object_view, 0) ? 4 : 0, 4));
218  SetDParam(1, GB(size, HasBit(_selected_object_view, 0) ? 0 : 4, 4));
219  break;
220  }
221 
222  default: break;
223  }
224  }
225 
226  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
227  {
228  switch (widget) {
229  case WID_BO_CLASS_LIST: {
230  for (auto objclass : this->object_classes) {
231  if (objclass->GetUISpecCount() == 0) continue;
232  size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width);
233  }
234  size->width += padding.width;
235  this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
236  resize->height = this->line_height;
237  size->height = 5 * this->line_height;
238  break;
239  }
240 
241  case WID_BO_OBJECT_NAME:
242  case WID_BO_OBJECT_SIZE:
243  /* We do not want the window to resize when selecting objects; better clip texts */
244  size->width = 0;
245  break;
246 
247  case WID_BO_OBJECT_MATRIX: {
248  /* Get the right amount of buttons based on the current spec. */
250  if (spec != nullptr) {
251  if (spec->views >= 2) size->width += resize->width;
252  if (spec->views >= 4) size->height += resize->height;
253  }
254  resize->width = 0;
255  resize->height = 0;
256  break;
257  }
258 
259  case WID_BO_OBJECT_SPRITE: {
260  bool two_wide = false; // Whether there will be two widgets next to each other in the matrix or not.
261  int height[2] = {0, 0}; // The height for the different views; in this case views 1/2 and 4.
262 
263  /* Get the height and view information. */
264  for (int i = 0; i < NUM_OBJECTS; i++) {
265  const ObjectSpec *spec = ObjectSpec::Get(i);
266  if (!spec->IsEverAvailable()) continue;
267  two_wide |= spec->views >= 2;
268  height[spec->views / 4] = std::max<int>(ObjectSpec::Get(i)->height, height[spec->views / 4]);
269  }
270 
271  /* Determine the pixel heights. */
272  for (size_t i = 0; i < lengthof(height); i++) {
275  }
276 
277  /* Now determine the size of the minimum widgets. When there are two columns, then
278  * we want these columns to be slightly less wide. When there are two rows, then
279  * determine the size of the widgets based on the maximum size for a single row
280  * of widgets, or just the twice the widget height of the two row ones. */
281  size->height = std::max(height[0], height[1] * 2 + 2);
282  if (two_wide) {
283  size->width = (3 * ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN) * 2 + 2;
284  } else {
285  size->width = 4 * ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN;
286  }
287 
288  /* Get the right size for the single widget based on the current spec. */
290  if (spec != nullptr) {
291  if (spec->views >= 2) size->width = size->width / 2 - 1;
292  if (spec->views >= 4) size->height = size->height / 2 - 1;
293  }
294  break;
295  }
296 
297  case WID_BO_INFO:
298  size->height = this->info_height;
299  break;
300 
302  fill->height = 1;
303  resize->height = 1;
304  break;
305 
306  case WID_BO_SELECT_IMAGE:
307  size->width = ScaleGUITrad(64) + 2;
308  size->height = ScaleGUITrad(58) + 2;
309  break;
310 
311  default: break;
312  }
313  }
314 
315  void DrawWidget(const Rect &r, int widget) const override
316  {
317  switch (GB(widget, 0, 16)) {
318  case WID_BO_CLASS_LIST: {
319  int y = r.top;
320  uint pos = 0;
321  for (auto objclass : this->object_classes) {
322  if (objclass->GetUISpecCount() == 0) continue;
323  if (!this->vscroll->IsVisible(pos++)) continue;
324  DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, objclass->name,
325  (objclass == _selected_object_class) ? TC_WHITE : TC_BLACK);
326  y += this->line_height;
327  }
328  break;
329  }
330 
331  case WID_BO_OBJECT_SPRITE: {
332  if (_selected_object_index == -1) break;
333 
335  if (spec == nullptr) break;
336 
337  /* Height of the selection matrix.
338  * Depending on the number of views, the matrix has a 1x1, 1x2, 2x1 or 2x2 layout. To make the previews
339  * look nice in all layouts, we use the 4x4 layout (smallest previews) as starting point. For the bigger
340  * previews in the layouts with less views we add space homogeneously on all sides, so the 4x4 preview-rectangle
341  * is centered in the 2x1, 1x2 resp. 1x1 buttons. */
342  uint matrix_height = this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->current_y;
343 
344  DrawPixelInfo tmp_dpi;
345  /* Set up a clipping area for the preview. */
346  if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
347  DrawPixelInfo *old_dpi = _cur_dpi;
348  _cur_dpi = &tmp_dpi;
349  if (spec->grf_prop.grffile == nullptr) {
350  extern const DrawTileSprites _objects[];
351  const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
352  DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
353  } else {
354  DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, (r.bottom - r.top + matrix_height / 2) / 2 - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), spec, GB(widget, 16, 16));
355  }
356  _cur_dpi = old_dpi;
357  }
358  break;
359  }
360 
361  case WID_BO_SELECT_IMAGE: {
362  int obj_index = _selected_object_class->GetIndexFromUI(GB(widget, 16, 16));
363  if (obj_index < 0) break;
364  const ObjectSpec *spec = _selected_object_class->GetSpec(obj_index);
365  if (spec == nullptr) break;
366 
367  if (!spec->IsAvailable()) {
368  GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_BLACK, FILLRECT_CHECKER);
369  }
370  DrawPixelInfo tmp_dpi;
371  /* Set up a clipping area for the preview. */
372  if (FillDrawPixelInfo(&tmp_dpi, r.left + 1, r.top, (r.right - 1) - (r.left + 1) + 1, r.bottom - r.top + 1)) {
373  DrawPixelInfo *old_dpi = _cur_dpi;
374  _cur_dpi = &tmp_dpi;
375  if (spec->grf_prop.grffile == nullptr) {
376  extern const DrawTileSprites _objects[];
377  const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
378  DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE);
379  } else {
380  DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), spec,
381  std::min<int>(_selected_object_view, spec->views - 1));
382  }
383  _cur_dpi = old_dpi;
384  }
385  break;
386  }
387 
388  case WID_BO_INFO: {
390  if (spec == nullptr) break;
391 
392  /* Get the extra message for the GUI */
394  uint16 callback_res = GetObjectCallback(CBID_OBJECT_FUND_MORE_TEXT, 0, 0, spec, nullptr, INVALID_TILE, _selected_object_view);
395  if (callback_res != CALLBACK_FAILED && callback_res != 0x400) {
396  if (callback_res > 0x400) {
398  } else {
399  StringID message = GetGRFStringID(spec->grf_prop.grffile->grfid, 0xD000 + callback_res);
400  if (message != STR_NULL && message != STR_UNDEFINED) {
402  /* Use all the available space left from where we stand up to the
403  * end of the window. We ALSO enlarge the window if needed, so we
404  * can 'go' wild with the bottom of the window. */
405  int y = DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, message, TC_ORANGE) - r.top;
407  if (y > this->info_height) {
408  BuildObjectWindow *bow = const_cast<BuildObjectWindow *>(this);
409  bow->info_height = y + 2;
410  bow->ReInit();
411  }
412  }
413  }
414  }
415  }
416  }
417  }
418  }
419 
424  void SelectOtherClass(const ObjectClass *object_class)
425  {
426  _selected_object_class = object_class;
427  this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX)->SetCount(_selected_object_class->GetUISpecCount());
428  }
429 
434  void SelectOtherObject(int object_index)
435  {
436  _selected_object_index = object_index;
437  if (_selected_object_index != -1) {
439  _selected_object_view = std::min<int>(_selected_object_view, spec->views - 1);
440  this->ReInit();
441  } else {
443  }
444 
445  if (_selected_object_index != -1) {
446  SetObjectToPlaceWnd(SPR_CURSOR_TRANSMITTER, PAL_NONE, HT_RECT, this);
447  }
448 
449  this->UpdateButtons(_selected_object_class, _selected_object_index, _selected_object_view);
450  }
451 
452  void UpdateSelectSize()
453  {
454  if (_selected_object_index == -1) {
455  SetTileSelectSize(1, 1);
456  } else {
458  int w = GB(spec->size, HasBit(_selected_object_view, 0) ? 4 : 0, 4);
459  int h = GB(spec->size, HasBit(_selected_object_view, 0) ? 0 : 4, 4);
460  SetTileSelectSize(w, h);
461  }
462  }
463 
470  void UpdateButtons(const ObjectClass *object_class, int sel_index, uint sel_view)
471  {
472  int view_number, object_number;
473  if (sel_index == -1) {
474  view_number = -1; // If no object selected, also hide the selected view.
475  object_number = -1;
476  } else {
477  view_number = sel_view;
478  object_number = object_class->GetUIFromIndex(sel_index);
479  }
480 
481  this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetClicked(view_number);
482  this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX)->SetClicked(object_number);
483  this->UpdateSelectSize();
484  this->SetDirty();
485  }
486 
487  void OnInvalidateData(int data = 0, bool gui_scope = true) override
488  {
489  if (!gui_scope) return;
490 
492  }
493 
494  void OnResize() override
495  {
496  this->vscroll->SetCapacityFromWidget(this, WID_BO_CLASS_LIST);
497  }
498 
499  void OnClick(Point pt, int widget, int click_count) override
500  {
501  switch (GB(widget, 0, 16)) {
502  case WID_BO_CLASS_LIST: {
503  int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
504  if (num_clicked >= (int)this->object_classes.size()) break;
505 
506  this->SelectOtherClass(this->object_classes[num_clicked]);
507  this->SelectFirstAvailableObject(false);
508  break;
509  }
510 
511  case WID_BO_SELECT_IMAGE: {
512  int num_clicked = _selected_object_class->GetIndexFromUI(GB(widget, 16, 16));
513  if (num_clicked >= 0 && _selected_object_class->GetSpec(num_clicked)->IsAvailable()) this->SelectOtherObject(num_clicked);
514  break;
515  }
516 
518  if (_selected_object_index != -1) {
519  _selected_object_view = GB(widget, 16, 16);
520  this->SelectOtherObject(_selected_object_index); // Re-select the object for a different view.
521  }
522  break;
523  }
524  }
525 
526  void OnPlaceObject(Point pt, TileIndex tile) override
527  {
529  _selected_object_view, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform);
530  }
531 
532  void OnPlaceObjectAbort() override
533  {
534  this->UpdateButtons(_selected_object_class, -1, _selected_object_view);
535  }
536 
537  void OnEditboxChanged(int wid) override
538  {
539  string_filter.SetFilterTerm(this->filter_editbox.text.buf);
540  this->object_classes.SetFilterState(!string_filter.IsEmpty());
541  this->object_classes.ForceRebuild();
542  this->InvalidateData();
543  }
544 
550  void SelectFirstAvailableObject(bool change_class)
551  {
552  /* First try to select an object in the selected class. */
553  for (uint i = 0; i < _selected_object_class->GetSpecCount(); i++) {
554  const ObjectSpec *spec = _selected_object_class->GetSpec(i);
555  if (spec->IsAvailable()) {
556  this->SelectOtherObject(i);
557  return;
558  }
559  }
560  if (change_class) {
561  /* If that fails, select the first available object
562  * from a random class. */
563  for (auto objclass : this->object_classes) {
564  for (uint i = 0; i < objclass->GetSpecCount(); i++) {
565  const ObjectSpec *spec = objclass->GetSpec(i);
566  if (spec->IsAvailable()) {
567  this->SelectOtherClass(objclass);
568  this->SelectOtherObject(i);
569  return;
570  }
571  }
572  }
573  }
574  /* If all objects are unavailable, select nothing... */
576  /* ... but make sure that the class is not empty. */
577  for (auto objclass : this->object_classes) {
578  if (objclass->GetUISpecCount() > 0) {
579  this->SelectOtherClass(objclass);
580  break;
581  }
582  }
583  }
584  this->SelectOtherObject(-1);
585  }
586 };
587 
590 
592  &NameSorter,
593 };
594 
596  &TagNameFilter,
597 };
598 
599 static const NWidgetPart _nested_build_object_widgets[] = {
601  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
602  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_OBJECT_BUILD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
603  NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
604  EndContainer(),
605  NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
606  NWidget(NWID_HORIZONTAL), SetPadding(2, 0, 0, 0),
608  NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 2, 5),
609  NWidget(WWT_TEXT, COLOUR_DARK_GREEN), SetFill(0, 1), SetDataTip(STR_LIST_FILTER_TITLE, STR_NULL),
610  NWidget(WWT_EDITBOX, COLOUR_GREY, WID_BO_FILTER), SetFill(1, 0), SetResize(1, 0),
611  SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
612  EndContainer(),
613  NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 2, 5),
614  NWidget(WWT_MATRIX, COLOUR_GREY, WID_BO_CLASS_LIST), SetFill(1, 0), SetMatrixDataTip(1, 0, STR_OBJECT_BUILD_CLASS_TOOLTIP), SetScrollbar(WID_BO_SCROLLBAR),
616  EndContainer(),
617  NWidget(NWID_HORIZONTAL), SetPadding(0, 5, 0, 5),
618  NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, WID_BO_OBJECT_MATRIX), SetPIP(0, 2, 0),
619  NWidget(WWT_PANEL, COLOUR_GREY, WID_BO_OBJECT_SPRITE), SetDataTip(0x0, STR_OBJECT_BUILD_PREVIEW_TOOLTIP), EndContainer(),
620  EndContainer(),
621  EndContainer(),
622  NWidget(WWT_TEXT, COLOUR_DARK_GREEN, WID_BO_OBJECT_NAME), SetDataTip(STR_ORANGE_STRING, STR_NULL), SetPadding(2, 5, 2, 5),
623  NWidget(WWT_TEXT, COLOUR_DARK_GREEN, WID_BO_OBJECT_SIZE), SetDataTip(STR_OBJECT_BUILD_SIZE, STR_NULL), SetPadding(2, 5, 2, 5),
624  EndContainer(),
625  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetScrollbar(WID_BO_SELECT_SCROLL),
627  NWidget(NWID_MATRIX, COLOUR_DARK_GREEN, WID_BO_SELECT_MATRIX), SetFill(0, 1), SetPIP(0, 2, 0),
628  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BO_SELECT_IMAGE), SetMinimalSize(66, 60), SetDataTip(0x0, STR_OBJECT_BUILD_TOOLTIP),
630  EndContainer(),
631  EndContainer(),
632  NWidget(NWID_VSCROLLBAR, COLOUR_DARK_GREEN, WID_BO_SELECT_SCROLL),
633  EndContainer(),
634  EndContainer(),
635  EndContainer(),
637  NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BO_INFO), SetPadding(2, 5, 0, 5), SetFill(1, 0), SetResize(1, 0),
639  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(0, 1), EndContainer(),
640  NWidget(WWT_RESIZEBOX, COLOUR_DARK_GREEN),
641  EndContainer(),
642  EndContainer(),
643  EndContainer(),
644 };
645 
646 static WindowDesc _build_object_desc(
647  WDP_AUTO, "build_object", 0, 0,
650  _nested_build_object_widgets, lengthof(_nested_build_object_widgets)
651 );
652 
655 {
656  /* Don't show the place object button when there are no objects to place. */
657  if (ObjectClass::GetUIClassCount() > 0) {
658  AllocateWindowDescFront<BuildObjectWindow>(&_build_object_desc, 0);
659  }
660 }
661 
664 {
665  _selected_object_class = nullptr;
666 }
_selected_object_index
static int _selected_object_index
Index of the currently selected object if existing, else -1.
Definition: object_gui.cpp:33
WID_BO_FILTER
@ WID_BO_FILTER
The filter text box for the object list.
Definition: object_widget.h:15
SetTileSelectSize
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2470
BuildObjectWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: object_gui.cpp:487
CMD_MSG
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:372
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:78
BuildObjectWindow::CanRestoreSelectedObject
bool CanRestoreSelectedObject()
Tests whether the previously selected object can be selected.
Definition: object_gui.cpp:70
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:66
BuildObjectWindow::EnsureSelectedObjectClassIsVisible
void EnsureSelectedObjectClassIsVisible()
Scroll WID_BO_CLASS_LIST so that the selected object class is visible.
Definition: object_gui.cpp:56
WD_MATRIX_RIGHT
@ WD_MATRIX_RIGHT
Offset at right of a matrix cell.
Definition: window_gui.h:77
querystring_gui.h
BuildObjectWindow::last_filtering
static Filtering last_filtering
Default filtering of GUIObjectClassList.
Definition: object_gui.cpp:48
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1094
NewGRFClass::GetUISpecCount
uint GetUISpecCount() const
Get the number of potentially user-available specs within the class.
Definition: newgrf_class.h:46
GB
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
DrawOrigTileSeqInGUI
static void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
Draw TTD sprite sequence in GUI.
Definition: sprite.h:115
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
BuildObjectWindow::GetMatrixColumnCount
uint GetMatrixColumnCount()
Calculate the number of columns of the WID_BO_SELECT_MATRIX widget.
Definition: object_gui.cpp:83
command_func.h
ObjectSpec
Allow incrementing of ObjectClassID variables.
Definition: newgrf_object.h:58
ObjectSpec::grf_prop
GRFFilePropsBase< 2 > grf_prop
Properties related the the grf file.
Definition: newgrf_object.h:60
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1045
GUIList::Sort
bool Sort(Comp compare)
Sort the list.
Definition: sortlist_type.h:247
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:309
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:208
StringFilter::IsEmpty
bool IsEmpty() const
Check whether any filter words were entered.
Definition: stringfilter_type.h:59
Window::ReInit
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
Definition: window.cpp:995
BuildObjectWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: object_gui.cpp:499
StringFilter::SetFilterTerm
void SetFilterTerm(const char *str)
Set the term to filter on.
Definition: stringfilter.cpp:27
WD_MATRIX_TOP
@ WD_MATRIX_TOP
Offset at top of a matrix cell.
Definition: window_gui.h:78
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
Scrollbar::ScrollTowards
void ScrollTowards(int position)
Scroll towards the given position; if the item is visible nothing happens, otherwise it will be shown...
Definition: widget_type.h:730
NewGRFClass::GetSpecCount
uint GetSpecCount() const
Get the number of allocated specs within the class.
Definition: newgrf_class.h:44
NWidgetMatrix
Matrix container with implicitly equal sized (virtual) sub-widgets.
Definition: widget_type.h:492
GUIList< const ObjectClass *, StringFilter & >
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:63
Window::CreateNestedTree
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1832
BuildObjectWindow
The window used for building objects.
Definition: object_gui.cpp:37
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
ObjectSpec::IsAvailable
bool IsAvailable() const
Check whether the object is available at this time.
Definition: newgrf_object.cpp:78
object_widget.h
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition: widget_type.h:57
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:669
FILLRECT_CHECKER
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
Definition: gfx_type.h:288
DrawNewObjectTileInGUI
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view)
Draw representation of an object (tile) for GUI purposes.
Definition: newgrf_object.cpp:464
NUM_OBJECTS
static const ObjectType NUM_OBJECTS
Number of supported objects overall.
Definition: object_type.h:25
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:929
zoom_func.h
WID_BO_INFO
@ WID_BO_INFO
Other information about the object (from the NewGRF).
Definition: object_widget.h:22
StartTextRefStackUsage
void StartTextRefStackUsage(const GRFFile *grffile, byte numEntries, const uint32 *values)
Start using the TTDP compatible string code parsing.
Definition: newgrf_text.cpp:822
NWidgetMatrix::SetScrollbar
void SetScrollbar(Scrollbar *sb)
Assign a scrollbar to this matrix.
Definition: widget.cpp:1535
DrawString
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:640
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
StringFilter::AddLine
void AddLine(const char *str)
Pass another text line from the current item to the filter.
Definition: stringfilter.cpp:104
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:711
StopTextRefStackUsage
void StopTextRefStackUsage()
Stop using the TTDP compatible string code parsing.
Definition: newgrf_text.cpp:839
InitializeObjectGui
void InitializeObjectGui()
Reset all data of the object GUI.
Definition: object_gui.cpp:663
ObjectSpec::IsEverAvailable
bool IsEverAvailable() const
Check whether the object might be available at some point in this game with the current game mode.
Definition: newgrf_object.cpp:59
NWID_MATRIX
@ NWID_MATRIX
Matrix container.
Definition: widget_type.h:76
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:588
ObjectSpec::Get
static const ObjectSpec * Get(ObjectType index)
Get the specification associated with a specific ObjectType.
Definition: newgrf_object.cpp:39
ObjectSpec::size
uint8 size
The size of this objects; low nibble for X, high nibble for Y.
Definition: newgrf_object.h:65
ObjectSpec::callback_mask
uint16 callback_mask
Bitmask of requested/allowed callbacks.
Definition: newgrf_object.h:72
SetDParam
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:199
BuildObjectWindow::filter_funcs
static GUIObjectClassList::FilterFunction *const filter_funcs[]
Filter functions of the GUIObjectClassList.
Definition: object_gui.cpp:50
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:909
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1013
QueryString
Data stored about a string that can be modified in the GUI.
Definition: querystring_gui.h:20
WID_BO_SELECT_MATRIX
@ WID_BO_SELECT_MATRIX
Selection preview matrix of objects of a given class.
Definition: object_widget.h:24
BuildObjectWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition: object_gui.cpp:526
BuildObjectWindow::OnResize
void OnResize() override
Called after the window got resized.
Definition: object_gui.cpp:494
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:842
GUIList::SetFilterFuncs
void SetFilterFuncs(FilterFunction *const *n_funcs)
Hand the array of filter function pointers to the sort list.
Definition: sortlist_type.h:341
Textbuf::buf
char *const buf
buffer in which text is saved
Definition: textbuf_type.h:32
Window::querystrings
SmallMap< int, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
Definition: window_gui.h:328
BuildObjectWindow::SetStringParameters
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Definition: object_gui.cpp:205
DrawStringMultiLine
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition: gfx.cpp:763
BuildObjectWindow::SelectClassAndObject
void SelectClassAndObject()
Checks if the previously selected current object class and object can be shown as selected to the use...
Definition: object_gui.cpp:172
WindowDesc
High level window description.
Definition: window_gui.h:166
CBM_OBJ_FUND_MORE_TEXT
@ CBM_OBJ_FUND_MORE_TEXT
additional text in fund window
Definition: newgrf_callbacks.h:386
window_gui.h
WID_BO_SCROLLBAR
@ WID_BO_SCROLLBAR
The scrollbar associated with the list.
Definition: object_widget.h:17
BuildObjectWindow::NameSorter
static bool NameSorter(const ObjectClass *const &a, const ObjectClass *const &b)
Sort object classes by class name.
Definition: object_gui.cpp:125
_selected_object_view
static uint8 _selected_object_view
the view of the selected object
Definition: object_gui.cpp:34
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:154
Listing
Data structure describing how to show the list (what sort direction and criteria).
Definition: sortlist_type.h:30
GUIList::SetFilterState
void SetFilterState(bool state)
Enable or disable the filter.
Definition: sortlist_type.h:302
DRAW_STRING_BUFFER
static const int DRAW_STRING_BUFFER
Size of the buffer used for drawing strings.
Definition: gfx_func.h:85
BuildObjectWindow::UpdateButtons
void UpdateButtons(const ObjectClass *object_class, int sel_index, uint sel_view)
Update buttons to show the selection to the user.
Definition: object_gui.cpp:470
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:322
tilehighlight_func.h
DoCommandP
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Definition: command.cpp:541
WID_BO_SELECT_IMAGE
@ WID_BO_SELECT_IMAGE
Preview image in the WID_BO_SELECT_MATRIX.
Definition: object_widget.h:25
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition: widget_type.h:69
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:320
ObjectClassID
ObjectClassID
Class IDs for objects.
Definition: newgrf_object.h:46
GUIList< const ObjectClass *, StringFilter & >::SortFunction
bool SortFunction(const const ObjectClass * &, const const ObjectClass * &)
Signature of sort function.
Definition: sortlist_type.h:48
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:984
BuildObjectWindow::filter_editbox
QueryString filter_editbox
Filter editbox.
Definition: object_gui.cpp:53
GUIList::SetListing
void SetListing(Listing l)
Import sort conditions.
Definition: sortlist_type.h:130
NWidgetBase::smallest_x
uint smallest_x
Smallest horizontal size of the widget in a filled window.
Definition: widget_type.h:169
BuildObjectWindow::info_height
int info_height
The height of the info box.
Definition: object_gui.cpp:44
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:124
SetMatrixDataTip
static NWidgetPart SetMatrixDataTip(uint8 cols, uint8 rows, StringID tip)
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition: widget_type.h:1031
NewGRFClass
Struct containing information relating to NewGRF classes for stations and airports.
Definition: newgrf_class.h:19
Filtering
Data structure describing what to show in the list (filter criteria).
Definition: sortlist_type.h:35
safeguards.h
WID_BO_OBJECT_SPRITE
@ WID_BO_OBJECT_SPRITE
A preview sprite of the object.
Definition: object_widget.h:19
sortlist_type.h
BuildObjectWindow::TagNameFilter
static bool CDECL TagNameFilter(const ObjectClass *const *oc, StringFilter &filter)
Filter object classes by class name.
Definition: object_gui.cpp:137
GetGRFStringID
StringID GetGRFStringID(uint32 grfid, StringID stringid)
Returns the index for this stringid associated with its grfID.
Definition: newgrf_text.cpp:602
BuildObjectWindow::OBJECT_MARGIN
static const int OBJECT_MARGIN
The margin (in pixels) around an object.
Definition: object_gui.cpp:41
DrawTileSprites
Ground palette sprite of a tile, together with its sprite layout.
Definition: sprite.h:58
newgrf_text.h
BuildObjectWindow::line_height
int line_height
The height of a single line.
Definition: object_gui.cpp:43
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
BuildObjectWindow::GUIObjectClassList
GUIList< const ObjectClass *, StringFilter & > GUIObjectClassList
Type definition for the list to hold available object classes.
Definition: object_gui.cpp:38
Window::SetFocusedWidget
bool SetFocusedWidget(int widget_index)
Set focus within this window to the given widget.
Definition: window.cpp:495
stdafx.h
PC_BLACK
static const uint8 PC_BLACK
Black palette colour.
Definition: gfx_func.h:206
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition: gfx.cpp:114
Window::InvalidateData
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Definition: window.cpp:3261
viewport_func.h
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
Window::nested_array
NWidgetBase ** nested_array
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead.
Definition: window_gui.h:330
FillDrawPixelInfo
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Definition: gfx.cpp:1638
BuildObjectWindow::BuildObjectClassesAvailable
void BuildObjectClassesAvailable()
Builds the filter list of available object classes.
Definition: object_gui.cpp:148
newgrf_object.h
ObjectSpec::name
StringID name
The name for this object.
Definition: newgrf_object.h:62
_selected_object_class
static const ObjectClass * _selected_object_class
Currently selected available object class.
Definition: object_gui.cpp:32
BuildObjectWindow::SelectOtherClass
void SelectOtherClass(const ObjectClass *object_class)
Select the specified object class.
Definition: object_gui.cpp:424
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:66
GUIList::NeedRebuild
bool NeedRebuild() const
Check if a rebuild is needed.
Definition: sortlist_type.h:362
string_func.h
CALLBACK_FAILED
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Definition: newgrf_callbacks.h:404
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:998
strings_func.h
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
BuildObjectWindow::vscroll
Scrollbar * vscroll
The scrollbar.
Definition: object_gui.cpp:45
WWT_TEXT
@ WWT_TEXT
Pure simple text.
Definition: widget_type.h:56
BuildObjectWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: object_gui.cpp:532
ObjectSpec::views
uint8 views
The number of views.
Definition: newgrf_object.h:74
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:179
ScaleGUITrad
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:76
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1113
Scrollbar::IsVisible
bool IsVisible(uint16 item) const
Checks whether given current item is visible in the list.
Definition: widget_type.h:640
GUIList< const ObjectClass *, StringFilter & >::FilterFunction
bool CDECL FilterFunction(const const ObjectClass * *, StringFilter &)
Signature of filter function.
Definition: sortlist_type.h:49
BuildObjectWindow::object_classes
GUIObjectClassList object_classes
Available object classes.
Definition: object_gui.cpp:51
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:946
StringFilter::ResetState
void ResetState()
Reset the matching state to process a new item.
Definition: stringfilter.cpp:88
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
WID_BO_SELECT_SCROLL
@ WID_BO_SELECT_SCROLL
Scrollbar next to the WID_BO_SELECT_MATRIX.
Definition: object_widget.h:26
newgrf.h
GetObjectCallback
uint16 GetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view)
Perform a callback for an object.
Definition: newgrf_object.cpp:408
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:21
CMD_BUILD_OBJECT
@ CMD_BUILD_OBJECT
build an object
Definition: command_type.h:187
Scrollbar::GetPosition
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:630
GUIList::SetFiltering
void SetFiltering(Filtering f)
Import filter conditions.
Definition: sortlist_type.h:181
StringFilter::GetState
bool GetState() const
Get the matching state of the current item.
Definition: stringfilter_type.h:69
NewGRFClass::name
StringID name
Name of this class.
Definition: newgrf_class.h:39
GUIList::Filter
bool Filter(FilterFunction *decide, F filter_data)
Filter the list.
Definition: sortlist_type.h:318
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1848
WID_BO_CLASS_LIST
@ WID_BO_CLASS_LIST
The list with classes.
Definition: object_widget.h:16
BuildObjectWindow::SelectFirstAvailableObject
void SelectFirstAvailableObject(bool change_class)
Select the first available object.
Definition: object_gui.cpp:550
WD_MATRIX_BOTTOM
@ WD_MATRIX_BOTTOM
Offset at bottom of a matrix cell.
Definition: window_gui.h:79
window_func.h
GUIList::ForceRebuild
void ForceRebuild()
Force that a rebuild is needed.
Definition: sortlist_type.h:370
BuildObjectWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: object_gui.cpp:226
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:367
stringfilter_type.h
NewGRFClass::Get
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
Definition: newgrf_class_func.h:103
Scrollbar::SetCapacityFromWidget
void SetCapacityFromWidget(Window *w, int widget, int padding=0)
Set capacity of visible elements from the size and resize properties of a widget.
Definition: widget.cpp:1980
WC_BUILD_OBJECT
@ WC_BUILD_OBJECT
Build object; Window numbers:
Definition: window_type.h:369
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1075
TILE_HEIGHT
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
Definition: tile_type.h:16
WID_BO_OBJECT_NAME
@ WID_BO_OBJECT_NAME
The name of the selected object.
Definition: object_widget.h:20
NWidgetBase::pos_y
int pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:176
INVALID_TILE
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:83
SetObjectToPlaceWnd
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
Definition: viewport.cpp:3358
strnatcmp
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
Definition: string.cpp:625
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:982
BuildObjectWindow::OnEditboxChanged
void OnEditboxChanged(int wid) override
The text in an editbox has been edited.
Definition: object_gui.cpp:537
BuildObjectWindow::string_filter
StringFilter string_filter
Filter for available objects.
Definition: object_gui.cpp:52
GRFFilePropsBase::local_id
uint16 local_id
id defined by the grf file for this entity
Definition: newgrf_commons.h:319
BuildObjectWindow::EDITBOX_MAX_SIZE
static const uint EDITBOX_MAX_SIZE
The maximum number of characters for the filter edit box.
Definition: object_gui.cpp:40
ErrorUnknownCallbackResult
void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
Definition: newgrf_commons.cpp:516
BuildObjectWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: object_gui.cpp:315
Window
Data structure for an opened window.
Definition: window_gui.h:276
GUIList::RebuildDone
void RebuildDone()
Notify the sortlist that the rebuild is done.
Definition: sortlist_type.h:380
TILE_PIXELS
static const uint TILE_PIXELS
Pixel distance between tile columns/rows in #ZOOM_LVL_BASE.
Definition: tile_type.h:15
BuildObjectWindow::SelectOtherObject
void SelectOtherObject(int object_index)
Select the specified object in _selected_object_class class.
Definition: object_gui.cpp:434
WD_MATRIX_LEFT
@ WD_MATRIX_LEFT
Offset at left of a matrix cell.
Definition: window_gui.h:76
GRFFilePropsBase::grffile
const struct GRFFile * grffile
grf file that introduced this entity
Definition: newgrf_commons.h:320
BuildObjectWindow::last_sorting
static Listing last_sorting
Default sorting of GUIObjectClassList.
Definition: object_gui.cpp:47
WID_BO_OBJECT_SIZE
@ WID_BO_OBJECT_SIZE
The size of the selected object.
Definition: object_widget.h:21
WID_BO_OBJECT_MATRIX
@ WID_BO_OBJECT_MATRIX
The matrix with preview sprites.
Definition: object_widget.h:18
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:47
NWidgetBase::resize_x
uint resize_x
Horizontal resize step (0 means not resizable).
Definition: widget_type.h:164
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:172
lastof
#define lastof(x)
Get the last element of an fixed size array.
Definition: stdafx.h:383
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3421
StringFilter
String filter and state.
Definition: stringfilter_type.h:31
GUIList::SetSortFuncs
void SetSortFuncs(SortFunction *const *n_funcs)
Hand the array of sort function pointers to the sort list.
Definition: sortlist_type.h:270
DrawPixelInfo
Data about how and where to blit pixels.
Definition: gfx_type.h:155
ShowBuildObjectPicker
void ShowBuildObjectPicker()
Show our object picker.
Definition: object_gui.cpp:654
BuildObjectWindow::sorter_funcs
static GUIObjectClassList::SortFunction *const sorter_funcs[]
Sort functions of the GUIObjectClassList.
Definition: object_gui.cpp:49
CBID_OBJECT_FUND_MORE_TEXT
@ CBID_OBJECT_FUND_MORE_TEXT
Called to determine more text in the fund object window.
Definition: newgrf_callbacks.h:269