1
0
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
SamuXarick fb2c48ffaa
Merge 57cea4e98c into 009b7cbc57 2025-07-27 15:05:56 +00:00
Peter Nelson 009b7cbc57
Fix #14480: Music player playlist buttons are clickable but non-operational in intro menu. (#14482)
In the intro menu the music is hardcoded to be the introduction track. Therefore, prevent these buttons being clickable.
2025-07-27 16:03:47 +01:00
SamuXarick 57cea4e98c Add: [Script] Auto-convert ObjectType bool to integer when setting values for items in lists via [] 2025-05-29 22:35:20 +01:00
2 changed files with 29 additions and 12 deletions

View File

@ -683,13 +683,16 @@ struct MusicWindow : public Window {
void UpdateDisabledButtons()
{
/* Disable music control widgets if there is no music
* -- except Programme button! So you can still select a music set. */
/* Disable stop and play if there is no music. */
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(
BaseMusic::GetUsedSet()->num_available == 0,
WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE,
BaseMusic::GetUsedSet()->num_available == 0 || _game_mode == GM_MENU,
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
);
/* 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

View File

@ -858,18 +858,32 @@ SQInteger ScriptList::_get(HSQUIRRELVM vm)
SQInteger ScriptList::_set(HSQUIRRELVM vm)
{
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
return sq_throwerror(vm, "you can only assign integers to this list");
}
SQInteger idx, val;
SQInteger idx;
sq_getinteger(vm, 2, &idx);
if (sq_gettype(vm, 3) == OT_NULL) {
this->RemoveItem(idx);
return 0;
/* 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");
}
sq_getinteger(vm, 3, &val);
if (!this->HasItem(idx)) {
this->AddItem(idx, val);
return 0;