win32_gui: gettting x64 build to work
This commit is contained in:
+35
-34
@@ -19,7 +19,7 @@ struct getlin_data {
|
||||
size_t result_size;
|
||||
};
|
||||
|
||||
BOOL CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int mswin_getlin_window (
|
||||
const char *question,
|
||||
@@ -27,7 +27,7 @@ int mswin_getlin_window (
|
||||
size_t result_size
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
INT_PTR ret;
|
||||
struct getlin_data data;
|
||||
|
||||
/* initilize dialog data */
|
||||
@@ -46,10 +46,10 @@ int mswin_getlin_window (
|
||||
);
|
||||
if( ret==-1 ) panic("Cannot create getlin window");
|
||||
|
||||
return ret;
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
INT_PTR CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
struct getlin_data* data;
|
||||
RECT main_rt, dlg_rt;
|
||||
@@ -69,7 +69,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
case WM_INITDIALOG:
|
||||
data = (struct getlin_data*)lParam;
|
||||
SetWindowText(hWnd, NH_A2W(data->question, wbuf, sizeof(wbuf)));
|
||||
SetWindowLong(hWnd, GWL_USERDATA, lParam);
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
|
||||
|
||||
/* center dialog in the main window */
|
||||
GetWindowRect(hWnd, &dlg_rt);
|
||||
@@ -143,7 +143,7 @@ BOOL CALLBACK GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
{
|
||||
/* OK button was pressed */
|
||||
case IDOK:
|
||||
data = (struct getlin_data*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
data = (struct getlin_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
SendDlgItemMessage(hWnd, IDC_GETLIN_EDIT, WM_GETTEXT, (WPARAM)sizeof(wbuf), (LPARAM)wbuf );
|
||||
NH_W2A(wbuf, data->result, data->result_size);
|
||||
|
||||
@@ -167,11 +167,11 @@ struct extcmd_data {
|
||||
int* selection;
|
||||
};
|
||||
|
||||
BOOL CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK ExtCmdDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int mswin_ext_cmd_window (int* selection)
|
||||
{
|
||||
int ret;
|
||||
INT_PTR ret;
|
||||
struct extcmd_data data;
|
||||
|
||||
/* init dialog data */
|
||||
@@ -188,23 +188,22 @@ int mswin_ext_cmd_window (int* selection)
|
||||
(LPARAM)&data
|
||||
);
|
||||
if( ret==-1 ) panic("Cannot create extcmd window");
|
||||
return ret;
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
INT_PTR CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
struct extcmd_data* data;
|
||||
RECT main_rt, dlg_rt;
|
||||
SIZE dlg_sz;
|
||||
int i;
|
||||
const char *ptr;
|
||||
TCHAR wbuf[255];
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
data = (struct extcmd_data*)lParam;
|
||||
SetWindowLong(hWnd, GWL_USERDATA, lParam);
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
|
||||
|
||||
/* center dialog in the main window */
|
||||
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
|
||||
@@ -224,8 +223,8 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
TRUE );
|
||||
|
||||
/* fill combobox with extended commands */
|
||||
for(i=0; (ptr=extcmdlist[i].ef_txt); i++) {
|
||||
SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(ptr, wbuf, sizeof(wbuf)) );
|
||||
for(i=0; extcmdlist[i].ef_txt; i++) {
|
||||
SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_ADDSTRING, (WPARAM)0, (LPARAM)NH_A2W(extcmdlist[i].ef_txt, wbuf, sizeof(wbuf)) );
|
||||
}
|
||||
|
||||
/* set focus to the list control */
|
||||
@@ -236,12 +235,12 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
data = (struct extcmd_data*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
data = (struct extcmd_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
/* OK button ws clicked */
|
||||
case IDOK:
|
||||
*data->selection = SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
|
||||
*data->selection = (int)SendDlgItemMessage(hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM)0, (LPARAM)0 );
|
||||
if( *data->selection==LB_ERR )
|
||||
*data->selection = -1;
|
||||
/* Fall through. */
|
||||
@@ -263,7 +262,7 @@ BOOL CALLBACK ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
lParam
|
||||
Handle to the list box
|
||||
*/
|
||||
*data->selection = SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||
*data->selection = (int)SendMessage((HWND)lParam, LB_GETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||
if( *data->selection==LB_ERR )
|
||||
*data->selection = -1;
|
||||
EndDialog(hWnd, IDOK);
|
||||
@@ -281,14 +280,14 @@ struct plsel_data {
|
||||
int* selection;
|
||||
};
|
||||
|
||||
BOOL CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK PlayerSelectorDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
static void plselInitDialog(HWND hWnd);
|
||||
static void plselAdjustLists(HWND hWnd, int changed_opt);
|
||||
static int plselFinalSelection(HWND hWnd, int* selection);
|
||||
|
||||
int mswin_player_selection_window ( int* selection )
|
||||
{
|
||||
int ret;
|
||||
INT_PTR ret;
|
||||
struct plsel_data data;
|
||||
|
||||
/* init dialog data */
|
||||
@@ -305,10 +304,10 @@ int mswin_player_selection_window ( int* selection )
|
||||
);
|
||||
if( ret==-1 ) panic("Cannot create getlin window");
|
||||
|
||||
return ret;
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
INT_PTR CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
struct plsel_data* data;
|
||||
RECT main_rt, dlg_rt;
|
||||
@@ -318,7 +317,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
data = (struct plsel_data*)lParam;
|
||||
SetWindowLong(hWnd, GWL_USERDATA, lParam);
|
||||
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
|
||||
|
||||
/* center dialog in the main window */
|
||||
GetWindowRect(GetNHApp()->hMainWnd, &main_rt);
|
||||
@@ -348,7 +347,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
data = (struct plsel_data*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
data = (struct plsel_data*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||
switch (LOWORD(wParam)) {
|
||||
|
||||
/* OK button was clicked */
|
||||
@@ -442,7 +441,7 @@ BOOL CALLBACK PlayerSelectorDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
||||
|
||||
void setComboBoxValue(HWND hWnd, int combo_box, int value)
|
||||
{
|
||||
int index_max = SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
|
||||
int index_max = (int)SendDlgItemMessage(hWnd, combo_box, CB_GETCOUNT, 0, 0);
|
||||
int index;
|
||||
int value_to_set = LB_ERR;
|
||||
for (index = 0; index < index_max; index++) {
|
||||
@@ -531,7 +530,7 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
|
||||
HWND control_role, control_race, control_gender, control_align;
|
||||
int initrole, initrace, initgend, initalign;
|
||||
int i;
|
||||
int ind;
|
||||
LRESULT ind;
|
||||
int valid_opt;
|
||||
TCHAR wbuf[255];
|
||||
|
||||
@@ -543,16 +542,16 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
|
||||
|
||||
/* get current selections */
|
||||
ind = SendMessage(control_role, CB_GETCURSEL, 0, 0);
|
||||
initrole = (ind==LB_ERR)? flags.initrole : SendMessage(control_role, CB_GETITEMDATA, ind, 0);
|
||||
initrole = (ind==LB_ERR)? flags.initrole : (int)SendMessage(control_role, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_race, CB_GETCURSEL, 0, 0);
|
||||
initrace = (ind==LB_ERR)? flags.initrace : SendMessage(control_race, CB_GETITEMDATA, ind, 0);
|
||||
initrace = (ind==LB_ERR)? flags.initrace : (int)SendMessage(control_race, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_gender, CB_GETCURSEL, 0, 0);
|
||||
initgend = (ind==LB_ERR)? flags.initgend : SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
|
||||
initgend = (ind==LB_ERR)? flags.initgend : (int)SendMessage(control_gender, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
ind = SendMessage(control_align, CB_GETCURSEL, 0, 0);
|
||||
initalign = (ind==LB_ERR)? flags.initalign : SendMessage(control_align, CB_GETITEMDATA, ind, 0);
|
||||
initalign = (ind==LB_ERR)? flags.initalign : (int)SendMessage(control_align, CB_GETITEMDATA, ind, 0);
|
||||
|
||||
/* intialize roles list */
|
||||
if( changed_sel==-1 ) {
|
||||
@@ -672,35 +671,37 @@ void plselAdjustLists(HWND hWnd, int changed_sel)
|
||||
/* player made up his mind - get final selection here */
|
||||
int plselFinalSelection(HWND hWnd, int* selection)
|
||||
{
|
||||
int ind;
|
||||
UNREFERENCED_PARAMETER(selection);
|
||||
|
||||
LRESULT ind;
|
||||
|
||||
/* get current selections */
|
||||
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
|
||||
flags.initrole = ROLE_RANDOM;
|
||||
} else {
|
||||
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETCURSEL, 0, 0);
|
||||
flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
|
||||
flags.initrole = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ROLE_LIST, CB_GETITEMDATA, ind, 0);
|
||||
}
|
||||
|
||||
if( SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
|
||||
flags.initrace = ROLE_RANDOM;
|
||||
} else {
|
||||
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETCURSEL, 0, 0);
|
||||
flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
|
||||
flags.initrace = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_RACE_LIST, CB_GETITEMDATA, ind, 0);
|
||||
}
|
||||
|
||||
if( SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
|
||||
flags.initgend = ROLE_RANDOM;
|
||||
} else {
|
||||
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETCURSEL, 0, 0);
|
||||
flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
|
||||
flags.initgend = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_GENDER_LIST, CB_GETITEMDATA, ind, 0);
|
||||
}
|
||||
|
||||
if( SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_RANDOM, BM_GETCHECK, 0, 0)==BST_CHECKED ) {
|
||||
flags.initalign = ROLE_RANDOM;
|
||||
} else {
|
||||
ind = SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETCURSEL, 0, 0);
|
||||
flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
|
||||
flags.initalign = (ind==LB_ERR)? ROLE_RANDOM : (int)SendDlgItemMessage(hWnd, IDC_PLSEL_ALIGN_LIST, CB_GETITEMDATA, ind, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user