clear up problems with over-long delivery reports
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@625 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
a86b63530a
commit
678bc322ec
@ -1372,6 +1372,7 @@ static BOOL volumeControlPressed;
|
|||||||
static int oldSelection;
|
static int oldSelection;
|
||||||
static BOOL selectPressed;
|
static BOOL selectPressed;
|
||||||
static BOOL queryPressed;
|
static BOOL queryPressed;
|
||||||
|
static BOOL spacePressed;
|
||||||
|
|
||||||
// DJS + aegidian : Moved from the big switch/case block in pollGuiArrowKeyControls
|
// DJS + aegidian : Moved from the big switch/case block in pollGuiArrowKeyControls
|
||||||
- (BOOL) handleGUIUpDownArrowKeys
|
- (BOOL) handleGUIUpDownArrowKeys
|
||||||
@ -2066,9 +2067,15 @@ static BOOL queryPressed;
|
|||||||
case GUI_SCREEN_REPORT :
|
case GUI_SCREEN_REPORT :
|
||||||
if ([gameView isDown:32]) // spacebar
|
if ([gameView isDown:32]) // spacebar
|
||||||
{
|
{
|
||||||
[gui click];
|
if (!spacePressed)
|
||||||
[self setGuiToStatusScreen];
|
{
|
||||||
|
[gui click];
|
||||||
|
[self setGuiToStatusScreen];
|
||||||
|
}
|
||||||
|
spacePressed = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
spacePressed = NO;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GUI_SCREEN_SHIPYARD :
|
case GUI_SCREEN_SHIPYARD :
|
||||||
@ -2440,9 +2447,15 @@ static BOOL switching_equipship_screens;
|
|||||||
MyOpenGLView *gameView = (MyOpenGLView *)[universe gameView];
|
MyOpenGLView *gameView = (MyOpenGLView *)[universe gameView];
|
||||||
if ([gameView isDown:32]) // look for the spacebar
|
if ([gameView isDown:32]) // look for the spacebar
|
||||||
{
|
{
|
||||||
[universe displayMessage:@"" forCount:1.0];
|
if (!spacePressed)
|
||||||
shot_time = 31.0; // force restart
|
{
|
||||||
|
[universe displayMessage:@"" forCount:1.0];
|
||||||
|
shot_time = 31.0; // force restart
|
||||||
|
}
|
||||||
|
spacePressed = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
spacePressed = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL toggling_music;
|
static BOOL toggling_music;
|
||||||
@ -2623,15 +2636,19 @@ static BOOL toggling_music;
|
|||||||
// NSLog(@"GUI_SCREEN_MISSION looking for spacebar");
|
// NSLog(@"GUI_SCREEN_MISSION looking for spacebar");
|
||||||
if ([gameView isDown:32]) // '<space>'
|
if ([gameView isDown:32]) // '<space>'
|
||||||
{
|
{
|
||||||
[self setStatus:STATUS_DOCKED];
|
if (!spacePressed)
|
||||||
[universe removeDemoShips];
|
|
||||||
[gui setBackgroundImage:nil];
|
|
||||||
[self setGuiToStatusScreen];
|
|
||||||
if (missionMusic)
|
|
||||||
{
|
{
|
||||||
[missionMusic stop];
|
[self setStatus:STATUS_DOCKED];
|
||||||
|
[universe removeDemoShips];
|
||||||
|
[gui setBackgroundImage:nil];
|
||||||
|
[self setGuiToStatusScreen];
|
||||||
|
if (missionMusic)
|
||||||
|
[missionMusic stop];
|
||||||
}
|
}
|
||||||
|
spacePressed = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
spacePressed = NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -102,6 +102,7 @@ Your fair use and other rights are in no way affected by the above.
|
|||||||
- (void) setGuiToManifestScreen;
|
- (void) setGuiToManifestScreen;
|
||||||
|
|
||||||
- (void) setGuiToDeliveryReportScreenWithText:(NSString*) report;
|
- (void) setGuiToDeliveryReportScreenWithText:(NSString*) report;
|
||||||
|
- (void) setGuiToDockingReportScreen;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------- //
|
// ---------------------------------------------------------------------- //
|
||||||
|
|
||||||
|
@ -1014,6 +1014,66 @@ Your fair use and other rights are in no way affected by the above.
|
|||||||
[universe setViewDirection: VIEW_GUI_DISPLAY];
|
[universe setViewDirection: VIEW_GUI_DISPLAY];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setGuiToDockingReportScreen
|
||||||
|
{
|
||||||
|
GuiDisplayGen* gui = [universe gui];
|
||||||
|
|
||||||
|
int text_row = 1;
|
||||||
|
|
||||||
|
[dockingReport setString:[dockingReport stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||||||
|
|
||||||
|
// GUI stuff
|
||||||
|
{
|
||||||
|
[gui clear];
|
||||||
|
[gui setTitle:[universe expandDescription:@"[arrival-report-title]" forSystem:system_seed]];
|
||||||
|
//
|
||||||
|
|
||||||
|
// dockingReport might be a multi-line message
|
||||||
|
//
|
||||||
|
while (([dockingReport length] > 0)&&(text_row < 18))
|
||||||
|
{
|
||||||
|
if ([dockingReport rangeOfString:@"\n"].location != NSNotFound)
|
||||||
|
{
|
||||||
|
while (([dockingReport rangeOfString:@"\n"].location != NSNotFound)&&(text_row < 18))
|
||||||
|
{
|
||||||
|
int line_break = [dockingReport rangeOfString:@"\n"].location;
|
||||||
|
NSString* line = [dockingReport substringToIndex:line_break];
|
||||||
|
[dockingReport deleteCharactersInRange: NSMakeRange( 0, line_break + 1)];
|
||||||
|
text_row = [gui addLongText:line startingAtRow:text_row align:GUI_ALIGN_LEFT];
|
||||||
|
}
|
||||||
|
[dockingReport setString:[dockingReport stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text_row = [gui addLongText:[NSString stringWithString:dockingReport] startingAtRow:text_row align:GUI_ALIGN_LEFT];
|
||||||
|
[dockingReport setString:@""];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[gui setText:[NSString stringWithFormat:@"Cash:\t%.1f Cr.\t\tLoad %d of %d t.\tPassengers %d of %d berths.", 0.1*credits, current_cargo, max_cargo, [passengers count], max_passengers] forRow: GUI_ROW_MARKET_CASH];
|
||||||
|
//
|
||||||
|
[gui setText:@"Press Space Commander" forRow:21 align:GUI_ALIGN_CENTER];
|
||||||
|
[gui setColor:[OOColor yellowColor] forRow:21];
|
||||||
|
|
||||||
|
[gui setShowTextCursor:NO];
|
||||||
|
}
|
||||||
|
/* ends */
|
||||||
|
|
||||||
|
|
||||||
|
if (lastTextKey)
|
||||||
|
{
|
||||||
|
[lastTextKey release];
|
||||||
|
lastTextKey = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
gui_screen = GUI_SCREEN_REPORT;
|
||||||
|
|
||||||
|
[self setShowDemoShips: NO];
|
||||||
|
[universe setDisplayText: YES];
|
||||||
|
[universe setDisplayCursor: NO];
|
||||||
|
[universe setViewDirection: VIEW_GUI_DISPLAY];
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------- //
|
// ---------------------------------------------------------------------- //
|
||||||
|
|
||||||
static NSMutableDictionary* currentShipyard = nil;
|
static NSMutableDictionary* currentShipyard = nil;
|
||||||
|
@ -497,6 +497,9 @@ enum
|
|||||||
|
|
||||||
int currentWeaponFacing; // decoupled from view direction
|
int currentWeaponFacing; // decoupled from view direction
|
||||||
|
|
||||||
|
// docking reports
|
||||||
|
NSMutableString* dockingReport;
|
||||||
|
|
||||||
/* -- */
|
/* -- */
|
||||||
|
|
||||||
#ifdef GNUSTEP
|
#ifdef GNUSTEP
|
||||||
|
@ -908,6 +908,8 @@ static Quaternion quaternion_identity = { (GLfloat)1.0, (GLfloat)0.0, (GLfloat)0
|
|||||||
//
|
//
|
||||||
target_memory_index = 0;
|
target_memory_index = 0;
|
||||||
//
|
//
|
||||||
|
dockingReport = [[NSMutableString string] retain];
|
||||||
|
//
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,6 +1163,8 @@ static Quaternion quaternion_identity = { (GLfloat)1.0, (GLfloat)0.0, (GLfloat)0
|
|||||||
suppressTargetLost = NO;
|
suppressTargetLost = NO;
|
||||||
|
|
||||||
scoopsActive = NO;
|
scoopsActive = NO;
|
||||||
|
|
||||||
|
[dockingReport setString:@""];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setUpShipFromDictionary:(NSDictionary *) dict
|
- (void) setUpShipFromDictionary:(NSDictionary *) dict
|
||||||
@ -1508,6 +1512,8 @@ static Quaternion quaternion_identity = { (GLfloat)1.0, (GLfloat)0.0, (GLfloat)0
|
|||||||
if (save_path) [save_path release];
|
if (save_path) [save_path release];
|
||||||
|
|
||||||
if (custom_views) [custom_views release];
|
if (custom_views) [custom_views release];
|
||||||
|
|
||||||
|
if (dockingReport) [dockingReport release];
|
||||||
|
|
||||||
[self destroySound];
|
[self destroySound];
|
||||||
|
|
||||||
@ -3746,7 +3752,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
|
|
||||||
- (void) docked
|
- (void) docked
|
||||||
{
|
{
|
||||||
NSMutableString *deliveryReport = [NSMutableString string];
|
// NSMutableString *dockingReport = [NSMutableString string];
|
||||||
|
|
||||||
status = STATUS_DOCKED;
|
status = STATUS_DOCKED;
|
||||||
[universe setViewDirection:VIEW_GUI_DISPLAY];
|
[universe setViewDirection:VIEW_GUI_DISPLAY];
|
||||||
@ -3789,14 +3795,14 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
|
|
||||||
NSString* escapepodReport = [self processEscapePods];
|
NSString* escapepodReport = [self processEscapePods];
|
||||||
if ([escapepodReport length])
|
if ([escapepodReport length])
|
||||||
[deliveryReport appendString: escapepodReport];
|
[dockingReport appendString: escapepodReport];
|
||||||
|
|
||||||
[self unloadCargoPods]; // fill up the on-ship commodities before...
|
[self unloadCargoPods]; // fill up the on-ship commodities before...
|
||||||
|
|
||||||
// check contracts
|
// check contracts
|
||||||
NSString* passengerReport = [self checkPassengerContracts];
|
NSString* passengerReport = [self checkPassengerContracts];
|
||||||
if (passengerReport)
|
if (passengerReport)
|
||||||
[deliveryReport appendFormat:@"\n\n%@", passengerReport];
|
[dockingReport appendFormat:@"\n\n%@", passengerReport];
|
||||||
|
|
||||||
[universe setDisplayText:YES];
|
[universe setDisplayText:YES];
|
||||||
|
|
||||||
@ -3810,7 +3816,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// time to check the script!
|
// time to check the script!
|
||||||
if ((!being_fined)&&([deliveryReport length] < 1))
|
if (!being_fined)
|
||||||
[self checkScript];
|
[self checkScript];
|
||||||
|
|
||||||
// if we've not switched to the mission screen then proceed normally..
|
// if we've not switched to the mission screen then proceed normally..
|
||||||
@ -3820,10 +3826,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
if (being_fined)
|
if (being_fined)
|
||||||
[self getFined];
|
[self getFined];
|
||||||
|
|
||||||
if ([deliveryReport length])
|
[self setGuiToStatusScreen];
|
||||||
[self setGuiToDeliveryReportScreenWithText:deliveryReport];
|
|
||||||
else
|
|
||||||
[self setGuiToStatusScreen];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4331,6 +4334,13 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
|
|
||||||
- (void) setGuiToStatusScreen
|
- (void) setGuiToStatusScreen
|
||||||
{
|
{
|
||||||
|
// intercept any docking messages
|
||||||
|
if ([dockingReport length] > 0)
|
||||||
|
{
|
||||||
|
[self setGuiToDockingReportScreen]; // go here instead!
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
NSDictionary* descriptions = [universe descriptions];
|
NSDictionary* descriptions = [universe descriptions];
|
||||||
NSString* systemName;
|
NSString* systemName;
|
||||||
NSString* targetSystemName;
|
NSString* targetSystemName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user