- Added fix to prevent docking ships getting far away holding positions

- Prevent a freeze when a worldScript tries to resurrects the player on dying because of an energy blast. (same fix as in shipEntity, r4624)

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4628 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2011-10-23 13:38:47 +00:00
parent de371c4fa9
commit 776b1964e3
2 changed files with 10 additions and 1 deletions

View File

@ -3983,9 +3983,10 @@ static bool minShieldLevelPercentageInitialised = false;
if (amount == 0.0) return;
BOOL energyMine = [ent isCascadeWeapon];
BOOL cascade = NO;
if (energyMine)
{
[self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
cascade = [self cascadeIfAppropriateWithDamageAmount:amount cascadeOwner:[ent owner]];
}
// make sure ent (& its position) is the attacking _ship_/missile !
@ -4048,6 +4049,7 @@ static bool minShieldLevelPercentageInitialised = false;
OOShipDamageType damageType = kOODamageTypeEnergy;
if (energyMine) damageType = kOODamageTypeCascadeWeapon;
[self noteTakingDamage:amount from:other type:damageType];
if (cascade) energy = 0.0; // explicit set energy to zero when cascading, in case an oxp raised the energy in previous line.
if (energy <= 0.0) //use normal ship temperature calculations for heat damage
{

View File

@ -670,6 +670,13 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
approach_spacing += 500; // space out incoming ships by 500m
// FIXME: Eric 23-10-2011: Below is a quick fix to prevent the approach_spacing from blowing up
// to high values because of bad AI's for docking ships that keep requesting and aborting docking.
// Post 1.76 this probably should replace it with a proper list of holding slots so that close by slots
// can be used again once the ship has left the Approach queue. In the current fix, resetting can
// result in two ships getting the same holding position.
if (approach_spacing > 2 * SCANNER_MAX_RANGE && approach_spacing / 500 > 5 * [shipsOnApproach count]) approach_spacing = 0;
// COMM-CHATTER
if (self == [UNIVERSE station])
[self sendExpandedMessage: @"[station-welcome]" toShip: ship];