mirror of https://github.com/OpenTTD/OpenTTD
Compare commits
3 Commits
d28137bdd6
...
fb2c48ffaa
Author | SHA1 | Date |
---|---|---|
|
fb2c48ffaa | |
|
009b7cbc57 | |
|
57cea4e98c |
|
@ -683,13 +683,16 @@ struct MusicWindow : public Window {
|
||||||
|
|
||||||
void UpdateDisabledButtons()
|
void UpdateDisabledButtons()
|
||||||
{
|
{
|
||||||
/* Disable music control widgets if there is no music
|
/* Disable stop and play if there is no music. */
|
||||||
* -- except Programme button! So you can still select a music set. */
|
this->SetWidgetsDisabledState(BaseMusic::GetUsedSet()->num_available == 0, WID_M_STOP, WID_M_PLAY);
|
||||||
|
/* Disable most music control widgets if there is no music, or we are in the intro menu. */
|
||||||
this->SetWidgetsDisabledState(
|
this->SetWidgetsDisabledState(
|
||||||
BaseMusic::GetUsedSet()->num_available == 0,
|
BaseMusic::GetUsedSet()->num_available == 0 || _game_mode == GM_MENU,
|
||||||
WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE,
|
WID_M_PREV, WID_M_NEXT, WID_M_SHUFFLE,
|
||||||
WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2
|
WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2
|
||||||
);
|
);
|
||||||
|
/* Also disable programme button in the intro menu (not in game; it is desirable to allow change of music set.) */
|
||||||
|
this->SetWidgetsDisabledState(_game_mode == GM_MENU, WID_M_PROGRAMME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||||
|
|
|
@ -858,18 +858,32 @@ SQInteger ScriptList::_get(HSQUIRRELVM vm)
|
||||||
SQInteger ScriptList::_set(HSQUIRRELVM vm)
|
SQInteger ScriptList::_set(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
|
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
|
||||||
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
|
|
||||||
|
SQInteger idx;
|
||||||
|
sq_getinteger(vm, 2, &idx);
|
||||||
|
|
||||||
|
/* Retrieve the return value */
|
||||||
|
SQInteger val;
|
||||||
|
switch (sq_gettype(vm, 3)) {
|
||||||
|
case OT_NULL:
|
||||||
|
this->RemoveItem(idx);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case OT_BOOL: {
|
||||||
|
SQBool v;
|
||||||
|
sq_getbool(vm, 3, &v);
|
||||||
|
val = v ? 1 : 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case OT_INTEGER:
|
||||||
|
sq_getinteger(vm, 3, &val);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
return sq_throwerror(vm, "you can only assign integers to this list");
|
return sq_throwerror(vm, "you can only assign integers to this list");
|
||||||
}
|
}
|
||||||
|
|
||||||
SQInteger idx, val;
|
|
||||||
sq_getinteger(vm, 2, &idx);
|
|
||||||
if (sq_gettype(vm, 3) == OT_NULL) {
|
|
||||||
this->RemoveItem(idx);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sq_getinteger(vm, 3, &val);
|
|
||||||
if (!this->HasItem(idx)) {
|
if (!this->HasItem(idx)) {
|
||||||
this->AddItem(idx, val);
|
this->AddItem(idx, val);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue