OS X r1058 changes merged

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@183 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Dylan Smith 2005-10-30 10:39:35 +00:00
parent c125a3249c
commit bf067605d1
10 changed files with 250 additions and 53 deletions

View File

@ -1518,7 +1518,9 @@ static BOOL galactic_witchjump;
[universe displayCountdownMessage:[NSString stringWithFormat:[universe expandDescription:@"[witch-to-@-in-f-seconds]" forSystem:system_seed], [universe getSystemName:target_system_seed], witchspaceCountdown] forCount:1.0];
if (witchspaceCountdown == 0.0)
{
[self safe_all_missiles];
BOOL go = YES;
// check nearby masses
ShipEntity* blocker = (ShipEntity*)[universe entityForUniversalID:[self checkShipsInVicinityForWitchJumpExit]];
if (blocker)
{
@ -1526,9 +1528,23 @@ static BOOL galactic_witchjump;
[universe addMessage:[NSString stringWithFormat:[universe expandDescription:@"[witch-blocked-by-@]" forSystem:system_seed], [blocker name]] forCount: 4.5];
[witchAbortSound play];
status = STATUS_IN_FLIGHT;
go = NO;
}
else
// check fuel level
double fuel_required = 10.0 * distanceBetweenPlanetPositions(target_system_seed.d,target_system_seed.b,galaxy_coordinates.x,galaxy_coordinates.y);
if (fuel < fuel_required)
{
[universe clearPreviousMessage];
[universe addMessage:[universe expandDescription:@"[witch-no-fuel]" forSystem:system_seed] forCount: 4.5];
[witchAbortSound play];
status = STATUS_IN_FLIGHT;
go = NO;
}
if (go)
{
[self safe_all_missiles];
if (galactic_witchjump)
[self enterGalacticWitchspace];
else
@ -1550,7 +1566,6 @@ static BOOL galactic_witchjump;
if ([universe planet])
[universe addMessage:[NSString stringWithFormat:@" %@. ",[universe getSystemName:system_seed]] forCount:3.0];
else
// [universe addMessage:@"Witchspace engine malfunction!" forCount:3.0];
[universe addMessage:[universe expandDescription:@"[witch-engine-malfunction]" forSystem:system_seed] forCount:3.0];
status = STATUS_IN_FLIGHT;
@ -5426,6 +5441,7 @@ static BOOL toggling_music;
int n_mass = [self mass] / 10000;
int n_considered = n_cargo + n_mass;
int damage_to = ranrot_rand() % n_considered;
// cargo damage
if (damage_to < [cargo count])
{
ShipEntity* pod = (ShipEntity*)[cargo objectAtIndex:damage_to];
@ -5441,6 +5457,7 @@ static BOOL toggling_music;
{
damage_to = n_considered - (damage_to + 1); // reverse the die-roll
}
// equipment damage
if (damage_to < [extra_equipment count])
{
NSArray* systems = [extra_equipment allKeys];
@ -5463,7 +5480,11 @@ static BOOL toggling_music;
[self removeEquipment:system_key];
if (![universe strict])
[self add_extra_equipment:[NSString stringWithFormat:@"%@_DAMAGED", system_key]]; // for possible future repair
return;
}
//cosmetic damage
if ((damage_to & 7 == 7)&&(ship_trade_in_factor > 75))
ship_trade_in_factor--;
}
- (NSDictionary*) damageInformation

View File

@ -139,32 +139,57 @@ NSMutableDictionary* surface_cache;
[errors release];
errors = nil;
}
#ifndef WIN32
NSString *app_path = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Resources"];
NSString *addon_path = [[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"AddOns"];
#else
#ifdef WIN32
NSString *app_path = @"oolite.app/Contents/Resources";
NSString *addon_path = @"AddOns";
NSString *app_addon_path = @"AddOns";
NSString *appsupport_path=nil;
NSString *nix_path=nil;
#else
NSString* app_path = [[[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@"Contents"]
stringByAppendingPathComponent:@"Resources"];
NSString* app_addon_path = [[[[NSBundle mainBundle] bundlePath]
stringByDeletingLastPathComponent]
stringByAppendingPathComponent:@"AddOns"];
NSString* appsupport_path = [[[[NSHomeDirectory()
stringByAppendingPathComponent:@"Library"]
stringByAppendingPathComponent:@"Application Support"]
stringByAppendingPathComponent:@"Oolite"]
stringByAppendingPathComponent:@"AddOns"];
NSString* nix_path = [[NSHomeDirectory()
stringByAppendingPathComponent:@".Oolite"]
stringByAppendingPathComponent:@"AddOns"];
#endif
//
// set up the default locations to look for expansion packs
NSArray* extra_paths = [NSArray arrayWithObjects: app_addon_path, appsupport_path, nix_path, nil];
//
NSMutableArray *file_paths = [NSMutableArray arrayWithCapacity:16];
[file_paths addObject:app_path];
//
[file_paths addObject: app_path];
[file_paths addObjectsFromArray: extra_paths];
//
if (include_addons)
{
[file_paths addObject:addon_path];
NSMutableArray* possibleExpansionPaths = [NSMutableArray arrayWithCapacity: 16];
//
NSArray* possibleExpansions = [[NSFileManager defaultManager] directoryContentsAtPath:addon_path];
NSMutableArray* possibleExpansionPaths = [NSMutableArray arrayWithCapacity:[possibleExpansions count]];
for (i = 0; i < [possibleExpansions count]; i++)
// check the default locations for expansion packs..
for (i = 0; i < [extra_paths count]; i++)
{
NSString* item = (NSString *)[possibleExpansions objectAtIndex:i];
if (([[item pathExtension] isEqual:@"oxp"])||([[item pathExtension] isEqual:@"oolite_expansion_pack"]))
NSString* addon_path = (NSString*)[extra_paths objectAtIndex: i];
NSArray* possibleExpansions = [[NSFileManager defaultManager] directoryContentsAtPath: addon_path];
for (i = 0; i < [possibleExpansions count]; i++)
{
BOOL dir_test;
NSString* possibleExpansionPath = [addon_path stringByAppendingPathComponent:item];
[[NSFileManager defaultManager] fileExistsAtPath:possibleExpansionPath isDirectory:&dir_test];
if (dir_test)
[possibleExpansionPaths addObject:possibleExpansionPath];
NSString* item = (NSString *)[possibleExpansions objectAtIndex: i];
if (([[item pathExtension] isEqual:@"oxp"])||([[item pathExtension] isEqual:@"oolite_expansion_pack"]))
{
BOOL dir_test = NO;
NSString* possibleExpansionPath = [addon_path stringByAppendingPathComponent:item];
[[NSFileManager defaultManager] fileExistsAtPath:possibleExpansionPath isDirectory:&dir_test];
if (dir_test)
[possibleExpansionPaths addObject:possibleExpansionPath];
}
}
}
//

View File

@ -696,5 +696,141 @@
<integer>-2</integer> <integer>-3</integer>
<integer>-2</integer> <integer>1</integer>
</array>
<!-- human surname namegen -->
<key>nom</key>
<array>
<string>%R</string>
<string>[nom1]</string>
</array>
<key>nom1</key>
<array>
<string>ben [nom11]</string>
<string>Mc[nom11]</string>
<string>O'[nom11]</string>
<string>Ath[enom2]</string>
<string>Br[nomvoweliy]an</string>
<string>Bran[nom2]</string>
<string>C[nomvowelar][nom2]</string>
<string>D[nomvowelar][nom2]</string>
<string>Dav[nomvoweliy][nom2]</string>
<string>Denn[nomvoweliy][nom2]</string>
<string>Eccl[enom2]</string>
<string>Fa[nomvoweliy]r[nom2]</string>
<string>Folk[nom2]</string>
<string>Garr[enom2]</string>
<string>Good[nom2]</string>
<string>Hector</string>
<string>Inn[enom2]</string>
<string>Jam[enom2]</string>
<string>Jon[nom2]</string>
<string>Kir[nom2]</string>
<string>L[nomvoweliy]ttle[nom2]</string>
<string>L[nomvowelar][nom2]</string>
<string>Na[nomvoweliy]l[nom2]</string>
<string>Neil[nom2]</string>
<string>Peter[nom2]</string>
<string>Orbit[nom2]</string>
<string>Roger[nom2]</string>
<string>Sam[nom2]</string>
<string>Star[nom2]</string>
<string>Th[nomvowelur]r[nom2]</string>
<string>Wilkin[nom2]</string>
<string>William[nom2]</string>
<string>%H[nom2]</string>
<string>%R[nom2]</string>
<string>%R-[nom1]</string>
<string>[nom1]-[nom11]</string>
</array>
<key>nom11</key>
<array>
<string>Ath[enom2]</string>
<string>Br[nomvoweliy]an</string>
<string>Bran[nom2]</string>
<string>C[nomvowelar][nom2]</string>
<string>D[nomvowelar][nom2]</string>
<string>Dav[nomvoweliy][nom2]</string>
<string>Denn[nomvoweliy][nom2]</string>
<string>Folk[nom2]</string>
<string>Garri[nom2]</string>
<string>Good[nom2]</string>
<string>Hector</string>
<string>Inn[enom2]</string>
<string>Jam[enom2]</string>
<string>Jon[nom2]</string>
<string>Kir[nom2]</string>
<string>L[nomvoweliy]ttle[nom2]</string>
<string>L[nomvowelar][nom2]</string>
<string>Na[nomvoweliy]l[nom2]</string>
<string>Neil[nom2]</string>
<string>Peter[nom2]</string>
<string>Roger[nom2]</string>
<string>Sam[nom2]</string>
<string>Star[nom2]</string>
<string>Th[nomvowelur]r[nom2]</string>
<string>Wilkin[nom2]</string>
<string>William[nom2]</string>
<string>%H[nom2]</string>
<string>%R[nom2]</string>
</array>
<key>nom2</key>
<array>
<string></string>
<string>b[nomvowelur]rn</string>
<string>f[nomvowelur]r</string>
<string>st[nomvowelur]n</string>
<string>sen</string>
<string>son</string>
<string>son</string>
<string>sdott[nomvoweliy]r</string>
<string>s</string>
<string>s</string>
<string>sby</string>
<string>er</string>
<string>f[nomvoweliy]re</string>
<string>l[nomvoweliy]ng</string>
</array>
<key>enom2</key>
<array>
<string>e</string>
<string>[nomvowelie]b[nomvowelur]rn</string>
<string>[nomvowelie]f[nomvowelur]r</string>
<string>[nomvowelie]st[nomvowelur]n</string>
<string>[nomvowelie]sen</string>
<string>[nomvowelie]son</string>
<string>eson</string>
<string>[nomvowelie]sdott[nomvoweliy]r</string>
<string>[nomvowelie]s</string>
<string>es</string>
<string>esby</string>
<string>[nomvowelie]f[nomvoweliy]re</string>
<string>l[nomvoweliy]ng</string>
</array>
<key>nomvowelie</key>
<array>
<string>i</string>
<string>e</string>
<string>e</string>
<string>ie</string>
</array>
<key>nomvowelar</key>
<array>
<string>ar</string>
<string>aw</string>
<string>arre</string>
<string>our</string>
</array>
<key>nomvowelur</key>
<array>
<string>e</string>
<string>o</string>
<string>u</string>
<string>ou</string>
<string>ai</string>
</array>
<key>nomvoweliy</key>
<array>
<string>i</string>
<string>y</string>
</array>
</dict>
</plist>

View File

@ -1007,12 +1007,6 @@
<real>2</real>
<key>forward_weapon_type</key>
<string>WEAPON_NONE</string>
<key>has_ecm</key>
<false/>
<key>has_escape_pod</key>
<false/>
<key>has_scoop</key>
<false/>
<key>likely_cargo</key>
<integer>0</integer>
<key>max_cargo</key>

View File

@ -63,7 +63,7 @@
<key>CFBundleSignature</key>
<string>Ool8</string>
<key>CFBundleVersion</key>
<string>1.58</string>
<string>1.59</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

BIN
Resources/InfoPlist.strings Normal file

Binary file not shown.

View File

@ -509,10 +509,8 @@ Your fair use and other rights are in no way affected by the above.
isFrangible = YES;
//
if (dockingInstructions)
{
[dockingInstructions release];
dockingInstructions = nil;
}
dockingInstructions = nil;
}
- (id) initWithDictionary:(NSDictionary *) dict
@ -1513,7 +1511,7 @@ BOOL ship_canCollide (ShipEntity* ship)
double range = [self rangeToPrimaryTarget];
double distance = [self rangeToDestination];
double target_speed = max_flight_speed;
double slow_down_range = weapon_range * COMBAT_WEAPON_RANGE_FACTOR * ((isUsingAfterburner)? 2.0 * AFTERBURNER_FACTOR : 1.0);
double slow_down_range = weapon_range * COMBAT_WEAPON_RANGE_FACTOR * ((isUsingAfterburner)? 3.0 * AFTERBURNER_FACTOR : 1.0);
double max_cos = 0.995;
ShipEntity* target = (ShipEntity*)[universe entityForUniversalID:primaryTarget];
@ -1961,10 +1959,11 @@ BOOL ship_canCollide (ShipEntity* ship)
}
else
{
double eta = (desired_range - distance) / flight_speed;
// double eta = (desired_range - distance) / flight_speed;
desired_speed = max_flight_speed;
if ((eta < 1.0)&&(flight_speed > max_flight_speed*0.25))
desired_speed = flight_speed * 0.5; // cut speed to a minimum of 1/4 speed
// don't cut speed on retreating...
// if ((eta < 1.0)&&(flight_speed > max_flight_speed*0.25))
// desired_speed = flight_speed * 0.5; // cut speed to a minimum of 1/4 speed
}
[self trackDestination:delta_t:YES];
if ((proximity_alert != NO_TARGET)&&(proximity_alert != primaryTarget))
@ -5783,7 +5782,8 @@ inline BOOL pairOK(NSString* my_role, NSString* their_role)
if (primaryTarget == last_escort_target)
{
NSLog(@"DEBUG attempting to deploy more escorts onto same target - denied");
// already deployed escorts onto this target!
// NSLog(@"DEBUG attempting to deploy more escorts onto same target - denied");
return;
}

View File

@ -432,7 +432,8 @@ extern int debug;
- (NSString *) generatePhoneticSystemName:(Random_Seed) s_seed;
- (NSString *) generateSystemInhabitants:(Random_Seed) s_seed;
- (Random_Seed) findSystemAtCoords:(NSPoint) coords withGalaxySeed:(Random_Seed) gal_seed;
- (NSString*) systemSeedString:(Random_Seed) s;
+ (NSString*) systemSeedString:(Random_Seed) s;
- (NSArray*) nearbyDestinationsWithinRange:(double) range;
- (Random_Seed) findNeighbouringSystemToCoords:(NSPoint) coords withGalaxySeed:(Random_Seed) gal_seed;
- (Random_Seed) findConnectedSystemAtCoords:(NSPoint) coords withGalaxySeed:(Random_Seed) gal_seed;

View File

@ -981,8 +981,9 @@ Your fair use and other rights are in no way affected by the above.
[self populateSpaceFromActiveWormholes];
[self populateSpaceFromHyperPoint:[self getWitchspaceExitPosition] toPlanetPosition: a_planet->position andSunPosition: a_sun->position];
// log positions and info against debugging
// // log positions and info against debugging
// NSLog(@"DEBUG ** System :\t%@", [self generateSystemName:system_seed]);
// NSLog(@"DEBUG ** Planet position\t( %.0f, %.0f, %.0f)",
// a_planet->position.x, a_planet->position.y, a_planet->position.z);
@ -996,6 +997,16 @@ Your fair use and other rights are in no way affected by the above.
// NSLog(@"DEBUG ** Station q_station\t( %.3f, %.3f, %.3f, %.3f)",
// q_station.w, q_station.x, q_station.y, q_station.z);
// NSLog(@"DEBUG **\n\n");
// // debug name gen
// int i;
// Random_Seed p_seed = system_seed;
// for (i = 0; i < 200; i++)
// {
// rotate_seed(&p_seed);
// NSLog([NSString stringWithFormat:@"Human Name: %@ %@", [self expandDescription:@"%R" forSystem:p_seed], [self expandDescription:@"[nom]" forSystem:p_seed]]);
// }
/*- nav beacon -*/
@ -1157,7 +1168,7 @@ Your fair use and other rights are in no way affected by the above.
[whole setUniverse: self];
NSLog(@"DEBUG considering wormhole %@ destination %@ (system %@)",
whole, [self systemSeedString:[whole destination]], [self systemSeedString:system_seed]);
whole, [Universe systemSeedString:[whole destination]], [Universe systemSeedString:system_seed]);
if (equal_seeds( [whole destination], system_seed))
{
@ -4497,7 +4508,7 @@ Your fair use and other rights are in no way affected by the above.
ShipEntity* hit_entity = nil;
int result = NO_TARGET;
double nearest = SCANNER_MAX_RANGE;
double nearest = SCANNER_MAX_RANGE - 10; // 10m shorter than range at which target is lost
int i;
int ent_count = n_entities;
@ -4965,6 +4976,7 @@ Your fair use and other rights are in no way affected by the above.
{
if (!no_update)
{
NSString* update_stage = @"initialisation";
NS_DURING
int i;
PlayerEntity* player = (PlayerEntity *)[self entityZero];
@ -4985,6 +4997,7 @@ Your fair use and other rights are in no way affected by the above.
time_delta = delta_t;
universal_time += delta_t;
//
update_stage = @"demo management";
if ((demo_stage)&&(player)&&(player->status == STATUS_DEMO)&&(universal_time > demo_stage_time)&&([player gui_screen] == GUI_SCREEN_INTRO2))
{
if (ent_count > 1)
@ -5036,6 +5049,7 @@ Your fair use and other rights are in no way affected by the above.
}
//
update_stage = @"update:entity";
for (i = 0; i < ent_count; i++)
{
Entity *thing = my_entities[i];
@ -5066,6 +5080,7 @@ Your fair use and other rights are in no way affected by the above.
}
//
// lighting considerations..
update_stage = @"occlusion testing";
PlanetEntity* the_sun = cachedSun;
if (the_sun)
{
@ -5173,10 +5188,12 @@ Your fair use and other rights are in no way affected by the above.
}
//
//
update_stage = @"collision detection";
[self findCollisions];
//
// dispose of the non-mutable copy and everything it references neatly
//
update_stage = @"clean up";
for (i = 0; i < ent_count; i++)
[my_entities[i] release]; // explicitly release each one
@ -5186,14 +5203,13 @@ Your fair use and other rights are in no way affected by the above.
[self handleOoliteException:localException];
else
{
NSLog(@"\n\n***** Handling localException: %@ : %@ *****\n\n",[localException name], [localException reason]);
#ifndef GNUSTEP
if (![[self gameController] inFullScreenMode])
NSRunAlertPanel(@"Unexpected Error!", @"Error during [universe update:]\n\n'%@'", @"QUIT", nil, nil,localException);
else
#endif
NSLog(@"\n\n***** Quitting Oolite *****\n\n");
[[self gameController] exitApp];
NSLog(@"\n\n***** Encountered localException during %@ in [Universe update:] : %@ : %@ *****\n\n", update_stage, [localException name], [localException reason]);
// if (![[self gameController] inFullScreenMode])
// NSRunAlertPanel(@"Unexpected Error!", @"Error during [universe update:]\n\n'%@'", @"QUIT", nil, nil,localException);
// else
// NSLog(@"\n\n***** Quitting Oolite *****\n\n");
// [[self gameController] exitApp];
[localException raise];
}
NS_ENDHANDLER
@ -5517,7 +5533,7 @@ Your fair use and other rights are in no way affected by the above.
return system;
}
- (NSString*) systemSeedString:(Random_Seed) s
+ (NSString*) systemSeedString:(Random_Seed) s
{
return [NSString stringWithFormat: @"%d %d %d %d %d %d", s.a, s.b, s.c, s.d, s.e, s.f];
}
@ -5532,10 +5548,10 @@ Your fair use and other rights are in no way affected by the above.
for (i = 0; i < 256; i++)
{
double dist = distanceBetweenPlanetPositions(here.d, here.b, systems[i].d, systems[i].b);
if ((dist > 0) && (dist <= range))
if ((dist > 0) && (dist <= range) && (dist <= 7.0)) // limit to systems within 7LY
{
[result addObject: [NSDictionary dictionaryWithObjectsAndKeys:
[self systemSeedString:systems[i]], @"system_seed",
[Universe systemSeedString:systems[i]], @"system_seed",
[NSNumber numberWithDouble: dist], @"distance",
[self getSystemName:systems[i]], @"name",
nil]];
@ -6059,6 +6075,8 @@ double estimatedTimeForJourney(double distance, int hops)
// seed_for_planet_description(passenger_seed); // set the random number generator
seed_RNG_only_for_planet_description(passenger_seed);
NSString* passenger_name = [NSString stringWithFormat:@"%@ %@", [self expandDescription:@"%R" forSystem:passenger_seed], [self expandDescription:@"%R" forSystem:passenger_seed]];
if ([passenger_species_string hasPrefix:@"human"])
passenger_name = [NSString stringWithFormat:@"%@ %@", [self expandDescription:@"%R" forSystem:passenger_seed], [self expandDescription:@"[nom]" forSystem:passenger_seed]];
// determine information about the route...
NSDictionary* routeInfo = [self routeFromSystem:start ToSystem:passenger_destination];

View File

@ -133,6 +133,8 @@ Your fair use and other rights are in no way affected by the above.
[ship setPitch: 0.0];
[ship setRoll: 0.0];
[ship setBounty:[ship getBounty]/2]; // adjust legal status for new system
[universe addEntity:ship];
[[ship getAI] reactToMessage:@"EXITED WITCHSPACE"];
@ -157,8 +159,8 @@ Your fair use and other rights are in no way affected by the above.
- (NSString*) description
{
NSString* result = [[NSString alloc] initWithFormat:@"<WormholeEntity to %@ ttl: %.2fs>", [universe getSystemName: destination], WORMHOLE_EXPIRES_TIMEINTERVAL - time_counter];
return [result autorelease];
NSString* whereto = (universe)? [universe getSystemName: destination] : [Universe systemSeedString: destination];
return [NSString stringWithFormat:@"<WormholeEntity to %@ ttl: %.2fs>", whereto, WORMHOLE_EXPIRES_TIMEINTERVAL - time_counter];
}
- (BOOL) canCollide