mirror of https://github.com/OpenTTD/OpenTTD
(svn r25985) [1.3] -Backport from trunk:
- Fix: Lower sprite and text at the vehicle bar if it is pressed [FS#5739] (r25804) - Fix: Draw start/stop graphics of the vehicle bar at the right place in RTL mode [FS#5738] (r25803) - Fix: [Script] Decoding JSON data with an empty array from Admin port failed (r25809) - Fix: [NewGRF] Do not allow changing palette when it's set by the NewGRF (r25794, r25793, r25972)release/1.3
parent
95569e444b
commit
f2cd6d20be
|
@ -119,9 +119,9 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint right, uint
|
|||
|
||||
/* Draw the palette of the NewGRF */
|
||||
if (c->palette & GRFP_BLT_32BPP) {
|
||||
SetDParamStr(0, (c->palette & GRFP_USE_WINDOWS) ? "Windows / 32 bpp" : "DOS / 32 bpp");
|
||||
SetDParamStr(0, (c->palette & GRFP_USE_WINDOWS) ? "Legacy (W) / 32 bpp" : "Default (D) / 32 bpp");
|
||||
} else {
|
||||
SetDParamStr(0, (c->palette & GRFP_USE_WINDOWS) ? "Windows" : "DOS");
|
||||
SetDParamStr(0, (c->palette & GRFP_USE_WINDOWS) ? "Legacy (W)" : "Default (D)");
|
||||
}
|
||||
y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_PALETTE);
|
||||
}
|
||||
|
@ -1200,7 +1200,8 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
|
|||
|
||||
this->SetWidgetDisabledState(WID_NS_SET_PARAMETERS, !this->show_params || this->active_sel == NULL || this->active_sel->num_valid_params == 0);
|
||||
this->SetWidgetDisabledState(WID_NS_VIEW_PARAMETERS, !this->show_params || this->active_sel == NULL || this->active_sel->num_valid_params == 0);
|
||||
this->SetWidgetDisabledState(WID_NS_TOGGLE_PALETTE, disable_all);
|
||||
this->SetWidgetDisabledState(WID_NS_TOGGLE_PALETTE, disable_all ||
|
||||
(!(_settings_client.gui.newgrf_developer_tools || _settings_client.gui.scenario_developer) && ((c->palette & GRFP_GRF_MASK) != GRFP_GRF_UNSET)));
|
||||
|
||||
if (!disable_all) {
|
||||
/* All widgets are now enabled, so disable widgets we can't use */
|
||||
|
|
|
@ -244,6 +244,14 @@ char *ScriptEventAdminPort::ReadValue(HSQUIRRELVM vm, char *p)
|
|||
/* Array */
|
||||
sq_newarray(vm, 0);
|
||||
|
||||
/* Empty array? */
|
||||
char *p2 = p+1;
|
||||
SKIP_EMPTY(p2);
|
||||
if (*p2 == ']') {
|
||||
p = p2+1;
|
||||
break;
|
||||
}
|
||||
|
||||
while (*p++ != ']') {
|
||||
p = this->ReadValue(vm, p);
|
||||
if (p == NULL) {
|
||||
|
|
|
@ -2523,9 +2523,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/* draw the flag plus orders */
|
||||
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP);
|
||||
DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER);
|
||||
/* Draw the flag plus orders. */
|
||||
bool rtl = (_current_text_dir == TD_RTL);
|
||||
uint text_offset = max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).width, GetSpriteSize(SPR_FLAG_VEH_RUNNING).width) + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT;
|
||||
int text_left = r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : text_offset);
|
||||
int text_right = r.right - (rtl ? text_offset : (uint)WD_FRAMERECT_RIGHT);
|
||||
int image_left = (rtl ? text_right + 1 : r.left) + WD_IMGBTN_LEFT;
|
||||
int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING;
|
||||
int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0;
|
||||
DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered);
|
||||
DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
|
|
Loading…
Reference in New Issue