OpenTTD

newgrf_debug_gui.cpp
Go to the documentation of this file.
1 /* $Id: newgrf_debug_gui.cpp 27451 2015-11-20 10:04:28Z alberth $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #include "stdafx.h"
13 #include <stdarg.h>
14 #include "window_gui.h"
15 #include "window_func.h"
16 #include "fileio_func.h"
17 #include "spritecache.h"
18 #include "string_func.h"
19 #include "strings_func.h"
20 #include "textbuf_gui.h"
21 #include "vehicle_gui.h"
22 #include "zoom_func.h"
23
24 #include "engine_base.h"
25 #include "industry.h"
26 #include "object_base.h"
27 #include "station_base.h"
28 #include "town.h"
29 #include "vehicle_base.h"
30 #include "train.h"
31 #include "roadveh.h"
32
33 #include "newgrf_airporttiles.h"
34 #include "newgrf_debug.h"
35 #include "newgrf_object.h"
36 #include "newgrf_spritegroup.h"
37 #include "newgrf_station.h"
38 #include "newgrf_town.h"
39 #include "newgrf_railtype.h"
40 #include "newgrf_industries.h"
41 #include "newgrf_industrytiles.h"
42
43 #include "widgets/newgrf_debug_widget.h"
44
45 #include "table/strings.h"
46
47 #include "safeguards.h"
48
50 NewGrfDebugSpritePicker _newgrf_debug_sprite_picker = { SPM_NONE, NULL, 0, SmallVector<SpriteID, 256>() };
51
57 static inline uint GetFeatureIndex(uint window_number)
58 {
59 return GB(window_number, 0, 24);
60 }
61
69 static inline uint GetInspectWindowNumber(GrfSpecFeature feature, uint index)
70 {
71 assert((index >> 24) == 0);
72 return (feature << 24) | index;
73 }
74
79 enum NIType {
80 NIT_INT,
81 NIT_CARGO,
82 };
83
85 struct NIProperty {
86 const char *name;
87 ptrdiff_t offset;
88 byte read_size;
89 byte prop;
90 byte type;
91 };
92
93
98 struct NICallback {
99 const char *name;
100 ptrdiff_t offset;
101 byte read_size;
102 byte cb_bit;
103 uint16 cb_id;
104 };
106 static const int CBM_NO_BIT = UINT8_MAX;
107
109 struct NIVariable {
110 const char *name;
111 byte var;
112 };
113
115 class NIHelper {
116 public:
118 virtual ~NIHelper() {}
119
125 virtual bool IsInspectable(uint index) const = 0;
126
132 virtual uint GetParent(uint index) const = 0;
133
139 virtual const void *GetInstance(uint index) const = 0;
140
146 virtual const void *GetSpec(uint index) const = 0;
147
152 virtual void SetStringParameters(uint index) const = 0;
153
159 virtual uint32 GetGRFID(uint index) const = 0;
160
169 virtual uint Resolve(uint index, uint var, uint param, bool *avail) const = 0;
170
175 virtual bool PSAWithParameter() const
176 {
177 return false;
178 }
179
186 virtual uint GetPSASize(uint index, uint32 grfid) const
187 {
188 return 0;
189 }
190
197 virtual const int32 *GetPSAFirstPosition(uint index, uint32 grfid) const
198 {
199 return NULL;
200 }
201
202 protected:
208 void SetSimpleStringParameters(StringID string, uint32 index) const
209 {
210 SetDParam(0, string);
211 SetDParam(1, index);
212 }
213
214
221 void SetObjectAtStringParameters(StringID string, uint32 index, TileIndex tile) const
222 {
223 SetDParam(0, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT);
224 SetDParam(1, string);
225 SetDParam(2, index);
226 SetDParam(3, tile);
227 }
228 };
229
230
232 struct NIFeature {
233 const NIProperty *properties;
234 const NICallback *callbacks;
235 const NIVariable *variables;
236 const NIHelper *helper;
237 };
238
239 /* Load all the NewGRF debug data; externalised as it is just a huge bunch of tables. */
240 #include "table/newgrf_debug_data.h"
241
247 static inline GrfSpecFeature GetFeatureNum(uint window_number)
248 {
249 return (GrfSpecFeature)GB(window_number, 24, 8);
250 }
251
257 static inline const NIFeature *GetFeature(uint window_number)
258 {
259 GrfSpecFeature idx = GetFeatureNum(window_number);
260 return idx < GSF_FAKE_END ? _nifeatures[idx] : NULL;
261 }
262
269 static inline const NIHelper *GetFeatureHelper(uint window_number)
270 {
271 return GetFeature(window_number)->helper;
272 }
273
275 struct NewGRFInspectWindow : Window {
276 static const int LEFT_OFFSET = 5;
277 static const int RIGHT_OFFSET = 5;
278 static const int TOP_OFFSET = 5;
279 static const int BOTTOM_OFFSET = 5;
280
282 static uint32 var60params[GSF_FAKE_END][0x20];
283
285 uint32 caller_grfid;
286
288 uint chain_index;
289
291 byte current_edit_param;
292
293 Scrollbar *vscroll;
294
300 static bool HasVariableParameter(uint variable)
301 {
302 return IsInsideBS(variable, 0x60, 0x20);
303 }
304
309 void SetCallerGRFID(uint32 grfid)
310 {
311 this->caller_grfid = grfid;
312 this->SetDirty();
313 }
314
318 bool HasChainIndex() const
319 {
320 GrfSpecFeature f = GetFeatureNum(this->window_number);
321 return f == GSF_TRAINS || f == GSF_ROADVEHICLES;
322 }
323
328 uint GetFeatureIndex() const
329 {
330 uint index = ::GetFeatureIndex(this->window_number);
331 if (this->chain_index > 0) {
332 assert(this->HasChainIndex());
333 const Vehicle *v = Vehicle::Get(index);
334 v = v->Move(this->chain_index);
335 if (v != NULL) index = v->index;
336 }
337 return index;
338 }
339
343 void ValidateChainIndex()
344 {
345 if (this->chain_index == 0) return;
346
347 assert(this->HasChainIndex());
348
349 const Vehicle *v = Vehicle::Get(::GetFeatureIndex(this->window_number));
350 v = v->Move(this->chain_index);
351 if (v == NULL) this->chain_index = 0;
352 }
353
354 NewGRFInspectWindow(WindowDesc *desc, WindowNumber wno) : Window(desc)
355 {
356 this->CreateNestedTree();
357 this->vscroll = this->GetScrollbar(WID_NGRFI_SCROLLBAR);
358 this->FinishInitNested(wno);
359
360 this->vscroll->SetCount(0);
361 this->SetWidgetDisabledState(WID_NGRFI_PARENT, GetFeatureHelper(this->window_number)->GetParent(this->GetFeatureIndex()) == UINT32_MAX);
362
363 this->OnInvalidateData(0, true);
364 }
365
366 virtual void SetStringParameters(int widget) const
367 {
368 if (widget != WID_NGRFI_CAPTION) return;
369
370 GetFeatureHelper(this->window_number)->SetStringParameters(this->GetFeatureIndex());
371 }
372
373 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
374 {
375 switch (widget) {
376 case WID_NGRFI_VEH_CHAIN: {
377 assert(this->HasChainIndex());
378 GrfSpecFeature f = GetFeatureNum(this->window_number);
379 size->height = max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM);
380 break;
381 }
382
383 case WID_NGRFI_MAINPANEL:
384 resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
385 resize->width = 1;
386
387 size->height = 5 * resize->height + TOP_OFFSET + BOTTOM_OFFSET;
388 break;
389 }
390 }
391
398 void WARN_FORMAT(4, 5) DrawString(const Rect &r, int offset, const char *format, ...) const
399 {
400 char buf[1024];
401
402 va_list va;
403 va_start(va, format);
404 vseprintf(buf, lastof(buf), format, va);
405 va_end(va);
406
407 offset -= this->vscroll->GetPosition();
408 if (offset < 0 || offset >= this->vscroll->GetCapacity()) return;
409
410 ::DrawString(r.left + LEFT_OFFSET, r.right - RIGHT_OFFSET, r.top + TOP_OFFSET + (offset * this->resize.step_height), buf, TC_BLACK);
411 }
412
413 virtual void DrawWidget(const Rect &r, int widget) const
414 {
415 switch (widget) {
416 case WID_NGRFI_VEH_CHAIN: {
417 const Vehicle *v = Vehicle::Get(this->GetFeatureIndex());
418 int total_width = 0;
419 int sel_start = 0;
420 int sel_end = 0;
421 for (const Vehicle *u = v->First(); u != NULL; u = u->Next()) {
422 if (u == v) sel_start = total_width;
423 switch (u->type) {
424 case VEH_TRAIN: total_width += Train ::From(u)->GetDisplayImageWidth(); break;
425 case VEH_ROAD: total_width += RoadVehicle::From(u)->GetDisplayImageWidth(); break;
426 default: NOT_REACHED();
427 }
428 if (u == v) sel_end = total_width;
429 }
430
431 int width = r.right + 1 - r.left - WD_BEVEL_LEFT - WD_BEVEL_RIGHT;
432 int skip = 0;
433 if (total_width > width) {
434 int sel_center = (sel_start + sel_end) / 2;
435 if (sel_center > width / 2) skip = min(total_width - width, sel_center - width / 2);
436 }
437
438 GrfSpecFeature f = GetFeatureNum(this->window_number);
439 int h = GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height;
440 int y = (r.top + r.bottom - h) / 2;
441 DrawVehicleImage(v->First(), r.left + WD_BEVEL_LEFT, r.right - WD_BEVEL_RIGHT, y + 1, INVALID_VEHICLE, EIT_IN_DETAILS, skip);
442
443 /* Highlight the articulated part (this is different to the whole-vehicle highlighting of DrawVehicleImage */
444 if (_current_text_dir == TD_RTL) {
445 DrawFrameRect(r.right - sel_end + skip, y, r.right - sel_start + skip, y + h, COLOUR_WHITE, FR_BORDERONLY);
446 } else {
447 DrawFrameRect(r.left + sel_start - skip, y, r.left + sel_end - skip, y + h, COLOUR_WHITE, FR_BORDERONLY);
448 }
449 break;
450 }
451 }
452
453 if (widget != WID_NGRFI_MAINPANEL) return;
454
455 uint index = this->GetFeatureIndex();
456 const NIFeature *nif = GetFeature(this->window_number);
457 const NIHelper *nih = nif->helper;
458 const void *base = nih->GetInstance(index);
459 const void *base_spec = nih->GetSpec(index);
460
461 uint i = 0;
462 if (nif->variables != NULL) {
463 this->DrawString(r, i++, "Variables:");
464 for (const NIVariable *niv = nif->variables; niv->name != NULL; niv++) {
465 bool avail = true;
466 uint param = HasVariableParameter(niv->var) ? NewGRFInspectWindow::var60params[GetFeatureNum(this->window_number)][niv->var - 0x60] : 0;
467 uint value = nih->Resolve(index, niv->var, param, &avail);
468
469 if (!avail) continue;
470
471 if (HasVariableParameter(niv->var)) {
472 this->DrawString(r, i++, " %02x[%02x]: %08x (%s)", niv->var, param, value, niv->name);
473 } else {
474 this->DrawString(r, i++, " %02x: %08x (%s)", niv->var, value, niv->name);
475 }
476 }
477 }
478
479 uint psa_size = nih->GetPSASize(index, this->caller_grfid);
480 const int32 *psa = nih->GetPSAFirstPosition(index, this->caller_grfid);
481 if (psa_size != 0 && psa != NULL) {
482 if (nih->PSAWithParameter()) {
483 this->DrawString(r, i++, "Persistent storage [%08X]:", BSWAP32(this->caller_grfid));
484 } else {
485 this->DrawString(r, i++, "Persistent storage:");
486 }
487 assert(psa_size % 4 == 0);
488 for (uint j = 0; j < psa_size; j += 4, psa += 4) {
489 this->DrawString(r, i++, " %i: %i %i %i %i", j, psa[0], psa[1], psa[2], psa[3]);
490 }
491 }
492
493 if (nif->properties != NULL) {
494 this->DrawString(r, i++, "Properties:");
495 for (const NIProperty *nip = nif->properties; nip->name != NULL; nip++) {
496 const void *ptr = (const byte *)base + nip->offset;
497 uint value;
498 switch (nip->read_size) {
499 case 1: value = *(const uint8 *)ptr; break;
500 case 2: value = *(const uint16 *)ptr; break;
501 case 4: value = *(const uint32 *)ptr; break;
502 default: NOT_REACHED();
503 }
504
505 StringID string;
506 SetDParam(0, value);
507 switch (nip->type) {
508 case NIT_INT:
509 string = STR_JUST_INT;
510 break;
511
512 case NIT_CARGO:
513 string = value != INVALID_CARGO ? CargoSpec::Get(value)->name : STR_QUANTITY_N_A;
514 break;
515
516 default:
517 NOT_REACHED();
518 }
519
520 char buffer[64];
521 GetString(buffer, string, lastof(buffer));
522 this->DrawString(r, i++, " %02x: %s (%s)", nip->prop, buffer, nip->name);
523 }
524 }
525
526 if (nif->callbacks != NULL) {
527 this->DrawString(r, i++, "Callbacks:");
528 for (const NICallback *nic = nif->callbacks; nic->name != NULL; nic++) {
529 if (nic->cb_bit != CBM_NO_BIT) {
530 const void *ptr = (const byte *)base_spec + nic->offset;
531 uint value;
532 switch (nic->read_size) {
533 case 1: value = *(const uint8 *)ptr; break;
534 case 2: value = *(const uint16 *)ptr; break;
535 case 4: value = *(const uint32 *)ptr; break;
536 default: NOT_REACHED();
537 }
538
539 if (!HasBit(value, nic->cb_bit)) continue;
540 this->DrawString(r, i++, " %03x: %s", nic->cb_id, nic->name);
541 } else {
542 this->DrawString(r, i++, " %03x: %s (unmasked)", nic->cb_id, nic->name);
543 }
544 }
545 }
546
547 /* Not nice and certainly a hack, but it beats duplicating
548 * this whole function just to count the actual number of
549 * elements. Especially because they need to be redrawn. */
550 const_cast<NewGRFInspectWindow*>(this)->vscroll->SetCount(i);
551 }
552
553 virtual void OnClick(Point pt, int widget, int click_count)
554 {
555 switch (widget) {
556 case WID_NGRFI_PARENT: {
557 const NIHelper *nih = GetFeatureHelper(this->window_number);
558 uint index = nih->GetParent(this->GetFeatureIndex());
559 ::ShowNewGRFInspectWindow(GetFeatureNum(index), ::GetFeatureIndex(index), nih->GetGRFID(this->GetFeatureIndex()));
560 break;
561 }
562
563 case WID_NGRFI_VEH_PREV:
564 if (this->chain_index > 0) {
565 this->chain_index--;
566 this->InvalidateData();
567 }
568 break;
569
570 case WID_NGRFI_VEH_NEXT:
571 if (this->HasChainIndex()) {
572 uint index = this->GetFeatureIndex();
573 Vehicle *v = Vehicle::Get(index);
574 if (v != NULL && v->Next() != NULL) {
575 this->chain_index++;
576 this->InvalidateData();
577 }
578 }
579 break;
580
581 case WID_NGRFI_MAINPANEL: {
582 /* Does this feature have variables? */
583 const NIFeature *nif = GetFeature(this->window_number);
584 if (nif->variables == NULL) return;
585
586 /* Get the line, make sure it's within the boundaries. */
587 int line = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NGRFI_MAINPANEL, TOP_OFFSET);
588 if (line == INT_MAX) return;
589
590 /* Find the variable related to the line */
591 for (const NIVariable *niv = nif->variables; niv->name != NULL; niv++, line--) {
592 if (line != 1) continue; // 1 because of the "Variables:" line
593
594 if (!HasVariableParameter(niv->var)) break;
595
596 this->current_edit_param = niv->var;
597 ShowQueryString(STR_EMPTY, STR_NEWGRF_INSPECT_QUERY_CAPTION, 9, this, CS_HEXADECIMAL, QSF_NONE);
598 }
599 }
600 }
601 }
602
603 virtual void OnQueryTextFinished(char *str)
604 {
605 if (StrEmpty(str)) return;
606
607 NewGRFInspectWindow::var60params[GetFeatureNum(this->window_number)][this->current_edit_param - 0x60] = strtol(str, NULL, 16);
608 this->SetDirty();
609 }
610
611 virtual void OnResize()
612 {
613 this->vscroll->SetCapacityFromWidget(this, WID_NGRFI_MAINPANEL, TOP_OFFSET + BOTTOM_OFFSET);
614 }
615
621 virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
622 {
623 if (!gui_scope) return;
624 if (this->HasChainIndex()) {
625 this->ValidateChainIndex();
626 this->SetWidgetDisabledState(WID_NGRFI_VEH_PREV, this->chain_index == 0);
627 Vehicle *v = Vehicle::Get(this->GetFeatureIndex());
628 this->SetWidgetDisabledState(WID_NGRFI_VEH_NEXT, v == NULL || v->Next() == NULL);
629 }
630 }
631 };
632
633 /* static */ uint32 NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array
634
635 static const NWidgetPart _nested_newgrf_inspect_chain_widgets[] = {
636 NWidget(NWID_HORIZONTAL),
637 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
638 NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetDataTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
639 NWidget(WWT_SHADEBOX, COLOUR_GREY),
640 NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
641 NWidget(WWT_STICKYBOX, COLOUR_GREY),
642 EndContainer(),
643 NWidget(WWT_PANEL, COLOUR_GREY),
644 NWidget(NWID_HORIZONTAL),
645 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_NGRFI_VEH_PREV), SetDataTip(AWV_DECREASE, STR_NULL),
646 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_NGRFI_VEH_NEXT), SetDataTip(AWV_INCREASE, STR_NULL),
647 NWidget(WWT_EMPTY, COLOUR_GREY, WID_NGRFI_VEH_CHAIN), SetFill(1, 0), SetResize(1, 0),
648 EndContainer(),
649 EndContainer(),
650 NWidget(NWID_HORIZONTAL),
651 NWidget(WWT_PANEL, COLOUR_GREY, WID_NGRFI_MAINPANEL), SetMinimalSize(300, 0), SetScrollbar(WID_NGRFI_SCROLLBAR), EndContainer(),
652 NWidget(NWID_VERTICAL),
653 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_NGRFI_SCROLLBAR),
654 NWidget(WWT_RESIZEBOX, COLOUR_GREY),
655 EndContainer(),
656 EndContainer(),
657 };
658
659 static const NWidgetPart _nested_newgrf_inspect_widgets[] = {
660 NWidget(NWID_HORIZONTAL),
661 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
662 NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetDataTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
663 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NGRFI_PARENT), SetDataTip(STR_NEWGRF_INSPECT_PARENT_BUTTON, STR_NEWGRF_INSPECT_PARENT_TOOLTIP),
664 NWidget(WWT_SHADEBOX, COLOUR_GREY),
665 NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
666 NWidget(WWT_STICKYBOX, COLOUR_GREY),
667 EndContainer(),
668 NWidget(NWID_HORIZONTAL),
669 NWidget(WWT_PANEL, COLOUR_GREY, WID_NGRFI_MAINPANEL), SetMinimalSize(300, 0), SetScrollbar(WID_NGRFI_SCROLLBAR), EndContainer(),
670 NWidget(NWID_VERTICAL),
671 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_NGRFI_SCROLLBAR),
672 NWidget(WWT_RESIZEBOX, COLOUR_GREY),
673 EndContainer(),
674 EndContainer(),
675 };
676
677 static WindowDesc _newgrf_inspect_chain_desc(
678 WDP_AUTO, "newgrf_inspect_chain", 400, 300,
679 WC_NEWGRF_INSPECT, WC_NONE,
680 0,
681 _nested_newgrf_inspect_chain_widgets, lengthof(_nested_newgrf_inspect_chain_widgets)
682 );
683
684 static WindowDesc _newgrf_inspect_desc(
685 WDP_AUTO, "newgrf_inspect", 400, 300,
686 WC_NEWGRF_INSPECT, WC_NONE,
687 0,
688 _nested_newgrf_inspect_widgets, lengthof(_nested_newgrf_inspect_widgets)
689 );
690
700 void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32 grfid)
701 {
702 if (!IsNewGRFInspectable(feature, index)) return;
703
704 WindowNumber wno = GetInspectWindowNumber(feature, index);
705 WindowDesc *desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? &_newgrf_inspect_chain_desc : &_newgrf_inspect_desc;
706 NewGRFInspectWindow *w = AllocateWindowDescFront<NewGRFInspectWindow>(desc, wno, true);
707 w->SetCallerGRFID(grfid);
708 }
709
718 void InvalidateNewGRFInspectWindow(GrfSpecFeature feature, uint index)
719 {
720 if (feature == GSF_INVALID) return;
721
722 WindowNumber wno = GetInspectWindowNumber(feature, index);
723 InvalidateWindowData(WC_NEWGRF_INSPECT, wno);
724 }
725
734 void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
735 {
736 if (feature == GSF_INVALID) return;
737
738 WindowNumber wno = GetInspectWindowNumber(feature, index);
739 DeleteWindowById(WC_NEWGRF_INSPECT, wno);
740
741 /* Reinitialise the land information window to remove the "debug" sprite if needed.
742 * Note: Since we might be called from a command here, it is important to not execute
743 * the invalidation immediately. The landinfo window tests commands itself. */
744 InvalidateWindowData(WC_LAND_INFO, 0, 1);
745 }
746
756 bool IsNewGRFInspectable(GrfSpecFeature feature, uint index)
757 {
758 const NIFeature *nif = GetFeature(GetInspectWindowNumber(feature, index));
759 if (nif == NULL) return false;
760 return nif->helper->IsInspectable(index);
761 }
762
768 GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
769 {
770 switch (GetTileType(tile)) {
771 default: return GSF_INVALID;
772 case MP_RAILWAY: return GSF_RAILTYPES;
773 case MP_ROAD: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_INVALID;
774 case MP_HOUSE: return GSF_HOUSES;
775 case MP_INDUSTRY: return GSF_INDUSTRYTILES;
776 case MP_OBJECT: return GSF_OBJECTS;
777
778 case MP_STATION:
779 switch (GetStationType(tile)) {
780 case STATION_RAIL: return GSF_STATIONS;
781 case STATION_AIRPORT: return GSF_AIRPORTTILES;
782 default: return GSF_INVALID;
783 }
784 }
785 }
786
792 GrfSpecFeature GetGrfSpecFeature(VehicleType type)
793 {
794 switch (type) {
795 case VEH_TRAIN: return GSF_TRAINS;
796 case VEH_ROAD: return GSF_ROADVEHICLES;
797 case VEH_SHIP: return GSF_SHIPS;
798 case VEH_AIRCRAFT: return GSF_AIRCRAFT;
799 default: return GSF_INVALID;
800 }
801 }
802
803
804
805 /**** Sprite Aligner ****/
806
808 struct SpriteAlignerWindow : Window {
809 typedef SmallPair<int16, int16> XyOffs;
810
811 SpriteID current_sprite;
812 Scrollbar *vscroll;
813 SmallMap<SpriteID, XyOffs> offs_start_map;
814
815 SpriteAlignerWindow(WindowDesc *desc, WindowNumber wno) : Window(desc)
816 {
817 this->CreateNestedTree();
818 this->vscroll = this->GetScrollbar(WID_SA_SCROLLBAR);
819 this->FinishInitNested(wno);
820
821 /* Oh yes, we assume there is at least one normal sprite! */
822 while (GetSpriteType(this->current_sprite) != ST_NORMAL) this->current_sprite++;
823 }
824
825 virtual void SetStringParameters(int widget) const
826 {
827 const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
828 switch (widget) {
829 case WID_SA_CAPTION:
830 SetDParam(0, this->current_sprite);
831 SetDParamStr(1, FioGetFilename(GetOriginFileSlot(this->current_sprite)));
832 break;
833
834 case WID_SA_OFFSETS_ABS:
835 SetDParam(0, spr->x_offs);
836 SetDParam(1, spr->y_offs);
837 break;
838
839 case WID_SA_OFFSETS_REL: {
840 /* Relative offset is new absolute offset - starting absolute offset.
841 * Show 0, 0 as the relative offsets if entry is not in the map (meaning they have not been changed yet).
842 */
843 const SmallPair<SpriteID, XyOffs> *key_offs_pair = this->offs_start_map.Find(this->current_sprite);
844 if (key_offs_pair != this->offs_start_map.End()) {
845 SetDParam(0, spr->x_offs - key_offs_pair->second.first);
846 SetDParam(1, spr->y_offs - key_offs_pair->second.second);
847 } else {
848 SetDParam(0, 0);
849 SetDParam(1, 0);
850 }
851 break;
852 }
853
854 default:
855 break;
856 }
857 }
858
859 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
860 {
861 if (widget != WID_SA_LIST) return;
862
863 resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
864 resize->width = 1;
865
866 /* Resize to about 200 pixels (for the preview) */
867 size->height = (1 + 200 / resize->height) * resize->height;
868 }
869
870 virtual void DrawWidget(const Rect &r, int widget) const
871 {
872 switch (widget) {
873 case WID_SA_SPRITE: {
874 /* Center the sprite ourselves */
875 const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
876 int width = r.right - r.left + 1 - WD_BEVEL_LEFT - WD_BEVEL_RIGHT;
877 int height = r.bottom - r.top + 1 - WD_BEVEL_TOP - WD_BEVEL_BOTTOM;
878 int x = -UnScaleGUI(spr->x_offs) + (width - UnScaleGUI(spr->width) ) / 2;
879 int y = -UnScaleGUI(spr->y_offs) + (height - UnScaleGUI(spr->height)) / 2;
880
881 DrawPixelInfo new_dpi;
882 if (!FillDrawPixelInfo(&new_dpi, r.left + WD_BEVEL_LEFT, r.top + WD_BEVEL_TOP, width, height)) break;
883 DrawPixelInfo *old_dpi = _cur_dpi;
884 _cur_dpi = &new_dpi;
885
886 DrawSprite(this->current_sprite, PAL_NONE, x, y, NULL, ZOOM_LVL_GUI);
887
888 _cur_dpi = old_dpi;
889
890 break;
891 }
892
893 case WID_SA_LIST: {
894 const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
895 int step_size = nwid->resize_y;
896
897 SmallVector<SpriteID, 256> &list = _newgrf_debug_sprite_picker.sprites;
898 int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), list.Length());
899
900 int y = r.top + WD_FRAMERECT_TOP;
901 for (int i = this->vscroll->GetPosition(); i < max; i++) {
902 SetDParam(0, list[i]);
903 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
904 y += step_size;
905 }
906 break;
907 }
908 }
909 }
910
911 virtual void OnClick(Point pt, int widget, int click_count)
912 {
913 switch (widget) {
914 case WID_SA_PREVIOUS:
915 do {
916 this->current_sprite = (this->current_sprite == 0 ? GetMaxSpriteID() : this->current_sprite) - 1;
917 } while (GetSpriteType(this->current_sprite) != ST_NORMAL);
918 this->SetDirty();
919 break;
920
921 case WID_SA_GOTO:
922 ShowQueryString(STR_EMPTY, STR_SPRITE_ALIGNER_GOTO_CAPTION, 7, this, CS_NUMERAL, QSF_NONE);
923 break;
924
925 case WID_SA_NEXT:
926 do {
927 this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID();
928 } while (GetSpriteType(this->current_sprite) != ST_NORMAL);
929 this->SetDirty();
930 break;
931
932 case WID_SA_PICKER:
933 this->LowerWidget(WID_SA_PICKER);
934 _newgrf_debug_sprite_picker.mode = SPM_WAIT_CLICK;
935 this->SetDirty();
936 break;
937
938 case WID_SA_LIST: {
939 const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
940 int step_size = nwid->resize_y;
941
942 uint i = this->vscroll->GetPosition() + (pt.y - nwid->pos_y) / step_size;
943 if (i < _newgrf_debug_sprite_picker.sprites.Length()) {
944 SpriteID spr = _newgrf_debug_sprite_picker.sprites[i];
945 if (GetSpriteType(spr) == ST_NORMAL) this->current_sprite = spr;
946 }
947 this->SetDirty();
948 break;
949 }
950
951 case WID_SA_UP:
952 case WID_SA_DOWN:
953 case WID_SA_LEFT:
954 case WID_SA_RIGHT: {
955 /*
956 * Yes... this is a hack.
957 *
958 * No... I don't think it is useful to make this less of a hack.
959 *
960 * If you want to align sprites, you just need the number. Generally
961 * the sprite caches are big enough to not remove the sprite from the
962 * cache. If that's not the case, just let the NewGRF developer
963 * increase the cache size instead of storing thousands of offsets
964 * for the incredibly small chance that it's actually going to be
965 * used by someone and the sprite cache isn't big enough for that
966 * particular NewGRF developer.
967 */
968 Sprite *spr = const_cast<Sprite *>(GetSprite(this->current_sprite, ST_NORMAL));
969
970 /* Remember the original offsets of the current sprite, if not already in mapping. */
971 if (!(this->offs_start_map.Contains(this->current_sprite))) {
972 this->offs_start_map.Insert(this->current_sprite, XyOffs(spr->x_offs, spr->y_offs));
973 }
974 switch (widget) {
975 /* Move ten units at a time if ctrl is pressed. */
976 case WID_SA_UP: spr->y_offs -= _ctrl_pressed ? 8 : 1; break;
977 case WID_SA_DOWN: spr->y_offs += _ctrl_pressed ? 8 : 1; break;
978 case WID_SA_LEFT: spr->x_offs -= _ctrl_pressed ? 8 : 1; break;
979 case WID_SA_RIGHT: spr->x_offs += _ctrl_pressed ? 8 : 1; break;
980 }
981 /* Of course, we need to redraw the sprite, but where is it used?
982 * Everywhere is a safe bet. */
983 MarkWholeScreenDirty();
984 break;
985 }
986
987 case WID_SA_RESET_REL:
988 /* Reset the starting offsets for the current sprite. */
989 this->offs_start_map.Erase(this->current_sprite);
990 this->SetDirty();
991 break;
992 }
993 }
994
995 virtual void OnQueryTextFinished(char *str)
996 {
997 if (StrEmpty(str)) return;
998
999 this->current_sprite = atoi(str);
1000 if (this->current_sprite >= GetMaxSpriteID()) this->current_sprite = 0;
1001 while (GetSpriteType(this->current_sprite) != ST_NORMAL) {
1002 this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID();
1003 }
1004 this->SetDirty();
1005 }
1006
1012 virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
1013 {
1014 if (!gui_scope) return;
1015 if (data == 1) {
1016 /* Sprite picker finished */
1017 this->RaiseWidget(WID_SA_PICKER);
1018 this->vscroll->SetCount(_newgrf_debug_sprite_picker.sprites.Length());
1019 }
1020 }
1021
1022 virtual void OnResize()
1023 {
1024 this->vscroll->SetCapacityFromWidget(this, WID_SA_LIST);
1025 }
1026 };
1027
1028 static const NWidgetPart _nested_sprite_aligner_widgets[] = {
1029 NWidget(NWID_HORIZONTAL),
1030 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
1031 NWidget(WWT_CAPTION, COLOUR_GREY, WID_SA_CAPTION), SetDataTip(STR_SPRITE_ALIGNER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1032 NWidget(WWT_SHADEBOX, COLOUR_GREY),
1033 NWidget(WWT_STICKYBOX, COLOUR_GREY),
1034 EndContainer(),
1035 NWidget(WWT_PANEL, COLOUR_GREY),
1036 NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 10),
1037 NWidget(NWID_VERTICAL), SetPIP(10, 5, 10),
1038 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 5, 10),
1039 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SA_PREVIOUS), SetDataTip(STR_SPRITE_ALIGNER_PREVIOUS_BUTTON, STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP), SetFill(1, 0),
1040 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SA_GOTO), SetDataTip(STR_SPRITE_ALIGNER_GOTO_BUTTON, STR_SPRITE_ALIGNER_GOTO_TOOLTIP), SetFill(1, 0),
1041 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SA_NEXT), SetDataTip(STR_SPRITE_ALIGNER_NEXT_BUTTON, STR_SPRITE_ALIGNER_NEXT_TOOLTIP), SetFill(1, 0),
1042 EndContainer(),
1043 NWidget(NWID_HORIZONTAL), SetPIP(10, 5, 10),
1044 NWidget(NWID_SPACER), SetFill(1, 1),
1045 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SA_UP), SetDataTip(SPR_ARROW_UP, STR_SPRITE_ALIGNER_MOVE_TOOLTIP), SetResize(0, 0),
1046 NWidget(NWID_SPACER), SetFill(1, 1),
1047 EndContainer(),
1048 NWidget(NWID_HORIZONTAL_LTR), SetPIP(10, 5, 10),
1049 NWidget(NWID_VERTICAL),
1050 NWidget(NWID_SPACER), SetFill(1, 1),
1051 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SA_LEFT), SetDataTip(SPR_ARROW_LEFT, STR_SPRITE_ALIGNER_MOVE_TOOLTIP), SetResize(0, 0),
1052 NWidget(NWID_SPACER), SetFill(1, 1),
1053 EndContainer(),
1054 NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_SA_SPRITE), SetDataTip(STR_NULL, STR_SPRITE_ALIGNER_SPRITE_TOOLTIP),
1055 EndContainer(),
1056 NWidget(NWID_VERTICAL),
1057 NWidget(NWID_SPACER), SetFill(1, 1),
1058 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SA_RIGHT), SetDataTip(SPR_ARROW_RIGHT, STR_SPRITE_ALIGNER_MOVE_TOOLTIP), SetResize(0, 0),
1059 NWidget(NWID_SPACER), SetFill(1, 1),
1060 EndContainer(),
1061 EndContainer(),
1062 NWidget(NWID_HORIZONTAL), SetPIP(10, 5, 10),
1063 NWidget(NWID_SPACER), SetFill(1, 1),
1064 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SA_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SPRITE_ALIGNER_MOVE_TOOLTIP), SetResize(0, 0),
1065 NWidget(NWID_SPACER), SetFill(1, 1),
1066 EndContainer(),
1067 NWidget(WWT_LABEL, COLOUR_GREY, WID_SA_OFFSETS_ABS), SetDataTip(STR_SPRITE_ALIGNER_OFFSETS_ABS, STR_NULL), SetFill(1, 0), SetPadding(0, 10, 0, 10),
1068 NWidget(WWT_LABEL, COLOUR_GREY, WID_SA_OFFSETS_REL), SetDataTip(STR_SPRITE_ALIGNER_OFFSETS_REL, STR_NULL), SetFill(1, 0), SetPadding(0, 10, 0, 10),
1069 NWidget(NWID_HORIZONTAL), SetPIP(10, 5, 10),
1070 NWidget(NWID_SPACER), SetFill(1, 1),
1071 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SA_RESET_REL), SetDataTip(STR_SPRITE_ALIGNER_RESET_BUTTON, STR_SPRITE_ALIGNER_RESET_TOOLTIP), SetFill(0, 0),
1072 NWidget(NWID_SPACER), SetFill(1, 1),
1073 EndContainer(),
1074 EndContainer(),
1075 NWidget(NWID_VERTICAL), SetPIP(10, 5, 10),
1076 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SA_PICKER), SetDataTip(STR_SPRITE_ALIGNER_PICKER_BUTTON, STR_SPRITE_ALIGNER_PICKER_TOOLTIP), SetFill(1, 0),
1077 NWidget(NWID_HORIZONTAL),
1078 NWidget(WWT_MATRIX, COLOUR_GREY, WID_SA_LIST), SetResize(1, 1), SetMatrixDataTip(1, 0, STR_NULL), SetFill(1, 1), SetScrollbar(WID_SA_SCROLLBAR),
1079 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SA_SCROLLBAR),
1080 EndContainer(),
1081 EndContainer(),
1082 EndContainer(),
1083 EndContainer(),
1084 };
1085
1086 static WindowDesc _sprite_aligner_desc(
1087 WDP_AUTO, "sprite_aligner", 400, 300,
1088 WC_SPRITE_ALIGNER, WC_NONE,
1089 0,
1090 _nested_sprite_aligner_widgets, lengthof(_nested_sprite_aligner_widgets)
1091 );
1092
1096 void ShowSpriteAlignerWindow()
1097 {
1098 AllocateWindowDescFront<SpriteAlignerWindow>(&_sprite_aligner_desc, 0);
1099 }
WID_SA_LEFT
Move the sprite to the left.
Definition: newgrf_debug_widget.h:33
strings_func.h
Functions related to OTTD&#39;s strings.
GetTileType
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
Definition: tile_map.h:89
roadveh.h
Road vehicle states.
WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:48
newgrf_debug.h
Functions/types related to NewGRF debugging.
WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:105
WID_NGRFI_CAPTION
The caption bar of course.
Definition: newgrf_debug_widget.h:17
newgrf_railtype.h
NewGRF handling of rail types.
NewGRFInspectWindow::current_edit_param
byte current_edit_param
The currently edited parameter, to update the right one.
Definition: newgrf_debug_gui.cpp:291
WID_NGRFI_VEH_CHAIN
Display for vehicle chain.
Definition: newgrf_debug_widget.h:21
DrawPixelInfo
Data about how and where to blit pixels.
Definition: gfx_type.h:156
GetOriginFileSlot
uint GetOriginFileSlot(SpriteID sprite)
Get the (FIOS) file slot of a given sprite.
Definition: spritecache.cpp:146
WID_SA_PREVIOUS
Skip to the previous sprite.
Definition: newgrf_debug_widget.h:29
SmallMap::Contains
bool Contains(const T &key) const
Tests whether a key is assigned in this map.
Definition: smallmap_type.hpp:83
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:930
WID_SA_RESET_REL
Reset relative sprite offset.
Definition: newgrf_debug_widget.h:42
NIHelper::GetParent
virtual uint GetParent(uint index) const =0
Get the parent "window_number" of a given instance.
WID_SA_SCROLLBAR
Scrollbar for sprite list.
Definition: newgrf_debug_widget.h:41
UnScaleGUI
static int UnScaleGUI(int value)
Short-hand to apply GUI zoom level.
Definition: zoom_func.h:72
NICallback::cb_bit
byte cb_bit
The bit that needs to be set for this callback to be enabled.
Definition: newgrf_debug_gui.cpp:102
WindowDesc
High level window description.
Definition: window_gui.h:168
MP_INDUSTRY
Part of an industry.
Definition: tile_type.h:51
SmallMap::Find
const Pair * Find(const T &key) const
Finds given key in this map.
Definition: smallmap_type.hpp:57
SpriteAlignerWindow::offs_start_map
SmallMap< SpriteID, XyOffs > offs_start_map
Mapping of starting offsets for the sprites which have been aligned in the sprite aligner window...
Definition: newgrf_debug_gui.cpp:813
SpriteAlignerWindow::OnQueryTextFinished
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Definition: newgrf_debug_gui.cpp:995
NIType
NIType
The type of a property to show.
Definition: newgrf_debug_gui.cpp:79
NIHelper::IsInspectable
virtual bool IsInspectable(uint index) const =0
Is the item with the given index inspectable?
Pool::PoolItem<&_vehicle_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:246
NICallback::offset
ptrdiff_t offset
Offset of the variable in the class.
Definition: newgrf_debug_gui.cpp:100
WD_BEVEL_LEFT
Width of left bevel border.
Definition: window_gui.h:56
DrawVehicleImage
void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID selection, EngineImageType image_type, int skip)
Draws an image of a vehicle chain.
Definition: vehicle_gui.cpp:1333
WWT_LABEL
Centered label.
Definition: widget_type.h:57
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:589
newgrf_industries.h
Functions for NewGRF industries.
CS_HEXADECIMAL
Only hexadecimal characters.
Definition: string_type.h:31
NICallback::name
const char * name
The human readable name of the callback.
Definition: newgrf_debug_gui.cpp:99
train.h
Base for the train class.
DeleteNewGRFInspectWindow
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Delete inspect window for a given feature and index.
Definition: newgrf_debug_gui.cpp:734
WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:64
_newgrf_debug_sprite_picker
NewGrfDebugSpritePicker _newgrf_debug_sprite_picker
The sprite picker.
Definition: newgrf_debug_gui.cpp:50
NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:75
AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:38
AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:37
MP_ROAD
A tile with road (or tram tracks)
Definition: tile_type.h:45
NIHelper::SetSimpleStringParameters
void SetSimpleStringParameters(StringID string, uint32 index) const
Helper to make setting the strings easier.
Definition: newgrf_debug_gui.cpp:208
Sprite
Data structure describing a sprite.
Definition: spritecache.h:18
ShowQueryString
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
Definition: misc_gui.cpp:1066
NIVariable
Representation on the NewGRF variables.
Definition: newgrf_debug_gui.cpp:109
WID_SA_UP
Move the sprite up.
Definition: newgrf_debug_widget.h:32
NIHelper::GetGRFID
virtual uint32 GetGRFID(uint index) const =0
Get the GRFID of the file that includes this item.
WID_NGRFI_VEH_PREV
Go to previous vehicle in chain.
Definition: newgrf_debug_widget.h:19
vseprintf
int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap)
Safer implementation of vsnprintf; same as vsnprintf except:
Definition: string.cpp:50
NIProperty::read_size
byte read_size
Number of bytes (i.e. byte, word, dword etc)
Definition: newgrf_debug_gui.cpp:88
NICallback::cb_id
uint16 cb_id
The number of the callback.
Definition: newgrf_debug_gui.cpp:103
SmallMap
Implementation of simple mapping class.
Definition: smallmap_type.hpp:42
WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:68
WID_SA_DOWN
Move the sprite down.
Definition: newgrf_debug_widget.h:35
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:212
WID_NGRFI_MAINPANEL
Panel widget containing the actual data.
Definition: newgrf_debug_widget.h:22
IsInsideBS
static bool IsInsideBS(const T x, const uint base, const uint size)
Checks if a value is between a window started at some base point.
Definition: math_func.hpp:250
GetVehicleImageCellSize
VehicleCellSize GetVehicleImageCellSize(VehicleType type, EngineImageType image_type)
Get the GUI cell size for a vehicle image.
Definition: depot_gui.cpp:159
VehicleCellSize::height
uint height
Vehicle cell height.
Definition: vehicle_gui.h:72
GetInspectWindowNumber
static uint GetInspectWindowNumber(GrfSpecFeature feature, uint index)
Get the window number for the inspect window given a feature and index.
Definition: newgrf_debug_gui.cpp:69
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:147
SmallMap::Insert
bool Insert(const T &key, const U &data)
Adds new item to this map.
Definition: smallmap_type.hpp:122
WD_BEVEL_RIGHT
Width of right bevel border.
Definition: window_gui.h:57
WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:69
WID_SA_SPRITE
The actual sprite.
Definition: newgrf_debug_widget.h:36
NIT_CARGO
The property is a cargo.
Definition: newgrf_debug_gui.cpp:81
WID_SA_CAPTION
Caption of the window.
Definition: newgrf_debug_widget.h:28
fileio_func.h
Functions for Standard In/Out file operations.
FioGetFilename
const char * FioGetFilename(uint8 slot)
Get the filename associated with a slot.
Definition: fileio.cpp:78
NIFeature::helper
const NIHelper * helper
The class container all helper functions.
Definition: newgrf_debug_gui.cpp:236
NewGRFInspectWindow::OnQueryTextFinished
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Definition: newgrf_debug_gui.cpp:603
lastof
#define lastof(x)
Get the last element of an fixed size array.
Definition: depend.cpp:50
SmallVector< SpriteID, 256 >
MP_RAILWAY
A railway.
Definition: tile_type.h:44
textbuf_gui.h
Stuff related to the text buffer GUI.
ST_NORMAL
The most basic (normal) sprite.
Definition: gfx_type.h:298
MP_OBJECT
Contains objects such as transmitters and owned land.
Definition: tile_type.h:53
NICallback::read_size
byte read_size
The number of bytes (i.e. byte, word, dword etc) to read.
Definition: newgrf_debug_gui.cpp:101
NIFeature::callbacks
const NICallback * callbacks
The callbacks associated with this feature.
Definition: newgrf_debug_gui.cpp:234
INVALID_VEHICLE
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
Definition: vehicle_type.h:57
EIT_IN_DEPOT
Vehicle drawn in depot.
Definition: vehicle_type.h:89
IsLevelCrossing
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
Definition: road_map.h:68
max
static T max(const T a, const T b)
Returns the maximum of two values.
Definition: math_func.hpp:26
SpriteAlignerWindow::OnResize
virtual void OnResize()
Called after the window got resized.
Definition: newgrf_debug_gui.cpp:1022
WID_NGRFI_PARENT
Inspect the parent.
Definition: newgrf_debug_widget.h:18
NewGRFInspectWindow::caller_grfid
uint32 caller_grfid
GRFID of the caller of this window, 0 if it has no caller.
Definition: newgrf_debug_gui.cpp:285
SpecializedVehicle< Train, Type >::From
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Definition: vehicle_base.h:1113
GSF_INVALID
An invalid spec feature.
Definition: newgrf.h:91
SmallVector< SmallPair< T, U >, S >::End
const SmallPair< T, U > * End() const
Get the pointer behind the last valid item (const)
Definition: smallvec_type.hpp:292
vehicle_gui.h
Functions related to the vehicle&#39;s GUIs.
GetStationType
static StationType GetStationType(TileIndex t)
Get the station type of this tile.
Definition: station_map.h:45
GetFeatureHelper
static const NIHelper * GetFeatureHelper(uint window_number)
Get the NIHelper related to the window number.
Definition: newgrf_debug_gui.cpp:269
CargoSpec::name
StringID name
Name of this type of cargo.
Definition: cargotype.h:71
GetSpriteType
SpriteType GetSpriteType(SpriteID sprite)
Get the sprite type of a given sprite.
Definition: spritecache.cpp:135
window_gui.h
Functions, definitions and such used only by the GUI.
SpriteAlignerWindow::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: newgrf_debug_gui.cpp:1012
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:1480
newgrf_debug_widget.h
Types related to the newgrf debug widgets.
NICallback
Representation of the available callbacks with information on when they actually apply.
Definition: newgrf_debug_gui.cpp:98
DrawFrameRect
void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, FrameFlags flags)
Draw frame rectangle.
Definition: widget.cpp:177
NewGRFInspectWindow::OnResize
virtual void OnResize()
Called after the window got resized.
Definition: newgrf_debug_gui.cpp:611
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:670
SA_FORCE
Force the alignment, i.e. don&#39;t swap for RTL languages.
Definition: gfx_func.h:110
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:910
WC_SPRITE_ALIGNER
Sprite aligner (debug); Window numbers:
Definition: window_type.h:670
newgrf_object.h
Functions related to NewGRF objects.
Window
Data structure for an opened window.
Definition: window_gui.h:271
Vehicle::Move
Vehicle * Move(int n)
Get the vehicle at offset n of this vehicle chain.
Definition: vehicle_base.h:624
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:36
NIHelper::Resolve
virtual uint Resolve(uint index, uint var, uint param, bool *avail) const =0
Resolve (action2) variable for a given index.
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:1032
InvalidateNewGRFInspectWindow
void InvalidateNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Invalidate the inspect window for a given feature and index.
Definition: newgrf_debug_gui.cpp:718
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:1046
EIT_IN_DETAILS
Vehicle drawn in vehicle details, refit window, ...
Definition: vehicle_type.h:90
object_base.h
Base for all objects.
SetDParamStr
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
Definition: strings.cpp:279
NewGRFInspectWindow
Window used for inspecting NewGRFs.
Definition: newgrf_debug_gui.cpp:275
_nifeatures
static const NIFeature *const _nifeatures[]
Table with all NIFeatures.
Definition: newgrf_debug_data.h:531
VEH_AIRCRAFT
Aircraft vehicle type.
Definition: vehicle_type.h:27
GrfSpecFeature
GrfSpecFeature
Definition: newgrf.h:67
string_func.h
Functions related to low-level strings.
CS_NUMERAL
Only numeric ones.
Definition: string_type.h:28
newgrf_spritegroup.h
Action 2 handling.
NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:79
GetFeatureNum
static GrfSpecFeature GetFeatureNum(uint window_number)
Get the feature number related to the window number.
Definition: newgrf_debug_gui.cpp:247
Sprite::y_offs
int16 y_offs
Number of pixels to shift the sprite downwards.
Definition: spritecache.h:22
NIHelper::~NIHelper
virtual ~NIHelper()
Silence a warning.
Definition: newgrf_debug_gui.cpp:118
WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX) ...
Definition: widget_type.h:65
SmallVector::Length
uint Length() const
Get the number of items in the list.
Definition: smallvec_type.hpp:262
Scrollbar::GetScrolledRowFromWidget
int GetScrolledRowFromWidget(int clickpos, const Window *const w, int widget, int padding=0, int line_height=-1) const
Compute the row of a scrolled widget that a user clicked in.
Definition: widget.cpp:1959
NWidgetBase::pos_y
uint pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:178
NIHelper::SetStringParameters
virtual void SetStringParameters(uint index) const =0
Set the string parameters to write the right data for a STRINGn.
SmallPair
Simple pair of data.
Definition: smallmap_type.hpp:24
WID_SA_NEXT
Skip to the next sprite.
Definition: newgrf_debug_widget.h:31
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
WC_NEWGRF_INSPECT
NewGRF inspect (debug); Window numbers:
Definition: window_type.h:664
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:180
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
NewGRFInspectWindow::GetFeatureIndex
uint GetFeatureIndex() const
Get the feature index.
Definition: newgrf_debug_gui.cpp:328
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
SpriteAlignerWindow::XyOffs
SmallPair< int16, int16 > XyOffs
Pair for x and y offsets of the sprite before alignment. First value contains the x offset...
Definition: newgrf_debug_gui.cpp:809
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
WD_BEVEL_BOTTOM
Height of bottom bevel border.
Definition: window_gui.h:59
NewGRFInspectWindow::SetCallerGRFID
void SetCallerGRFID(uint32 grfid)
Set the GRFID of the item opening this window.
Definition: newgrf_debug_gui.cpp:309
safeguards.h
A number of safeguards to prevent using unsafe methods.
WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:50
NIHelper::SetObjectAtStringParameters
void SetObjectAtStringParameters(StringID string, uint32 index, TileIndex tile) const
Helper to make setting the strings easier for objects at a specific tile.
Definition: newgrf_debug_gui.cpp:221
GSF_FAKE_END
End of the fake features.
Definition: newgrf.h:89
NewGRFInspectWindow::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: newgrf_debug_gui.cpp:621
NIHelper::GetPSAFirstPosition
virtual const int32 * GetPSAFirstPosition(uint index, uint32 grfid) const
Gets the first position of the array containing the persistent storage.
Definition: newgrf_debug_gui.cpp:197
NIT_INT
The property is a simple integer.
Definition: newgrf_debug_gui.cpp:80
WID_SA_OFFSETS_REL
The sprite offsets (relative).
Definition: newgrf_debug_widget.h:38
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
NewGRFInspectWindow::chain_index
uint chain_index
For ground vehicles: Index in vehicle chain.
Definition: newgrf_debug_gui.cpp:288
NewGRFInspectWindow::UpdateWidgetSize
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Definition: newgrf_debug_gui.cpp:373
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:499
ShowNewGRFInspectWindow
void ShowNewGRFInspectWindow(GrfSpecFeature feature, uint index, const uint32 grfid)
Show the inspect window for a given feature and index.
Definition: newgrf_debug_gui.cpp:700
GetGrfSpecFeature
GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
Get the GrfSpecFeature associated with the tile.
Definition: newgrf_debug_gui.cpp:768
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
WID_SA_RIGHT
Move the sprite to the right.
Definition: newgrf_debug_widget.h:34
VEH_ROAD
Road vehicle type.
Definition: vehicle_type.h:25
NWidgetBase::resize_y
uint resize_y
Vertical resize step (0 means not resizable).
Definition: widget_type.h:167
WWT_MATRIX
Grid of rows and columns.
Definition: widget_type.h:59
min
static T min(const T a, const T b)
Returns the minimum of two values.
Definition: math_func.hpp:42
WID_SA_GOTO
Go to a given sprite.
Definition: newgrf_debug_widget.h:30
WC_LAND_INFO
Land info window; Window numbers:
Definition: window_type.h:145
NIHelper::GetInstance
virtual const void * GetInstance(uint index) const =0
Get the instance given an index.
WID_NGRFI_VEH_NEXT
Go to next vehicle in chain.
Definition: newgrf_debug_widget.h:20
NIHelper::GetSpec
virtual const void * GetSpec(uint index) const =0
Get (NewGRF) specs given an index.
NIFeature::properties
const NIProperty * properties
The properties associated with this feature.
Definition: newgrf_debug_gui.cpp:233
spritecache.h
Functions to cache sprites in memory.
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
RoadVehicle::GetDisplayImageWidth
int GetDisplayImageWidth(Point *offset=NULL) const
Get the width of a road vehicle image in the GUI.
Definition: roadveh_cmd.cpp:91
Vehicle::First
Vehicle * First() const
Get the first vehicle of this vehicle chain.
Definition: vehicle_base.h:595
newgrf_industrytiles.h
NewGRF handling of industry tiles.
WID_NGRFI_SCROLLBAR
Scrollbar.
Definition: newgrf_debug_widget.h:23
NIProperty::name
const char * name
A (human readable) name for the property.
Definition: newgrf_debug_gui.cpp:86
Train::GetDisplayImageWidth
int GetDisplayImageWidth(Point *offset=NULL) const
Get the width of a train vehicle image in the GUI.
Definition: train_cmd.cpp:455
FR_BORDERONLY
Draw border only, no background.
Definition: window_gui.h:30
newgrf_airporttiles.h
NewGRF handling of airport tiles.
NIFeature::variables
const NIVariable * variables
The variables associated with this feature.
Definition: newgrf_debug_gui.cpp:235
NIHelper::GetPSASize
virtual uint GetPSASize(uint index, uint32 grfid) const
Allows to know the size of the persistent storage.
Definition: newgrf_debug_gui.cpp:186
Sprite::height
uint16 height
Height of the sprite.
Definition: spritecache.h:19
SpriteAlignerWindow::SetStringParameters
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Definition: newgrf_debug_gui.cpp:825
VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
CBM_NO_BIT
static const int CBM_NO_BIT
Mask to show no bit needs to be enabled for the callback.
Definition: newgrf_debug_gui.cpp:106
WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:40
DeleteWindowById
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1137
GetMaxSpriteID
uint GetMaxSpriteID()
Get a reasonable (upper bound) estimate of the maximum SpriteID used in OpenTTD; there will be no spr...
Definition: spritecache.cpp:179
Sprite::width
uint16 width
Width of the sprite.
Definition: spritecache.h:20
SmallMap::Erase
void Erase(Pair *pair)
Removes given pair from this map.
Definition: smallmap_type.hpp:93
engine_base.h
Base class for engines.
SpriteAlignerWindow::current_sprite
SpriteID current_sprite
The currently shown sprite.
Definition: newgrf_debug_gui.cpp:811
newgrf_station.h
Header file for NewGRF stations.
NewGRFInspectWindow::HasVariableParameter
static bool HasVariableParameter(uint variable)
Check whether the given variable has a parameter.
Definition: newgrf_debug_gui.cpp:300
WD_BEVEL_TOP
Height of top bevel border.
Definition: window_gui.h:58
WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
vehicle_base.h
Base class for all vehicles.
SpriteAlignerWindow::DrawWidget
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: newgrf_debug_gui.cpp:870
GetFeatureIndex
static uint GetFeatureIndex(uint window_number)
Get the feature index related to the window number.
Definition: newgrf_debug_gui.cpp:57
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:19
NIHelper::PSAWithParameter
virtual bool PSAWithParameter() const
Used to decide if the PSA needs a parameter or not.
Definition: newgrf_debug_gui.cpp:175
StrEmpty
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
Definition: string_func.h:59
CargoSpec::Get
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Definition: cargotype.h:118
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
Vehicle::Next
Vehicle * Next() const
Get the next vehicle of this vehicle.
Definition: vehicle_base.h:582
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:52
NIHelper
Helper class to wrap some functionality/queries in.
Definition: newgrf_debug_gui.cpp:115
NIProperty::offset
ptrdiff_t offset
Offset of the variable in the class.
Definition: newgrf_debug_gui.cpp:87
SpriteAlignerWindow
Window used for aligning sprites.
Definition: newgrf_debug_gui.cpp:808
NWID_VERTICAL
Vertical container.
Definition: widget_type.h:77
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
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:34
zoom_func.h
Functions related to zooming.
INVALID_CARGO
static const byte INVALID_CARGO
Constant representing invalid cargo.
Definition: cargotype.h:53
MP_STATION
A tile of a station.
Definition: tile_type.h:48
NewGRFInspectWindow::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: newgrf_debug_gui.cpp:553
Sprite::x_offs
int16 x_offs
Number of pixels to shift the sprite to the right.
Definition: spritecache.h:21
NewGRFInspectWindow::HasChainIndex
bool HasChainIndex() const
Check whether this feature has chain index, i.e.
Definition: newgrf_debug_gui.cpp:318
WID_SA_PICKER
Sprite picker.
Definition: newgrf_debug_widget.h:39
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:28
WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:106
Scrollbar::GetCapacity
uint16 GetCapacity() const
Gets the number of visible elements of the scrollbar.
Definition: widget_type.h:622
NewGrfDebugSpritePicker
Spritepicker of SpriteAligner.
Definition: newgrf_debug.h:28
industry.h
Base of all industries.
WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
NIProperty
Representation of the data from a NewGRF property.
Definition: newgrf_debug_gui.cpp:85
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:105
NewGRFInspectWindow::ValidateChainIndex
void ValidateChainIndex()
Ensure that this->chain_index is in range.
Definition: newgrf_debug_gui.cpp:343
town.h
Base of the town class.
newgrf_debug_data.h
Data &#39;tables&#39; for NewGRF debugging.
newgrf_town.h
Functions to handle the town part of NewGRF towns.
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:695
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:1973
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:40
NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:84
MP_HOUSE
A house by a town.
Definition: tile_type.h:46
TD_RTL
Text is written right-to-left by default.
Definition: strings_type.h:26
SA_RIGHT
Right align the text (must be a single bit).
Definition: gfx_func.h:100
WID_SA_LIST
Queried sprite list.
Definition: newgrf_debug_widget.h:40
BSWAP32
static uint32 BSWAP32(uint32 x)
Perform a 32 bits endianness bitswap on x.
Definition: bitmath_func.hpp:380
window_func.h
Window functions not directly related to making/drawing windows.
WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
NIProperty::prop
byte prop
The number of the property.
Definition: newgrf_debug_gui.cpp:89
NewGrfDebugSpritePicker::sprites
SmallVector< SpriteID, 256 > sprites
Sprites found.
Definition: newgrf_debug.h:32
station_base.h
Base classes/functions for stations.
WID_SA_OFFSETS_ABS
The sprite offsets (absolute).
Definition: newgrf_debug_widget.h:37
SpriteAlignerWindow::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: newgrf_debug_gui.cpp:911
NewGRFInspectWindow::DrawWidget
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Definition: newgrf_debug_gui.cpp:413
NIFeature
Container for all information for a given feature.
Definition: newgrf_debug_gui.cpp:232
GetFeature
static const NIFeature * GetFeature(uint window_number)
Get the NIFeature related to the window number.
Definition: newgrf_debug_gui.cpp:257
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1095
NewGRFInspectWindow::var60params
static uint32 var60params[GSF_FAKE_END][0x20]
The value for the variable 60 parameters.
Definition: newgrf_debug_gui.cpp:282
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:34
NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:429
WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
NewGrfDebugSpritePicker::mode
NewGrfDebugSpritePickerMode mode
Current state.
Definition: newgrf_debug.h:29
WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:64
NWID_HORIZONTAL_LTR
Horizontal container that doesn&#39;t change the order of the widgets for RTL languages.
Definition: widget_type.h:76
IsNewGRFInspectable
bool IsNewGRFInspectable(GrfSpecFeature feature, uint index)
Can we inspect the data given a certain feature and index.
Definition: newgrf_debug_gui.cpp:756
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:833
ShowSpriteAlignerWindow
void ShowSpriteAlignerWindow()
Show the window for aligning sprites.
Definition: newgrf_debug_gui.cpp:1096
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1076
NewGRFInspectWindow::SetStringParameters
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Definition: newgrf_debug_gui.cpp:366
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition: window.cpp:3220
SpriteAlignerWindow::UpdateWidgetSize
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Definition: newgrf_debug_gui.cpp:859
MarkWholeScreenDirty
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
Definition: gfx.cpp:1461
WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:55
Scrollbar::GetPosition
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:631
VEH_TRAIN
Train vehicle type.
Definition: vehicle_type.h:24
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:201