Wormhole Scanner:

* Rearranged computation order and adjusted time of items as discussed with Nikos
* Switched position of ETA and Collapse-time on HUD to reflect new compute-order



git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2122 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Michael Werle 2009-04-05 22:40:44 +00:00
parent fc710b9b1a
commit 696f83ba0c
3 changed files with 43 additions and 20 deletions

View File

@ -2005,23 +2005,31 @@ static PlayerEntity *sSharedPlayer = nil;
assert(false);
break;
case WH_SCANINFO_SCANNED:
if( [self clockTimeAdjusted] > [wh scanTime]+3 )
if( [self clockTimeAdjusted] > [wh scanTime]+2 )
{
[wh setScanInfo:WH_SCANINFO_DESTINATION];
[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
[UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
[wh setScanInfo:WH_SCANINFO_COLLAPSE_TIME];
//[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-collapse-time-computed"),
// [UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
}
break;
case WH_SCANINFO_DESTINATION:
if( [self clockTimeAdjusted] > [wh scanTime]+8 )
case WH_SCANINFO_COLLAPSE_TIME:
if( [self clockTimeAdjusted] > [wh scanTime]+4 )
{
[wh setScanInfo:WH_SCANINFO_ARRIVAL_TIME];
[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-arrival-time-computed-@"),
ClockToString([wh arrivalTime], NO)] forCount:5.0];
ClockToString([wh arrivalTime], NO)] forCount:5.0];
}
break;
case WH_SCANINFO_ARRIVAL_TIME:
if( [self clockTimeAdjusted] > [wh scanTime]+13 )
if( [self clockTimeAdjusted] > [wh scanTime]+7 )
{
[wh setScanInfo:WH_SCANINFO_DESTINATION];
[UNIVERSE addCommsMessage:[NSString stringWithFormat:DESC(@"wormhole-destination-computed-@"),
[UNIVERSE getSystemName:[wh destination]]] forCount:5.0];
}
break;
case WH_SCANINFO_DESTINATION:
if( [self clockTimeAdjusted] > [wh scanTime]+10 )
{
[wh setScanInfo:WH_SCANINFO_SHIP];
// TODO: Extract last ship from wormhole and display its name

View File

@ -37,8 +37,9 @@ typedef enum
{
WH_SCANINFO_NONE = 0,
WH_SCANINFO_SCANNED,
WH_SCANINFO_DESTINATION,
WH_SCANINFO_COLLAPSE_TIME,
WH_SCANINFO_ARRIVAL_TIME,
WH_SCANINFO_DESTINATION,
WH_SCANINFO_SHIP,
} WORMHOLE_SCANINFO;

View File

@ -2275,18 +2275,32 @@ static void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloa
#ifdef WORMHOLE_SCANNER
if ([target isWormhole])
{
int wormholeScanInfo = [(WormholeEntity *)target scanInfo];
double timeForCollapsing = [(WormholeEntity *)target expiryTime] - [player1 clockTimeAdjusted];
int minutesToCollapse = floor (timeForCollapsing / 60.0);
int secondsToCollapse = (int)timeForCollapsing % 60;
NSString *wormholeExpiringIn = [NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
if (wormholeScanInfo >= WH_SCANINFO_ARRIVAL_TIME)
// Note: No break statements in the following switch() since every case
// falls through to the next. Cases arranged in reverse order.
switch([(WormholeEntity *)target scanInfo])
{
NSString *wormholeETA = [NSString stringWithFormat:DESC(@"wormhole-ETA-@"), ClockToString([(WormholeEntity *)target arrivalTime], NO)];
OODrawString(wormholeETA, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
case WH_SCANINFO_SHIP:
// TOOD: Render anything on the HUD for this?
case WH_SCANINFO_DESTINATION:
// Rendered above in dialTargetName, so no need to do anything here
// unless we want a separate line Destination: XXX ?
case WH_SCANINFO_ARRIVAL_TIME:
{
NSString *wormholeETA = [NSString stringWithFormat:DESC(@"wormhole-ETA-@"), ClockToString([(WormholeEntity *)target arrivalTime], NO)];
OODrawString(wormholeETA, rs0, 0.5 * rs2 - 3 * line_height, 0, textsize);
}
case WH_SCANINFO_COLLAPSE_TIME:
{
double timeForCollapsing = [(WormholeEntity *)target expiryTime] - [player1 clockTimeAdjusted];
int minutesToCollapse = floor (timeForCollapsing / 60.0);
int secondsToCollapse = (int)timeForCollapsing % 60;
NSString *wormholeExpiringIn = [NSString stringWithFormat:DESC(@"wormhole-collapsing-in-mm:ss"), minutesToCollapse, secondsToCollapse];
OODrawString(wormholeExpiringIn, rs0, 0.5 * rs2 - 2 * line_height, 0, textsize);
}
case WH_SCANINFO_SCANNED:
case WH_SCANINFO_NONE:
break;
}
}
#endif