diff --git a/PlayerEntity.m b/PlayerEntity.m index af0e9fc2..c53de6ae 100644 --- a/PlayerEntity.m +++ b/PlayerEntity.m @@ -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 diff --git a/ResourceManager.m b/ResourceManager.m index 3643d6d7..d5fc44ac 100644 --- a/ResourceManager.m +++ b/ResourceManager.m @@ -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]; + } } } // diff --git a/Resources/Config/descriptions.plist b/Resources/Config/descriptions.plist index ec95df94..44f548ab 100644 --- a/Resources/Config/descriptions.plist +++ b/Resources/Config/descriptions.plist @@ -696,5 +696,141 @@ -2 -3 -2 1 + + nom + + %R + [nom1] + + nom1 + + ben [nom11] + Mc[nom11] + O'[nom11] + Ath[enom2] + Br[nomvoweliy]an + Bran[nom2] + C[nomvowelar][nom2] + D[nomvowelar][nom2] + Dav[nomvoweliy][nom2] + Denn[nomvoweliy][nom2] + Eccl[enom2] + Fa[nomvoweliy]r[nom2] + Folk[nom2] + Garr[enom2] + Good[nom2] + Hector + Inn[enom2] + Jam[enom2] + Jon[nom2] + Kir[nom2] + L[nomvoweliy]ttle[nom2] + L[nomvowelar][nom2] + Na[nomvoweliy]l[nom2] + Neil[nom2] + Peter[nom2] + Orbit[nom2] + Roger[nom2] + Sam[nom2] + Star[nom2] + Th[nomvowelur]r[nom2] + Wilkin[nom2] + William[nom2] + %H[nom2] + %R[nom2] + %R-[nom1] + [nom1]-[nom11] + + nom11 + + Ath[enom2] + Br[nomvoweliy]an + Bran[nom2] + C[nomvowelar][nom2] + D[nomvowelar][nom2] + Dav[nomvoweliy][nom2] + Denn[nomvoweliy][nom2] + Folk[nom2] + Garri[nom2] + Good[nom2] + Hector + Inn[enom2] + Jam[enom2] + Jon[nom2] + Kir[nom2] + L[nomvoweliy]ttle[nom2] + L[nomvowelar][nom2] + Na[nomvoweliy]l[nom2] + Neil[nom2] + Peter[nom2] + Roger[nom2] + Sam[nom2] + Star[nom2] + Th[nomvowelur]r[nom2] + Wilkin[nom2] + William[nom2] + %H[nom2] + %R[nom2] + + nom2 + + + b[nomvowelur]rn + f[nomvowelur]r + st[nomvowelur]n + sen + son + son + sdott[nomvoweliy]r + s + s + sby + er + f[nomvoweliy]re + l[nomvoweliy]ng + + enom2 + + e + [nomvowelie]b[nomvowelur]rn + [nomvowelie]f[nomvowelur]r + [nomvowelie]st[nomvowelur]n + [nomvowelie]sen + [nomvowelie]son + eson + [nomvowelie]sdott[nomvoweliy]r + [nomvowelie]s + es + esby + [nomvowelie]f[nomvoweliy]re + l[nomvoweliy]ng + + nomvowelie + + i + e + e + ie + + nomvowelar + + ar + aw + arre + our + + nomvowelur + + e + o + u + ou + ai + + nomvoweliy + + i + y + diff --git a/Resources/Config/shipdata.plist b/Resources/Config/shipdata.plist index dbf28995..7e933bfa 100644 --- a/Resources/Config/shipdata.plist +++ b/Resources/Config/shipdata.plist @@ -1007,12 +1007,6 @@ 2 forward_weapon_type WEAPON_NONE - has_ecm - - has_escape_pod - - has_scoop - likely_cargo 0 max_cargo diff --git a/Resources/Info-Oolite.plist b/Resources/Info-Oolite.plist index 8a30e0c1..c41bb010 100644 --- a/Resources/Info-Oolite.plist +++ b/Resources/Info-Oolite.plist @@ -63,7 +63,7 @@ CFBundleSignature Ool8 CFBundleVersion - 1.58 + 1.59 NSMainNibFile MainMenu NSPrincipalClass diff --git a/Resources/InfoPlist.strings b/Resources/InfoPlist.strings new file mode 100644 index 00000000..188fa13c Binary files /dev/null and b/Resources/InfoPlist.strings differ diff --git a/ShipEntity.m b/ShipEntity.m index 9245b199..332ea950 100644 --- a/ShipEntity.m +++ b/ShipEntity.m @@ -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; } diff --git a/Universe.h b/Universe.h index b32c5324..bf9d9908 100644 --- a/Universe.h +++ b/Universe.h @@ -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; diff --git a/Universe.m b/Universe.m index 9f2b73ec..2e4639b9 100644 --- a/Universe.m +++ b/Universe.m @@ -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]; diff --git a/WormholeEntity.m b/WormholeEntity.m index fae33bce..60a5ee1e 100644 --- a/WormholeEntity.m +++ b/WormholeEntity.m @@ -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:@"", [universe getSystemName: destination], WORMHOLE_EXPIRES_TIMEINTERVAL - time_counter]; - return [result autorelease]; + NSString* whereto = (universe)? [universe getSystemName: destination] : [Universe systemSeedString: destination]; + return [NSString stringWithFormat:@"", whereto, WORMHOLE_EXPIRES_TIMEINTERVAL - time_counter]; } - (BOOL) canCollide