Escape pod activation now requires a double keypress. This will guarantee that the player will eject only when they truly want to eject.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3807 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2010-11-13 16:45:31 +00:00
parent a800373105
commit 98e9aa6f2d

View File

@ -111,6 +111,7 @@ static BOOL switching_equipship_screens;
static BOOL zoom_pressed;
static BOOL customView_pressed;
static BOOL weaponsOnlineToggle_pressed;
static BOOL escapePodKey_pressed;
static unsigned searchStringLength;
static double timeLastKeyPress;
@ -1048,11 +1049,24 @@ static NSTimeInterval time_last_frame;
}
exceptionContext = @"escape pod";
// shoot 'escape' // Escape pod launch
// shoot 'escape' // Escape pod launch - NOTE: Requires double press within a specific time interval
if (([gameView isDown:key_launch_escapepod] || joyButtonState[BUTTON_ESCAPE]) && [self hasEscapePod]
&& ([UNIVERSE inInterstellarSpace] ? [UNIVERSE stationFriendlyTo:self] != nil : [UNIVERSE station] != nil))
{
found_target = [self launchEscapeCapsule];
static OOTimeDelta escapePodKeyResetTime;
if (!escapePodKey_pressed)
{
escapePodKey_pressed = YES;
// first keypress will unregister in KEY_REPEAT_INTERVAL seconds
escapePodKeyResetTime = [NSDate timeIntervalSinceReferenceDate] + KEY_REPEAT_INTERVAL;
[gameView supressKeysUntilKeyUp];
}
else
{
OOTimeDelta timeNow = [NSDate timeIntervalSinceReferenceDate];
escapePodKey_pressed = NO;
if (timeNow < escapePodKeyResetTime) found_target = [self launchEscapeCapsule];
}
}
exceptionContext = @"dump cargo";