Fix edge-case for main station damage

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5635 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Chris Morris 2013-02-09 09:34:44 +00:00
parent 49ba30ef4a
commit a81a0f10cf
3 changed files with 17 additions and 4 deletions

View File

@ -16,6 +16,7 @@ Changes between Oolite 1.77 and Oolite 1.77.1:
* Reasonably skilled pilots will now remember to look where they're
going when fleeing
* Shields now also protect subentities
* Edge-case for damage to main station fixed
-------------------------------------------------------------------------------

View File

@ -4907,6 +4907,14 @@ static GLfloat sBaseMass = 0.0;
{
if (other == nil || [other isSubEntity]) return;
if (other == [UNIVERSE station])
{
// there is no way the player can destroy the main station
// and so the explosion will be cancelled, so there shouldn't
// be a kill award
return;
}
OOCreditsQuantity score = 10 * [other bounty];
OOScanClass killClass = [other scanClass]; // **tgape** change (+line)
BOOL killAward = [other countsAsKill];
@ -4929,7 +4937,7 @@ static GLfloat sBaseMass = 0.0;
}
}
}
credits += score;
if (score > 9)

View File

@ -11538,12 +11538,16 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
[self noteTakingDamage:amount from:other type:damageType];
if (cascade) energy = 0.0; // explicit set energy to zero in case an oxp raised the energy in previous line.
}
// die if I'm out of energy
if (energy <= 0.0)
{
if (hunter != nil) [hunter noteTargetDestroyed:self];
[self getDestroyedBy:other damageType:damageType];
// backup check just in case scripts have reduced energy
if (self != [UNIVERSE station])
{
if (hunter != nil) [hunter noteTargetDestroyed:self];
[self getDestroyedBy:other damageType:damageType];
}
}
else
{