Resubmitting fix for fail-to-buy multiple mount lasers, this time properly (I hope). Apologies for the previous mess.
This commit is contained in:
parent
81ec5bd9e0
commit
5cbf9c85e8
@ -10127,7 +10127,6 @@ static NSString *last_outfitting_key=nil;
|
|||||||
double priceFactor = 1.0;
|
double priceFactor = 1.0;
|
||||||
OOCreditsQuantity tradeIn = 0;
|
OOCreditsQuantity tradeIn = 0;
|
||||||
BOOL isRepair = NO;
|
BOOL isRepair = NO;
|
||||||
NSUInteger multiplier = 1;
|
|
||||||
|
|
||||||
// repairs cost 50%
|
// repairs cost 50%
|
||||||
if ([self hasEquipmentItem:eqKeyDamaged])
|
if ([self hasEquipmentItem:eqKeyDamaged])
|
||||||
@ -10143,45 +10142,6 @@ static NSString *last_outfitting_key=nil;
|
|||||||
|
|
||||||
price = [self adjustPriceByScriptForEqKey:eqKey withCurrent:price];
|
price = [self adjustPriceByScriptForEqKey:eqKey withCurrent:price];
|
||||||
|
|
||||||
// apply the multiple laser multiplier
|
|
||||||
if ([eqType isPrimaryWeapon])
|
|
||||||
{
|
|
||||||
switch (chosen_weapon_facing)
|
|
||||||
{
|
|
||||||
case WEAPON_FACING_FORWARD:
|
|
||||||
if (_multiplyWeapons)
|
|
||||||
{
|
|
||||||
multiplier = [forwardWeaponOffset count];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WEAPON_FACING_AFT:
|
|
||||||
if (_multiplyWeapons)
|
|
||||||
{
|
|
||||||
multiplier = [aftWeaponOffset count];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WEAPON_FACING_PORT:
|
|
||||||
if (_multiplyWeapons)
|
|
||||||
{
|
|
||||||
multiplier = [portWeaponOffset count];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WEAPON_FACING_STARBOARD:
|
|
||||||
if (_multiplyWeapons)
|
|
||||||
{
|
|
||||||
multiplier = [starboardWeaponOffset count];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WEAPON_FACING_NONE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
price *= multiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
StationEntity *dockedStation = [self dockedStation];
|
StationEntity *dockedStation = [self dockedStation];
|
||||||
if (dockedStation)
|
if (dockedStation)
|
||||||
{
|
{
|
||||||
@ -10192,7 +10152,6 @@ static NSString *last_outfitting_key=nil;
|
|||||||
|
|
||||||
if (price > credits)
|
if (price > credits)
|
||||||
{
|
{
|
||||||
// not enough money
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10207,33 +10166,76 @@ static NSString *last_outfitting_key=nil;
|
|||||||
OOWeaponType chosen_weapon = OOWeaponTypeFromEquipmentIdentifierStrict(eqKey);
|
OOWeaponType chosen_weapon = OOWeaponTypeFromEquipmentIdentifierStrict(eqKey);
|
||||||
OOWeaponType current_weapon = nil;
|
OOWeaponType current_weapon = nil;
|
||||||
|
|
||||||
|
NSUInteger multiplier = 1;
|
||||||
|
|
||||||
switch (chosen_weapon_facing)
|
switch (chosen_weapon_facing)
|
||||||
{
|
{
|
||||||
case WEAPON_FACING_FORWARD:
|
case WEAPON_FACING_FORWARD:
|
||||||
current_weapon = forward_weapon_type;
|
current_weapon = forward_weapon_type;
|
||||||
forward_weapon_type = chosen_weapon;
|
forward_weapon_type = chosen_weapon;
|
||||||
|
if (_multiplyWeapons)
|
||||||
|
{
|
||||||
|
multiplier = [forwardWeaponOffset count];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FACING_AFT:
|
case WEAPON_FACING_AFT:
|
||||||
current_weapon = aft_weapon_type;
|
current_weapon = aft_weapon_type;
|
||||||
aft_weapon_type = chosen_weapon;
|
aft_weapon_type = chosen_weapon;
|
||||||
|
if (_multiplyWeapons)
|
||||||
|
{
|
||||||
|
multiplier = [aftWeaponOffset count];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FACING_PORT:
|
case WEAPON_FACING_PORT:
|
||||||
current_weapon = port_weapon_type;
|
current_weapon = port_weapon_type;
|
||||||
port_weapon_type = chosen_weapon;
|
port_weapon_type = chosen_weapon;
|
||||||
|
if (_multiplyWeapons)
|
||||||
|
{
|
||||||
|
multiplier = [portWeaponOffset count];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FACING_STARBOARD:
|
case WEAPON_FACING_STARBOARD:
|
||||||
current_weapon = starboard_weapon_type;
|
current_weapon = starboard_weapon_type;
|
||||||
starboard_weapon_type = chosen_weapon;
|
starboard_weapon_type = chosen_weapon;
|
||||||
|
if (_multiplyWeapons)
|
||||||
|
{
|
||||||
|
multiplier = [starboardWeaponOffset count];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WEAPON_FACING_NONE:
|
case WEAPON_FACING_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we've already checked for price being less than available credits, so we're good to go here
|
price *= multiplier;
|
||||||
|
|
||||||
|
if (price > credits)
|
||||||
|
{
|
||||||
|
// not enough money - ensure that weapon
|
||||||
|
// type is reset to what it was before
|
||||||
|
// the attempt to buy took place
|
||||||
|
switch (chosen_weapon_facing)
|
||||||
|
{
|
||||||
|
case WEAPON_FACING_FORWARD:
|
||||||
|
forward_weapon_type = current_weapon;
|
||||||
|
break;
|
||||||
|
case WEAPON_FACING_AFT:
|
||||||
|
aft_weapon_type = current_weapon;
|
||||||
|
break;
|
||||||
|
case WEAPON_FACING_PORT:
|
||||||
|
port_weapon_type = current_weapon;
|
||||||
|
break;
|
||||||
|
case WEAPON_FACING_STARBOARD:
|
||||||
|
starboard_weapon_type = current_weapon;
|
||||||
|
break;
|
||||||
|
case WEAPON_FACING_NONE:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
credits -= price;
|
credits -= price;
|
||||||
|
|
||||||
// Refund current_weapon
|
// Refund current_weapon
|
||||||
|
Loading…
x
Reference in New Issue
Block a user