# HG changeset patch # User unc0rr # Date 1214162761 0 # Node ID f6a3fcb329ca11aceed808a079f930f89548a675 # Parent a6dcb1412a29b70f753655f3fe1954f4de365f22 Start exit confirmation implementation diff -r a6dcb1412a29 -r f6a3fcb329ca QTfrontend/binds.cpp --- a/QTfrontend/binds.cpp Thu Jun 19 20:34:53 2008 +0000 +++ b/QTfrontend/binds.cpp Sun Jun 22 19:26:01 2008 +0000 @@ -48,6 +48,7 @@ {"chat", "t", QT_TRANSLATE_NOOP("binds", "chat"), false}, {"history", "`", QT_TRANSLATE_NOOP("binds", "chat history"), false}, {"pause", "p", QT_TRANSLATE_NOOP("binds", "pause"), false}, + {"confirm", "y", QT_TRANSLATE_NOOP("binds", "confirmation"), false}, {"+voldown", "9", QT_TRANSLATE_NOOP("binds", "volume down"), false}, {"+volup", "0", QT_TRANSLATE_NOOP("binds", "volume up"), false}, {"fullscr", "f", QT_TRANSLATE_NOOP("binds", "change mode"), false}, diff -r a6dcb1412a29 -r f6a3fcb329ca QTfrontend/binds.h --- a/QTfrontend/binds.h Thu Jun 19 20:34:53 2008 +0000 +++ b/QTfrontend/binds.h Sun Jun 22 19:26:01 2008 +0000 @@ -21,7 +21,7 @@ #include -#define BINDS_NUMBER 34 +#define BINDS_NUMBER 35 struct BindAction { diff -r a6dcb1412a29 -r f6a3fcb329ca hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Thu Jun 19 20:34:53 2008 +0000 +++ b/hedgewars/CCHandlers.inc Sun Jun 22 19:26:01 2008 +0000 @@ -29,9 +29,23 @@ end; //////////////////////////////////////////////////////////////////////////////// procedure chQuit(var s: shortstring); +const prevGState: TGameState = gsConfirm; begin -SendIPC('Q'); -GameState:= gsExit +if GameState <> gsConfirm then + begin + prevGState:= GameState; + GameState:= gsConfirm + end else + GameState:= prevGState +end; + +procedure chConfirm(var s: shortstring); +begin +if GameState = gsConfirm then + begin + SendIPC('Q'); + GameState:= gsExit + end end; procedure chCheckProto(var s: shortstring); diff -r a6dcb1412a29 -r f6a3fcb329ca hedgewars/hwengine.dpr --- a/hedgewars/hwengine.dpr Thu Jun 19 20:34:53 2008 +0000 +++ b/hedgewars/hwengine.dpr Sun Jun 22 19:26:01 2008 +0000 @@ -99,6 +99,7 @@ FinishProgress; GameState:= gsGame end; + gsConfirm, gsGame: begin ProcessKbd; DoGameTick(Lag); diff -r a6dcb1412a29 -r f6a3fcb329ca hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Thu Jun 19 20:34:53 2008 +0000 +++ b/hedgewars/uConsole.pas Sun Jun 22 19:26:01 2008 +0000 @@ -218,7 +218,6 @@ initialization InitConsole; -RegisterVariable('quit' , vtCommand, @chQuit , true ); RegisterVariable('proto' , vtCommand, @chCheckProto , true ); RegisterVariable('capture' , vtCommand, @chCapture , true ); RegisterVariable('rotmask' , vtCommand, @chRotateMask , true ); @@ -239,6 +238,8 @@ RegisterVariable('addhh' , vtCommand, @chAddHH , false); RegisterVariable('hhcoords', vtCommand, @chSetHHCoords , false); RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false); +RegisterVariable('quit' , vtCommand, @chQuit , true ); +RegisterVariable('confirm' , vtCommand, @chConfirm , true ); RegisterVariable('+speedup', vtCommand, @chSpeedup_p , true ); RegisterVariable('-speedup', vtCommand, @chSpeedup_m , true ); RegisterVariable('skip' , vtCommand, @chSkip , false); diff -r a6dcb1412a29 -r f6a3fcb329ca hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Thu Jun 19 20:34:53 2008 +0000 +++ b/hedgewars/uConsts.pas Sun Jun 22 19:26:01 2008 +0000 @@ -23,7 +23,7 @@ {$INCLUDE proto.inc} type - TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsExit); + TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit); TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview); diff -r a6dcb1412a29 -r f6a3fcb329ca hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Thu Jun 19 20:34:53 2008 +0000 +++ b/hedgewars/uKeys.pas Sun Jun 22 19:26:01 2008 +0000 @@ -122,6 +122,7 @@ DefaultBinds[112]:= 'pause'; DefaultBinds[115]:= '+speedup'; DefaultBinds[116]:= 'chat'; +DefaultBinds[121]:= 'confirm'; DefaultBinds[127]:= 'rotmask'; SetDefaultBinds end;