45 #include "table/strings.h" 
   59   return GB(window_number, 0, 24);
 
   71   assert((index >> 24) == 0);
 
   72   return (feature << 24) | index;
 
  132   virtual uint 
GetParent(uint index) 
const = 0;
 
  139   virtual const void *
GetInstance(uint index) 
const = 0;
 
  146   virtual const void *
GetSpec(uint index) 
const = 0;
 
  159   virtual uint32 
GetGRFID(uint index) 
const = 0;
 
  169   virtual uint 
Resolve(uint index, uint var, uint param, 
bool *avail) 
const = 0;
 
  223     SetDParam(0, STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT);
 
  321     return f == GSF_TRAINS || f == GSF_ROADVEHICLES;
 
  335       if (v != NULL) index = v->
index;
 
  403     va_start(va, format);
 
  408     if (offset < 0 || offset >= this->vscroll->
GetCapacity()) 
return;
 
  422           if (u == v) sel_start = total_width;
 
  426             default: NOT_REACHED();
 
  428           if (u == v) sel_end = total_width;
 
  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);
 
  440         int y = (r.top + r.bottom - h) / 2;
 
  459     const void *base_spec = nih->
GetSpec(index);
 
  467         uint value = nih->
Resolve(index, niv->var, param, &avail);
 
  469         if (!avail) 
continue;
 
  472           this->
DrawString(r, i++, 
"  %02x[%02x]: %08x (%s)", niv->var, param, value, niv->name);
 
  474           this->
DrawString(r, i++, 
"  %02x: %08x (%s)", niv->var, value, niv->name);
 
  481     if (psa_size != 0 && psa != NULL) {
 
  485         this->
DrawString(r, i++, 
"Persistent storage:");
 
  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]);
 
  496         const void *ptr = (
const byte *)base + nip->offset;
 
  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();
 
  509             string = STR_JUST_INT;
 
  521         GetString(buffer, 
string, 
lastof(buffer));
 
  522         this->
DrawString(r, i++, 
"  %02x: %s (%s)", nip->prop, buffer, nip->name);
 
  529         if (nic->cb_bit != CBM_NO_BIT) {
 
  530           const void *ptr = (
const byte *)base_spec + nic->offset;
 
  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();
 
  539           if (!
HasBit(value, nic->cb_bit)) 
continue;
 
  540           this->
DrawString(r, i++, 
"  %03x: %s", nic->cb_id, nic->name);
 
  542           this->
DrawString(r, i++, 
"  %03x: %s (unmasked)", nic->cb_id, nic->name);
 
  553   virtual void OnClick(
Point pt, 
int widget, 
int click_count)
 
  574           if (v != NULL && v->
Next() != NULL) {
 
  588         if (line == INT_MAX) 
return;
 
  592           if (line != 1) 
continue; 
 
  623     if (!gui_scope) 
return;
 
  635 static const NWidgetPart _nested_newgrf_inspect_chain_widgets[] = {
 
  659 static const NWidgetPart _nested_newgrf_inspect_widgets[] = {
 
  678   WDP_AUTO, 
"newgrf_inspect_chain", 400, 300,
 
  681   _nested_newgrf_inspect_chain_widgets, 
lengthof(_nested_newgrf_inspect_chain_widgets)
 
  685   WDP_AUTO, 
"newgrf_inspect", 400, 300,
 
  688   _nested_newgrf_inspect_widgets, 
lengthof(_nested_newgrf_inspect_widgets)
 
  705   WindowDesc *desc = (feature == GSF_TRAINS || feature == GSF_ROADVEHICLES) ? &_newgrf_inspect_chain_desc : &_newgrf_inspect_desc;
 
  759   if (nif == NULL) 
return false;
 
  780         case STATION_RAIL:    
return GSF_STATIONS;
 
  781         case STATION_AIRPORT: 
return GSF_AIRPORTTILES;
 
  796     case VEH_ROAD:     
return GSF_ROADVEHICLES;
 
  867     size->height = (1 + 200 / resize->height) * resize->height;
 
  894         const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
 
  934         _newgrf_debug_sprite_picker.
mode = SPM_WAIT_CLICK;
 
  939         const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
 
 1014     if (!gui_scope) 
return;
 
 1028 static const NWidgetPart _nested_sprite_aligner_widgets[] = {
 
 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),
 
 1078           NWidget(
WWT_MATRIX, COLOUR_GREY, 
WID_SA_LIST), 
SetResize(1, 1), 
SetMatrixDataTip(1, 0, STR_NULL), 
SetFill(1, 1), 
SetScrollbar(
WID_SA_SCROLLBAR),
 
 1087   WDP_AUTO, 
"sprite_aligner", 400, 300,
 
 1090   _nested_sprite_aligner_widgets, 
lengthof(_nested_sprite_aligner_widgets)
 
 1098   AllocateWindowDescFront<SpriteAlignerWindow>(&_sprite_aligner_desc, 0);