From 8c7aab42470fe7cb7eec819cbf76783db8c76f27 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 22 Nov 2009 18:02:26 +0000 Subject: [PATCH] Add error message for relay/comms protocol version mismatch; remove ability to edit relay address and port by default. --- xwords4/wince/Makefile | 10 +++++++--- xwords4/wince/cecondlg.c | 16 +++++++++++----- xwords4/wince/l10n/xwords4_catalan.rc | 9 +++++++++ xwords4/wince/l10n/xwords4_english.rc | 11 ++++++++++- xwords4/wince/l10n/xwords4_french.rc | 10 +++++++++- xwords4/wince/l10n/xwords4_polish.rc | 9 +++++++++ xwords4/wince/resource.h | 10 +++++----- xwords4/wince/strids.h | 3 ++- 8 files changed, 62 insertions(+), 16 deletions(-) diff --git a/xwords4/wince/Makefile b/xwords4/wince/Makefile index 8e81160e4..efcef1bd5 100644 --- a/xwords4/wince/Makefile +++ b/xwords4/wince/Makefile @@ -23,6 +23,7 @@ PLATFORM = wince TARGET_OS ?= win32 RELAY_NAME_DEFAULT ?= eehouse.org +RELAY_PORT_DEFAULT ?= 10999 NATIVE_CC = gcc STRIDS = strids @@ -55,7 +56,7 @@ HAVE_COMMCTRL = 1 ifeq ($(TARGET_OS),wince) #SMS = -DXWFEATURE_SMS -RELAY = -DXWFEATURE_RELAY -DCOMMS_HEARTBEAT -DUSE_BUFQUEUE +RELAY = -DXWFEATURE_RELAY -DCOMMS_HEARTBEAT -DRELAY_NOEDIT_ADDR # IPDIRECT = -DXWFEATURE_IP_DIRECT # BLUETOOTH = -DXWFEATURE_BLUETOOTH CC = ${CE_ARCH}-gcc @@ -90,7 +91,7 @@ ifeq ($(TARGET_OS),win32) STANDALONE = -DPREV_WAS_STANDALONE_ONLY #BLUETOOTH = -DXWFEATURE_BLUETOOTH #SMS = -DXWFEATURE_SMS -RELAY = -DXWFEATURE_RELAY -DUSE_BUFQUEUE +RELAY = -DXWFEATURE_RELAY -DRELAY_NOEDIT_ADDR # IPDIRECT = -DXWFEATURE_IP_DIRECT CC = i586-mingw32msvc-gcc WINDRES = i586-mingw32msvc-windres @@ -109,7 +110,7 @@ CFLAGS += -DARM -I./ -I../common -I../relay CFLAGS += -Wall -Wunused-parameter CFLAGS += $(BLUETOOTH) $(RELAY) $(SMS) $(IPDIRECT) $(STANDALONE) $(COLOR_SEL) \ - $(CHOOSE_FONTS) $(NO_DRAW) + $(CHOOSE_FONTS) $(NO_DRAW) -DUSE_BUFQUEUE SVNDEF = -DSVN_REV='\"$(SVNREV)\"' CFLAGS += $(SVNDEF) @@ -124,6 +125,9 @@ CFLAGS += -DNUMBER_KEY_AS_INDEX ifdef RELAY_NAME_DEFAULT CFLAGS += -DRELAY_NAME_DEFAULT=\"$(RELAY_NAME_DEFAULT)\" endif +ifdef RELAY_PORT_DEFAULT + CFLAGS += -DRELAY_PORT_DEFAULT=$(RELAY_PORT_DEFAULT) +endif # This is normally part of MEM_DEBUG, but sometimes we want logging in # a release build, e.g. to figure out why opening a saved game isn't # working. So normally it's commented out here. diff --git a/xwords4/wince/cecondlg.c b/xwords4/wince/cecondlg.c index 7b242b7e3..8e50291ab 100755 --- a/xwords4/wince/cecondlg.c +++ b/xwords4/wince/cecondlg.c @@ -50,11 +50,13 @@ ceControlsToAddrRec( HWND hDlg, CeConnDlgState* state ) if ( state->addrRec.conType == COMMS_CONN_RELAY ) { #ifdef XWFEATURE_RELAY +# ifndef RELAY_NOEDIT_ADDR len = sizeof(state->addrRec.u.ip_relay.hostName); ceGetDlgItemText( hDlg, RELAYNAME_EDIT, state->addrRec.u.ip_relay.hostName, &len ); state->addrRec.u.ip_relay.port = (XP_U16)ceGetDlgItemNum( hDlg, RELAYPORT_EDIT ); +#endif len = sizeof(state->addrRec.u.ip_relay.invite); ceGetDlgItemText( hDlg, INVITE_EDIT, state->addrRec.u.ip_relay.invite, &len ); @@ -116,8 +118,10 @@ adjustForConnType( HWND hDlg, CeConnDlgState* state, XP_Bool useFromState ) XP_U16 relayIds[] = { IDC_INVITE_LAB, #ifdef XWFEATURE_RELAY - INVITE_EDIT,IDC_CRELAYHINT_LAB,IDC_CRELAYNAME_LAB,RELAYNAME_EDIT, - IDC_CRELAYPORT_LAB, RELAYPORT_EDIT, + INVITE_EDIT, +# ifndef RELAY_NOEDIT_ADDR + IDC_CRELAYNAME_LAB,RELAYNAME_EDIT, IDC_CRELAYPORT_LAB, RELAYPORT_EDIT, +# endif #endif 0 }; XP_U16 directIds[] = { @@ -210,15 +214,17 @@ ceControlsFromAddrRec( HWND hDlg, const CeConnDlgState* state ) conType = state->addrRec.conType; if ( state->addrRec.conType == COMMS_CONN_RELAY ) { #ifdef XWFEATURE_RELAY + ceSetDlgItemText( hDlg, INVITE_EDIT, + state->addrRec.u.ip_relay.invite ); + ids[nIds++] = INVITE_EDIT; +# ifndef RELAY_NOEDIT_ADDR ceSetDlgItemText( hDlg, RELAYNAME_EDIT, state->addrRec.u.ip_relay.hostName ); ids[nIds++] = RELAYNAME_EDIT; ceSetDlgItemNum( hDlg, RELAYPORT_EDIT, state->addrRec.u.ip_relay.port ); ids[nIds++] = RELAYPORT_EDIT; - ceSetDlgItemText( hDlg, INVITE_EDIT, - state->addrRec.u.ip_relay.invite ); - ids[nIds++] = INVITE_EDIT; +#endif #endif } else if ( state->addrRec.conType == COMMS_CONN_IP_DIRECT ) { #ifdef XWFEATURE_IP_DIRECT diff --git a/xwords4/wince/l10n/xwords4_catalan.rc b/xwords4/wince/l10n/xwords4_catalan.rc index 4af74b67a..2b038130a 100644 --- a/xwords4/wince/l10n/xwords4_catalan.rc +++ b/xwords4/wince/l10n/xwords4_catalan.rc @@ -610,11 +610,15 @@ END # define CONN_LABEL_ROW_3 (CONN_LABEL_ROW_1) # define CONN_EDIT_ROW_4 (CONN_LABEL_ROW_3+CONN_LABEL_HT+3) # endif +# ifndef RELAY_NOEDIT_ADDR # define CONN_LABEL_ROW_5 (CONN_EDIT_ROW_4+ROW_SPACE+5) # define CONN_EDIT_ROW_6 (CONN_LABEL_ROW_5+CONN_LABEL_HT+3) # define CONN_LABEL_ROW_7 (CONN_EDIT_ROW_6+ROW_SPACE+5) # define CONN_EDIT_ROW_8 (CONN_LABEL_ROW_7+CONN_LABEL_HT+3) # define BUTTON_ROW (CONN_EDIT_ROW_8+ROW_SPACE) +#else +# define BUTTON_ROW (CONN_EDIT_ROW_4+ROW_SPACE) +#endif #ifdef _WIN32_WCE # define CONNSDLG_HT BUTTON_ROW #else @@ -639,6 +643,7 @@ BEGIN IDC_INVITE_LAB,LAB_COL,CONN_LABEL_ROW_3,90,CONN_LABEL_HT EDITTEXT INVITE_EDIT,CTRL_COL,CONN_EDIT_ROW_4,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL +# ifndef RELAY_NOEDIT_ADDR LTEXT "Nom del repetidor (canvia poques vegades):", IDC_CRELAYNAME_LAB,LAB_COL,CONN_LABEL_ROW_5,90,CONN_LABEL_HT EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_EDIT_ROW_6,CTRL_COL_WIDTH, @@ -647,6 +652,7 @@ BEGIN IDC_CRELAYPORT_LAB,LAB_COL,CONN_LABEL_ROW_7,90,CONN_LABEL_HT EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_EDIT_ROW_8,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER +#endif #elif defined NEEDS_CHOOSE_CONNTYPE LTEXT "La connexió al repetidor no és possible.",IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,40,40 #endif @@ -1003,6 +1009,9 @@ BEGIN "no s'han rebut dades vostres en una bona estona." IDS_XWRELAY_ERROR_HEART_OTHER "El repetidor ha perdut el contacte amb el un dispositiu d'aquesta partida." /* IDS_XWRELAY_ERROR_LOST_OTHER "El repetidor ha perdut el contacte amb un dispositiu d'aquesta partida." */ + IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ + "relay. You probably need to upgrade to the "\ + "latest version." /* translate */ # endif #endif diff --git a/xwords4/wince/l10n/xwords4_english.rc b/xwords4/wince/l10n/xwords4_english.rc index d248b33c8..2016860f9 100755 --- a/xwords4/wince/l10n/xwords4_english.rc +++ b/xwords4/wince/l10n/xwords4_english.rc @@ -608,11 +608,16 @@ END # define CONN_LABEL_ROW_3 (CONN_LABEL_ROW_1) # define CONN_EDIT_ROW_4 (CONN_LABEL_ROW_3+CONN_LABEL_HT+3) # endif +# ifndef RELAY_NOEDIT_ADDR # define CONN_LABEL_ROW_5 (CONN_EDIT_ROW_4+ROW_SPACE+5) # define CONN_EDIT_ROW_6 (CONN_LABEL_ROW_5+CONN_LABEL_HT+3) # define CONN_LABEL_ROW_7 (CONN_EDIT_ROW_6+ROW_SPACE+5) # define CONN_EDIT_ROW_8 (CONN_LABEL_ROW_7+CONN_LABEL_HT+3) # define BUTTON_ROW (CONN_EDIT_ROW_8+ROW_SPACE) +# else +# define BUTTON_ROW (CONN_EDIT_ROW_4+ROW_SPACE) +#endif + #ifdef _WIN32_WCE # define CONNSDLG_HT BUTTON_ROW #else @@ -637,7 +642,7 @@ BEGIN IDC_INVITE_LAB,LAB_COL,CONN_LABEL_ROW_3,90,CONN_LABEL_HT EDITTEXT INVITE_EDIT,CTRL_COL,CONN_EDIT_ROW_4,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL - +#ifndef RELAY_NOEDIT_ADDR LTEXT "Relay name (rarely changes):",IDC_CRELAYNAME_LAB, LAB_COL,CONN_LABEL_ROW_5,90,CONN_LABEL_HT EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_EDIT_ROW_6,CTRL_COL_WIDTH, @@ -646,6 +651,7 @@ BEGIN CONN_LABEL_ROW_7,90,CONN_LABEL_HT EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_EDIT_ROW_8,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER +#endif #elif defined NEEDS_CHOOSE_CONNTYPE LTEXT "Relay connection not supported.",IDC_INVITE_LAB,LAB_COL, CONN_ROW_3,40,40 @@ -1006,6 +1012,9 @@ BEGIN "didn't hear from you in too long." IDS_XWRELAY_ERROR_HEART_OTHER "The relay has lost contact with a device in this game." /* IDS_XWRELAY_ERROR_LOST_OTHER "The relay has lost contact with a device in this game." */ + IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ + "relay. You probably need to upgrade to the "\ + "latest version." # endif #endif diff --git a/xwords4/wince/l10n/xwords4_french.rc b/xwords4/wince/l10n/xwords4_french.rc index 7a5e67cd8..31bc7b6d4 100644 --- a/xwords4/wince/l10n/xwords4_french.rc +++ b/xwords4/wince/l10n/xwords4_french.rc @@ -596,11 +596,15 @@ END # define CONN_ROW_3 (CONN_ROW_1) # define CONN_ROW_4 (CONN_ROW_2+ROW_SPACE) # endif +# ifndef RELAY_NOEDIT_ADDR # define CONN_ROW_5 (CONN_ROW_4+ROW_SPACE) # define CONN_ROW_6 (CONN_ROW_5+ROW_SPACE) # define CONN_ROW_7 (CONN_ROW_6+ROW_SPACE) # define CONN_ROW_8 (CONN_ROW_7+ROW_SPACE) # define BUTTON_ROW (CONN_ROW_8+ROW_SPACE) +# else +# define BUTTON_ROW (CONN_ROW_4+ROW_SPACE) +# endif #ifdef _WIN32_WCE # define CONNSDLG_HT BUTTON_ROW #else @@ -621,7 +625,7 @@ BEGIN LTEXT "Room:",IDC_INVITE_LAB,LAB_COL,CONN_ROW_3,40,ROW_HEIGHT // <- translate EDITTEXT INVITE_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,ROW_HEIGHT, ES_AUTOHSCROLL - +# ifndef RELAY_NOEDIT_ADDR LTEXT "Nom du relai (change rarement):",IDC_CRELAYNAME_LAB, LAB_COL,CONN_ROW_5,120,ROW_HEIGHT EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_ROW_6,CTRL_COL_WIDTH,ROW_HEIGHT, @@ -630,6 +634,7 @@ BEGIN LAB_COL,CONN_ROW_7,120,ROW_HEIGHT EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_ROW_8,CTRL_COL_WIDTH,ROW_HEIGHT, ES_AUTOHSCROLL | ES_NUMBER +# endif #else LTEXT "Connexion non supportée.",IDC_INVITE_LAB, LAB_COL,CONN_ROW_3,40,40 @@ -966,6 +971,9 @@ BEGIN "pendant trop longtemps." IDS_XWRELAY_ERROR_HEART_OTHER "La transmission a perdu le contact avec un appareil durant cette partie." /* IDS_XWRELAY_ERROR_LOST_OTHER "The relay has lost contact with a device in this game." */ + IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ + "relay. You probably need to upgrade to the "\ + "latest version." /* translate */ # endif #endif /* XWFEATURE_STANDALONE_ONLY */ diff --git a/xwords4/wince/l10n/xwords4_polish.rc b/xwords4/wince/l10n/xwords4_polish.rc index 0536a415d..9b15e3c0d 100644 --- a/xwords4/wince/l10n/xwords4_polish.rc +++ b/xwords4/wince/l10n/xwords4_polish.rc @@ -604,11 +604,15 @@ END # define CONN_LABEL_ROW_3 (CONN_LABEL_ROW_1) # define CONN_EDIT_ROW_4 (CONN_LABEL_ROW_3+CONN_LABEL_HT+3) # endif +# ifndef RELAY_NOEDIT_ADDR # define CONN_LABEL_ROW_5 (CONN_EDIT_ROW_4+ROW_SPACE+5) # define CONN_EDIT_ROW_6 (CONN_LABEL_ROW_5+CONN_LABEL_HT+3) # define CONN_LABEL_ROW_7 (CONN_EDIT_ROW_6+ROW_SPACE+5) # define CONN_EDIT_ROW_8 (CONN_LABEL_ROW_7+CONN_LABEL_HT+3) # define BUTTON_ROW (CONN_EDIT_ROW_8+ROW_SPACE) +#else +# define BUTTON_ROW (CONN_EDIT_ROW_4+ROW_SPACE) +#endif #ifdef _WIN32_WCE # define CONNSDLG_HT BUTTON_ROW #else @@ -633,6 +637,7 @@ BEGIN LTEXT "Pokój:",IDC_INVITE_LAB,LAB_COL,CONN_LABEL_ROW_3,40,ROW_HEIGHT EDITTEXT INVITE_EDIT,CTRL_COL,CONN_EDIT_ROW_4,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL +# ifndef RELAY_NOEDIT_ADDR LTEXT "Serwer (raczej niezmienny):",IDC_CRELAYNAME_LAB, LAB_COL,CONN_LABEL_ROW_5,120,ROW_HEIGHT EDITTEXT RELAYNAME_EDIT,CTRL_COL,CONN_EDIT_ROW_6,CTRL_COL_WIDTH, @@ -641,6 +646,7 @@ BEGIN LAB_COL,CONN_LABEL_ROW_7,120,ROW_HEIGHT EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_EDIT_ROW_8,CTRL_COL_WIDTH, ROW_HEIGHT,ES_AUTOHSCROLL | ES_NUMBER +# endif #elif defined NEEDS_CHOOSE_CONNTYPE LTEXT "Połączenie z serwerem niedostępne.",IDC_INVITE_LAB, LAB_COL,CONN_ROW_3,40,40 @@ -978,6 +984,9 @@ BEGIN "oczekiwania na Twoją odpowiedź." IDS_XWRELAY_ERROR_HEART_OTHER "Serwer utracił połączenie z graczem." /* IDS_XWRELAY_ERROR_LOST_OTHER "Utracono połączenie z graczem." */ + IDS_XWRELAY_RELAY_INCOMPAT "This version of Crosswords does not match the "\ + "relay. You probably need to upgrade to the "\ + "latest version." /* translate */ # endif #endif diff --git a/xwords4/wince/resource.h b/xwords4/wince/resource.h index 0f95eb422..2f5631dc3 100755 --- a/xwords4/wince/resource.h +++ b/xwords4/wince/resource.h @@ -192,12 +192,12 @@ #ifdef XWFEATURE_RELAY # define IDC_CRELAYNAME_LAB 1108 # define IDC_CRELAYPORT_LAB 1109 -# define IDC_CRELAYHINT_LAB 1110 -/* # define IDC_CONNECTCOMBO 1111 */ -# define RELAYNAME_EDIT 1112 -# define RELAYPORT_EDIT 1113 -# define INVITE_EDIT 1114 +# define INVITE_EDIT 1110 +# ifndef RELAY_NOEDIT_ADDR +# define RELAYPORT_EDIT 1111 +# define RELAYNAME_EDIT 1112 +# endif #endif diff --git a/xwords4/wince/strids.h b/xwords4/wince/strids.h index 86a371812..d4d929b42 100644 --- a/xwords4/wince/strids.h +++ b/xwords4/wince/strids.h @@ -122,11 +122,12 @@ # define IDS_ERROR_HEART_YOU 40094 # define IDS_XWRELAY_ERROR_HEART_OTHER 40095 # define IDS_XWRELAY_ERROR_LOST_OTHER 40096 +# define IDS_XWRELAY_RELAY_INCOMPAT 40097 # endif #endif #if ! defined XWFEATURE_STANDALONE_ONLY -# define CE_LAST_RES_ID 40097 +# define CE_LAST_RES_ID 40098 #else # define CE_LAST_RES_ID 40082 #endif