- fix: after loading a game, .startUp() fires up after the galaxy is properly initialised.
- fix: changes to system.name, system.techLevel, etc. are now shown correctly on the short range map. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4658 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
5212c2ace4
commit
779c3de34d
@ -542,7 +542,8 @@ typedef enum
|
|||||||
- (void) deferredInit;
|
- (void) deferredInit;
|
||||||
|
|
||||||
- (void) setUp;
|
- (void) setUp;
|
||||||
- (void)completeSetUp;
|
- (void) completeSetUp;
|
||||||
|
- (void) completeSetUpAndSetTarget:(BOOL)setTarget;
|
||||||
|
|
||||||
- (NSString *) captainName;
|
- (NSString *) captainName;
|
||||||
|
|
||||||
|
@ -1331,11 +1331,19 @@ static GLfloat sBaseMass = 0.0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)completeSetUp
|
- (void) completeSetUp
|
||||||
|
{
|
||||||
|
[self completeSetUpAndSetTarget:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) completeSetUpAndSetTarget:(BOOL)setTarget
|
||||||
{
|
{
|
||||||
[OOSoundSource stopAll];
|
[OOSoundSource stopAll];
|
||||||
dockedStation = [UNIVERSE station];
|
dockedStation = [UNIVERSE station];
|
||||||
target_system_seed = [UNIVERSE findSystemAtCoords:cursor_coordinates withGalaxySeed:galaxy_seed];
|
|
||||||
|
// If loading from a savegame don't reset the targetted system.
|
||||||
|
if (setTarget) target_system_seed = [UNIVERSE findSystemAtCoords:cursor_coordinates withGalaxySeed:galaxy_seed];
|
||||||
|
|
||||||
JSContext *context = OOJSAcquireContext();
|
JSContext *context = OOJSAcquireContext();
|
||||||
[self doWorldScriptEvent:OOJSID("startUp") inContext:context withArguments:NULL count:0 timeLimit:kOOJSLongTimeLimit];
|
[self doWorldScriptEvent:OOJSID("startUp") inContext:context withArguments:NULL count:0 timeLimit:kOOJSLongTimeLimit];
|
||||||
@ -5715,6 +5723,8 @@ static bool minShieldLevelPercentageInitialised = false;
|
|||||||
{
|
{
|
||||||
[gui clearAndKeepBackground:!guiChanged];
|
[gui clearAndKeepBackground:!guiChanged];
|
||||||
[gui setTitle:DESC(@"short-range-chart-title")];
|
[gui setTitle:DESC(@"short-range-chart-title")];
|
||||||
|
// refresh the short range chart cache, in case we've just loaded a save game with different local overrides, etc.
|
||||||
|
[gui refreshStarChart];
|
||||||
[gui setText:targetSystemName forRow:19];
|
[gui setText:targetSystemName forRow:19];
|
||||||
// distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
|
// distance-f & est-travel-time-f are identical between short & long range charts in standard Oolite, however can be alterered separately via OXPs
|
||||||
[gui setText:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[short-range-chart-distance-f]"), distance] forRow:20];
|
[gui setText:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[short-range-chart-distance-f]"), distance] forRow:20];
|
||||||
|
@ -463,14 +463,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
|||||||
if (loadedOK)
|
if (loadedOK)
|
||||||
{
|
{
|
||||||
[self setUp];
|
[self setUp];
|
||||||
if ([self setCommanderDataFromDictionary:fileDic])
|
if (![self setCommanderDataFromDictionary:fileDic])
|
||||||
{
|
|
||||||
// Remember the savegame target.
|
|
||||||
Random_Seed target = target_system_seed;
|
|
||||||
[self completeSetUp];
|
|
||||||
target_system_seed = target;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
fail_reason = DESC(@"loadfailed-could-not-set-up-player-ship");
|
fail_reason = DESC(@"loadfailed-could-not-set-up-player-ship");
|
||||||
loadedOK = NO;
|
loadedOK = NO;
|
||||||
@ -499,6 +492,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
|||||||
[UNIVERSE setTimeAccelerationFactor:TIME_ACCELERATION_FACTOR_DEFAULT];
|
[UNIVERSE setTimeAccelerationFactor:TIME_ACCELERATION_FACTOR_DEFAULT];
|
||||||
[UNIVERSE setSystemTo:system_seed];
|
[UNIVERSE setSystemTo:system_seed];
|
||||||
[UNIVERSE removeAllEntitiesExceptPlayer];
|
[UNIVERSE removeAllEntitiesExceptPlayer];
|
||||||
|
[UNIVERSE setGalaxySeed: galaxy_seed andReinit:YES]; // set overridden planet names on long range map
|
||||||
[UNIVERSE setUpSpace];
|
[UNIVERSE setUpSpace];
|
||||||
[UNIVERSE setAutoSaveNow:NO];
|
[UNIVERSE setAutoSaveNow:NO];
|
||||||
|
|
||||||
@ -529,7 +523,10 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
|||||||
else [dockedStation initialiseLocalMarketWithRandomFactor:market_rnd];
|
else [dockedStation initialiseLocalMarketWithRandomFactor:market_rnd];
|
||||||
}
|
}
|
||||||
[self calculateCurrentCargo];
|
[self calculateCurrentCargo];
|
||||||
[UNIVERSE setGalaxySeed: galaxy_seed andReinit:YES]; // set overridden planet names on long range map
|
|
||||||
|
// Remember the savegame target, run js startUp.
|
||||||
|
[self completeSetUpAndSetTarget:NO];
|
||||||
|
|
||||||
[[UNIVERSE gameView] supressKeysUntilKeyUp];
|
[[UNIVERSE gameView] supressKeysUntilKeyUp];
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
if (loadedOK) [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // trigger missionScreenOpportunity immediately after loading
|
if (loadedOK) [self doWorldEventUntilMissionScreen:OOJSID("missionScreenOpportunity")]; // trigger missionScreenOpportunity immediately after loading
|
||||||
|
@ -244,6 +244,7 @@ typedef OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS];
|
|||||||
- (int) drawGUI:(GLfloat) alpha drawCursor:(BOOL) drawCursor;
|
- (int) drawGUI:(GLfloat) alpha drawCursor:(BOOL) drawCursor;
|
||||||
- (void) drawGUIBackground;
|
- (void) drawGUIBackground;
|
||||||
- (void) setStatusPage:(int) pageNum;
|
- (void) setStatusPage:(int) pageNum;
|
||||||
|
- (void) refreshStarChart;
|
||||||
|
|
||||||
- (Random_Seed) targetNextFoundSystem:(int)direction;
|
- (Random_Seed) targetNextFoundSystem:(int)direction;
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
|
|||||||
|
|
||||||
@implementation GuiDisplayGen
|
@implementation GuiDisplayGen
|
||||||
|
|
||||||
|
static BOOL _refreshStarChart = NO;
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
@ -1095,6 +1097,12 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) refreshStarChart
|
||||||
|
{
|
||||||
|
_refreshStarChart = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (int) drawGUI:(GLfloat) alpha drawCursor:(BOOL) drawCursor
|
- (int) drawGUI:(GLfloat) alpha drawCursor:(BOOL) drawCursor
|
||||||
{
|
{
|
||||||
GLfloat x = drawPosition.x;
|
GLfloat x = drawPosition.x;
|
||||||
@ -1435,6 +1443,7 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
|||||||
//
|
//
|
||||||
// Cache nearby systems so that [UNIVERSE generateSystemData:] does not get called on every frame
|
// Cache nearby systems so that [UNIVERSE generateSystemData:] does not get called on every frame
|
||||||
// Caching code submitted by Y A J, 20091022
|
// Caching code submitted by Y A J, 20091022
|
||||||
|
|
||||||
static Random_Seed saved_galaxy_seed;
|
static Random_Seed saved_galaxy_seed;
|
||||||
static NSPoint saved_galaxy_coordinates;
|
static NSPoint saved_galaxy_coordinates;
|
||||||
static struct saved_system
|
static struct saved_system
|
||||||
@ -1445,11 +1454,12 @@ static OOTextureSprite *NewTextureSpriteWithDescriptor(NSDictionary *descriptor)
|
|||||||
} nearby_systems[ 256 ];
|
} nearby_systems[ 256 ];
|
||||||
static int num_nearby_systems;
|
static int num_nearby_systems;
|
||||||
|
|
||||||
if( !equal_seeds( [player galaxy_seed], saved_galaxy_seed ) ||
|
if ( _refreshStarChart || !equal_seeds( [player galaxy_seed], saved_galaxy_seed ) ||
|
||||||
galaxy_coordinates.x != saved_galaxy_coordinates.x ||
|
galaxy_coordinates.x != saved_galaxy_coordinates.x ||
|
||||||
galaxy_coordinates.y != saved_galaxy_coordinates.y )
|
galaxy_coordinates.y != saved_galaxy_coordinates.y )
|
||||||
{
|
{
|
||||||
// saved systems are stale; recompute
|
// saved systems are stale; recompute
|
||||||
|
_refreshStarChart = NO;
|
||||||
for (i = 0; i < num_nearby_systems; i++)
|
for (i = 0; i < num_nearby_systems; i++)
|
||||||
[nearby_systems[ i ].p_name release];
|
[nearby_systems[ i ].p_name release];
|
||||||
|
|
||||||
|
@ -6038,6 +6038,9 @@ static NSDictionary *sCachedSystemData = nil;
|
|||||||
BOOL sameSystem = (sameGalaxy && equal_seeds([self systemSeed], s_seed));
|
BOOL sameSystem = (sameGalaxy && equal_seeds([self systemSeed], s_seed));
|
||||||
NSDictionary *sysInfo = nil;
|
NSDictionary *sysInfo = nil;
|
||||||
|
|
||||||
|
// short range map fix
|
||||||
|
[gui refreshStarChart];
|
||||||
|
|
||||||
// long range map fixes
|
// long range map fixes
|
||||||
if ([key isEqualToString:KEY_NAME])
|
if ([key isEqualToString:KEY_NAME])
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user