From b2b60d6c4873e8dd3f4b8e47f61faee32f75e124 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 2 Dec 2014 06:49:35 -0800 Subject: [PATCH] add commandline params that disable comms types on game creation so relay not connecting initally can be tested. --- xwords4/linux/gtkboard.c | 12 ++++++++++++ xwords4/linux/linuxmain.c | 25 +++++++++++++++++++++++++ xwords4/linux/main.h | 1 + 3 files changed, 38 insertions(+) diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index c9e7089c0..6f2267f2b 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -482,12 +482,18 @@ addDropChecks( GtkGameGlobals* globals ) gtk_widget_show( widget ); widget = gtk_check_button_new_with_label( "Incoming" ); + if ( comms_getAddrDisabled( comms, typ, XP_FALSE ) ) { + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widget), TRUE ); + } g_signal_connect( GTK_OBJECT(widget), "toggled", G_CALLBACK(drop_msg_toggle), datum ); gtk_box_pack_start( GTK_BOX(hbox), widget, FALSE, TRUE, 0); gtk_widget_show( widget ); widget = gtk_check_button_new_with_label( "Outgoing" ); + if ( comms_getAddrDisabled( comms, typ, XP_TRUE ) ) { + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widget), TRUE ); + } g_signal_connect( GTK_OBJECT(widget), "toggled", G_CALLBACK(drop_msg_toggle), (void*)(((long)datum) | 1) ); gtk_box_pack_start( GTK_BOX(hbox), widget, FALSE, TRUE, 0); @@ -572,6 +578,12 @@ createOrLoadObjects( GtkGameGlobals* globals ) // addr.conType = params->conType; CommsConnType typ; for ( XP_U32 st = 0; addr_iter( &addr, &typ, &st ); ) { + if ( params->commsDisableds[typ][0] ) { + comms_setAddrDisabled( cGlobals->game.comms, typ, XP_FALSE, XP_TRUE ); + } + if ( params->commsDisableds[typ][1] ) { + comms_setAddrDisabled( cGlobals->game.comms, typ, XP_TRUE, XP_TRUE ); + } switch( typ ) { #ifdef XWFEATURE_RELAY case COMMS_CONN_RELAY: diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 4165a6fed..64702d4ce 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -635,6 +635,11 @@ typedef enum { ,CMD_SPLITPACKETS ,CMD_CHAT ,CMD_USEUDP + ,CMD_DROPSENDRELAY + ,CMD_DROPRCVRELAY + ,CMD_DROPSENDSMS + ,CMD_DROPRCVSMS + #ifdef XWFEATURE_CROSSHAIRS ,CMD_NOCROSSHAIRS #endif @@ -746,6 +751,12 @@ static CmdInfoRec CmdInfoRecs[] = { "sections every random MOD seconds to test relay reassembly" } ,{ CMD_CHAT, true, "send-chat", "send a chat every seconds" } ,{ CMD_USEUDP, false, "use-udp", "connect to relay new-style, via udp not tcp" } + + ,{ CMD_DROPSENDRELAY, false, "drop-send-relay", "start new games with relay send disabled" } + ,{ CMD_DROPRCVRELAY, false, "drop-receive-relay", "start new games with relay receive disabled" } + ,{ CMD_DROPSENDSMS, false, "drop-send-sms", "start new games with sms send disabled" } + ,{ CMD_DROPRCVSMS, false, "drop-receive-sms", "start new games with sms receive disabled" } + #ifdef XWFEATURE_CROSSHAIRS ,{ CMD_NOCROSSHAIRS, false, "hide-crosshairs", "don't show crosshairs on board" } @@ -2349,6 +2360,20 @@ main( int argc, char** argv ) case CMD_USEUDP: mainParams.useUdp = true; break; + + case CMD_DROPSENDRELAY: + mainParams.commsDisableds[COMMS_CONN_RELAY][1] = XP_TRUE; + break; + case CMD_DROPRCVRELAY: + mainParams.commsDisableds[COMMS_CONN_RELAY][0] = XP_TRUE; + break; + case CMD_DROPSENDSMS: + mainParams.commsDisableds[COMMS_CONN_SMS][1] = XP_TRUE; + break; + case CMD_DROPRCVSMS: + mainParams.commsDisableds[COMMS_CONN_SMS][0] = XP_TRUE; + break; + #ifdef XWFEATURE_CROSSHAIRS case CMD_NOCROSSHAIRS: mainParams.hideCrosshairs = XP_TRUE; diff --git a/xwords4/linux/main.h b/xwords4/linux/main.h index 0e27c1edf..bd99a4b7d 100644 --- a/xwords4/linux/main.h +++ b/xwords4/linux/main.h @@ -118,6 +118,7 @@ typedef struct LaunchParams { XP_U16 robotThinkMin, robotThinkMax; XP_U16 robotTradePct; #endif + XP_Bool commsDisableds[COMMS_CONN_NTYPES][2]; DeviceRole serverRole;