From 221bad14060afa78d64d6e2d2647149ce618ef57 Mon Sep 17 00:00:00 2001 From: Wanne Date: Wed, 29 Jun 2011 17:06:23 +0000 Subject: [PATCH] Multiplayer: Fixed exploit, where a client (which does not currently have the turn) can still move when pressing CTRL + L or CTRL + S to open the Save/Load screen and then close the screen without loading/saving o I just disabled loading/saving while in turn based mode in a multiplayer game git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4542 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Turn Based Input.cpp | 93 +++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 06c5d43c..e2e30831 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -1546,60 +1546,67 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) } } - - /// Allow to load everywhere - if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'l') ) + // ROMAN.MP + // It is not allowed in a network game to go to the load screen, because if you cancel the load screen it is always your turn! + if (!is_networked) { - if( InputEvent.usKeyState & ALT_DOWN ) + /// Allow to load everywhere + if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'l') ) { - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + if( InputEvent.usKeyState & ALT_DOWN ) { - gfSaveGame = FALSE; - gfCameDirectlyFromGame = TRUE; + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + { + gfSaveGame = FALSE; + gfCameDirectlyFromGame = TRUE; - guiPreviousOptionScreen = GAME_SCREEN; - //Heinz: 28.02.09 BUGFIX: player doesn't need to see save/load screen - //LeaveTacticalScreen( SAVE_LOAD_SCREEN ); - DoQuickLoad(); + guiPreviousOptionScreen = GAME_SCREEN; + //Heinz: 28.02.09 BUGFIX: player doesn't need to see save/load screen + //LeaveTacticalScreen( SAVE_LOAD_SCREEN ); + DoQuickLoad(); + } } - } - else if( InputEvent.usKeyState & CTRL_DOWN ) - { - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + else if( InputEvent.usKeyState & CTRL_DOWN ) { - gfSaveGame = FALSE; - gfCameDirectlyFromGame = TRUE; + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + { + gfSaveGame = FALSE; + gfCameDirectlyFromGame = TRUE; - guiPreviousOptionScreen = GAME_SCREEN; - LeaveTacticalScreen( SAVE_LOAD_SCREEN ); + guiPreviousOptionScreen = GAME_SCREEN; + LeaveTacticalScreen( SAVE_LOAD_SCREEN ); + } } } } + if (is_networked) { - - if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 's') )//allow saving 'always'//hayden - { - if( InputEvent.usKeyState & ALT_DOWN ) + // WANNE: Disabled the quick saving in a multiplayer game, because if you quit out of the save dialog, + // you can move your merc even if it is not your turn. + /* + if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 's') )//allow saving 'always'//hayden { - if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + if( InputEvent.usKeyState & ALT_DOWN ) + { + if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) + { + //if the game CAN be saved + if( CanGameBeSaved() ) { - //if the game CAN be saved - if( CanGameBeSaved() ) - { - guiPreviousOptionScreen = GAME_SCREEN; - //guiPreviousOptionScreen = guiCurrentScreen; - DoQuickSave(); - } - else - { - //Display a message saying the player cant save now - DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); - } + guiPreviousOptionScreen = GAME_SCREEN; + //guiPreviousOptionScreen = guiCurrentScreen; + DoQuickSave(); } - } - else if( InputEvent.usKeyState & CTRL_DOWN ) - { + else + { + //Display a message saying the player cant save now + DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); + } + } + } + else if( InputEvent.usKeyState & CTRL_DOWN ) + { if( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) ) { //if the game CAN be saved @@ -1616,11 +1623,11 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) //Display a message saying the player cant save now DoMessageBox( MSG_BOX_BASIC_STYLE, zNewTacticalMessages[ TCTL_MSG__IRON_MAN_CANT_SAVE_NOW ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL); } + } + } } - } - } - - + */ + if ((InputEvent.usEvent == KEY_DOWN )&& ( InputEvent.usParam == 'e') ) { if( InputEvent.usKeyState & ALT_DOWN )