Revert hackish ship rotation fix from r3792 and replace by a slightly less hackish version (re-uses a variable in ShipEntity now, instead of in Universe).

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3796 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Michael Werle 2010-11-08 22:12:13 +00:00
parent d1b4310ab7
commit ff9f049d10
5 changed files with 21 additions and 26 deletions

View File

@ -6242,11 +6242,18 @@ static NSString *last_outfitting_key=nil;
- (void) noteGuiChangeFrom:(OOGUIScreenID)fromScreen to:(OOGUIScreenID)toScreen
{
// No events triggered if we're changing screens while paused, or if screen never actually changed.
if (![[UNIVERSE gameController] gameIsPaused] && fromScreen != toScreen)
if( fromScreen != toScreen )
{
[self doScriptEvent:@"guiScreenChanged"
withArgument:GUIScreenIDToString(toScreen)
// MKW - release demo ship, if we have one (NOTE: doesn't do anything if we don't)
[scanned_ships[0] release];
scanned_ships[0] = nil;
if (![[UNIVERSE gameController] gameIsPaused])
{
[self doScriptEvent:@"guiScreenChanged"
withArgument:GUIScreenIDToString(toScreen)
andArgument:GUIScreenIDToString(fromScreen)];
}
}
}

View File

@ -1441,6 +1441,7 @@ static NSMutableDictionary* currentShipyard = nil;
[gui setText:@"" forRow:i];
[gui setColor:[OOColor greenColor] forRow:i];
}
[UNIVERSE removeDemoShips];
if (info)
{
@ -1504,16 +1505,18 @@ static NSMutableDictionary* currentShipyard = nil;
- (void) showShipyardModel:(NSString *)shipKey shipData:(NSDictionary *)shipData personality:(uint16_t)personality
{
ShipEntity *ship;
ShipEntity * demoShip = [[[UNIVERSE demoShip] retain] autorelease];
[UNIVERSE removeDemoShips];
if (shipKey == nil || dockedStation == nil) return;
if (shipData == nil) shipData = [[OOShipRegistry sharedRegistry] shipInfoForKey:shipKey];
if (shipData == nil) return;
Quaternion q2 = { (GLfloat)0.707f, (GLfloat)0.707f, (GLfloat)0.0f, (GLfloat)0.0f };
if( demoShip != nil )
q2 = [demoShip orientation];
// MKW - retrieve last demo ships' orientation and release it
if( scanned_ships[0] != nil )
{
q2 = [scanned_ships[0] orientation];
[scanned_ships[0] release];
}
ship = [[ProxyPlayerEntity alloc] initWithKey:shipKey definition:shipData];
if (personality != ENTITY_PERSONALITY_INVALID) [ship setEntityPersonalityInt:personality];
@ -1533,7 +1536,9 @@ static NSMutableDictionary* currentShipyard = nil;
// show missing subentities if there's a subentities_status key
if (subEntStatus != nil) [ship deserializeShipSubEntitiesFrom:(NSString *)subEntStatus];
[UNIVERSE addEntity: ship];
[UNIVERSE setDemoShip:ship];
// MKW - save demo ship for its rotation
scanned_ships[0] = [ship retain];
[ship setStatus: STATUS_COCKPIT_DISPLAY];
[ship release];

View File

@ -923,6 +923,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
- (void) showCommanderShip:(int)cdrArrayIndex
{
GuiDisplayGen *gui=[UNIVERSE gui];
[UNIVERSE removeDemoShips];
NSDictionary *cdr=[cdrDetailArray objectAtIndex: cdrArrayIndex];
[gui setText:@"" forRow:CDRDESCROW align:GUI_ALIGN_LEFT];

View File

@ -301,9 +301,6 @@ enum
- (void) reinitAndShowDemo:(BOOL)showDemo;
- (ShipEntity*)demoShip;
- (void) setDemoShip:(ShipEntity*)ship;
- (int) obj_count;
#ifndef NDEBUG
- (void) obj_dump;

View File

@ -418,20 +418,6 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
}
- (ShipEntity*) demoShip
{
return demo_ship;
}
- (void) setDemoShip:(ShipEntity*)ship
{
// MKW - we don't retain here, so caller must ensure that 'ship' is in the
// Universe's entity list. Otherwise we would have to fix a LOT of places
// which use the demo_ship member.
demo_ship = ship;
}
- (int) obj_count
{
return [entities count];
@ -3750,7 +3736,6 @@ static BOOL MaintainLinkedLists(Universe* uni)
closeSystems = nil;
firstBeacon = NO_TARGET;
lastBeacon = NO_TARGET;
demo_ship = nil;
no_update = updating; // restore drawing
}