win32gui: prevent male valkyrie (from <Someone>)
>Steps to reproduce problem: >1) make sure you don't have race, role, gender specified in your > defaults.h, then add > OPTIONS=role:Valkyrie,race:Human,gender:male,align:lawful >2) start a new nethackw.exe game >3) Uncheck "Random" from gender box, now you can select from male > or female, not only female. >4) Select male and click OK. >5) When game begins press shift+O (Options) and look to gender. > Your valkyrie is male. defaults.nh values were not used the dialog initialization. That's why both male/female options were available for Valkyries. This is now fixed. Also added: checking for consistency of the initial settings and resetting all incompatible values to ROLE_NONE.
This commit is contained in:
@@ -90,6 +90,7 @@ unix: Makefile.utl would put OBJDIR objects in the wrong directory
|
||||
vms: create an empty paniclog file during playground installation
|
||||
win32tty: add subkeyvalue option to alter key values; Finnish keyboard fix
|
||||
win32tty: distinguish between black/gray/white (by Quietust)
|
||||
win32gui: prevent male Valkyrie and other incorrect startup settings
|
||||
tiles: high priest tile had a couple bad pixels
|
||||
tiles: bad pixels in Croesus and Yeenoghu tiles
|
||||
FreeBSD: incorrect srandom declaration
|
||||
|
||||
@@ -446,6 +446,22 @@ void plselInitDialog(HWND hWnd)
|
||||
/* set player name */
|
||||
SetDlgItemText(hWnd, IDC_PLSEL_NAME, NH_A2W(plname, wbuf, sizeof(wbuf)));
|
||||
|
||||
/* check flags for consistency */
|
||||
if( flags.initrole>=0 ) {
|
||||
if (flags.initrace>=0 && !validrace(flags.initrole, flags.initrace)) {
|
||||
flags.initrace = ROLE_NONE;
|
||||
}
|
||||
|
||||
if (flags.initgend>=0 && !validgend(flags.initrole, flags.initrace, flags.initgend)) {
|
||||
flags.initgend = ROLE_NONE;
|
||||
}
|
||||
|
||||
if (flags.initalign>=0 && !validalign(flags.initrole, flags.initrace, flags.initalign)) {
|
||||
flags.initalign = ROLE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/* populate select boxes */
|
||||
plselAdjustLists(hWnd, -1);
|
||||
|
||||
/* intialize roles list */
|
||||
@@ -511,16 +527,16 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
|
||||
|
||||
/* get current selections */
|
||||
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
|
||||
initrole = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
|
||||
initrole = (ind==LB_ERR)? flags.initrole : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
|
||||
initrace = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
|
||||
initrace = (ind==LB_ERR)? flags.initrace : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
|
||||
initgend = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
|
||||
initgend = (ind==LB_ERR)? flags.initgend : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
|
||||
initalign = (ind==LB_ERR)? ROLE_NONE : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
|
||||
initalign = (ind==LB_ERR)? flags.initalign : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
/* intialize roles list */
|
||||
if( changed_sel==-1 ) {
|
||||
@@ -598,6 +614,7 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
|
||||
SendMessage(control_gender, CB_SETITEMDATA, (WPARAM)ind, (LPARAM)i );
|
||||
if( i==initgend ) {
|
||||
SendMessage(control_gender, CB_SETCURSEL, (WPARAM)ind, (LPARAM)0 );
|
||||
valid_opt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user