Platform- and/or Interface-Specific Fixes
-----------------------------------------
win32tty: fix visible CRLF characters during lockfile error message
+win32gui: you couldn't specify an alignment in defaults.nh and have it stick
General New Features
return FALSE;
}
+void setComboBoxValue(HWND hWnd, int combo_box, int value)
+{
+ int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
+ int index;
+ int value_to_set = LB_ERR;
+ for (index = 0; index < index_max; index++) {
+ if (SendDlgItemMessage(hWnd, combo_box, CB_GETITEMDATA, (WPARAM)index, 0) == value) {
+ value_to_set = index;
+ break;
+ }
+ }
+ SendDlgItemMessage(hWnd, combo_box, CB_SETCURSEL, (WPARAM)value_to_set, 0);
+}
+
/* initialize player selector dialog */
void plselInitDialog(HWND hWnd)
{
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_SETCURSEL, (WPARAM)flags.initrole, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_ROLE_LIST, flags.initrole);
}
/* intialize races list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_SETCURSEL, (WPARAM)flags.initrace, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_RACE_LIST, flags.initrace);
}
/* intialize genders list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_SETCURSEL, (WPARAM)flags.initgend, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_GENDER_LIST, flags.initgend);
}
/* intialize alignments list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_SETCURSEL, (WPARAM)flags.initalign, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_ALIGN_LIST, flags.initalign);
}
}
return FALSE;
}
+void setComboBoxValue(HWND hWnd, int combo_box, int value)
+{
+ int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
+ int index;
+ int value_to_set = LB_ERR;
+ for (index = 0; index < index_max; index++) {
+ if (SendDlgItemMessage(hWnd, combo_box, CB_GETITEMDATA, (WPARAM)index, 0) == value) {
+ value_to_set = index;
+ break;
+ }
+ }
+ SendDlgItemMessage(hWnd, combo_box, CB_SETCURSEL, (WPARAM)value_to_set, 0);
+}
+
/* initialize player selector dialog */
void plselInitDialog(HWND hWnd)
{
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ROLE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ROLE_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_SETCURSEL, (WPARAM)flags.initrole, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_ROLE_LIST, flags.initrole);
}
/* intialize races list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_RACE_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_RACE_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_SETCURSEL, (WPARAM)flags.initrace, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_RACE_LIST, flags.initrace);
}
/* intialize genders list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_GENDER_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_GENDER_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_SETCURSEL, (WPARAM)flags.initgend, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_GENDER_LIST, flags.initgend);
}
/* intialize alignments list */
} else {
CheckDlgButton(hWnd, IDC_PLSEL_ALIGN_RANDOM, BST_UNCHECKED);
EnableWindow(GetDlgItem(hWnd, IDC_PLSEL_ALIGN_LIST), TRUE);
- SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_SETCURSEL, (WPARAM)flags.initalign, 0);
+ setComboBoxValue(hWnd, IDC_PLSEL_ALIGN_LIST, flags.initalign);
}
}