I have checkouted svn from maintenance 1.72 dir and found
this:
this is how it should be:
if ([eq_key isEqual:@"EQ_FUEL"])
{
// change order
credits -= ([self fuelCapacity] - [self fuel]) * price_per_unit;
fuel = [self fuelCapacity];
[self setGuiToEquipShipScreen-1];
return YES;
}
in original code fuel is assigned before decreasing credits, making
fuel free of charge, I think.
Also implemented possibility for ships to have larger fuel
capacity then PLAYER_MAX_FUEL if someone is interested.
Change was simple. Added new var fuel_capacity in PlayerEntity
second version of dialFuel (dialFuelCapacity),
which is called from head up display in order to display ratio
fuel/capacity instead of fuel/PLAYER_MAX_FUEL.
One is is used for circle in galactic map and other for head up
display. Changed to refer to fuelCapacity instead of
PLAYER_MAX_FUEL where appropriate. Also added dictionary
key 'fuel_capacity' with which this variable is initialized.
Defaults to PLAYER_MAX_FUEL if not present for player ship
and to 'fuel' from dictionary for ai ships.
In this way ships cannot jump further then 7 lt years
but can have larger fuel capacity. This was inspired by:
"
// FIXME: shipdata.plist can allow greater fuel quantities (without extending hyperspace range). Need some consistency here.
"
Greets, to all.
Branimir.
small bug when charging for fuel v 1.72, and fuel capacity
Moderators: winston, another_commander, Getafix
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
-
- Mostly Harmless
- Posts: 3
- Joined: Tue Dec 30, 2008 3:41 pm
Still need to check for sufficient credits before debiting
Hello All,
My first post from an original Elite gamer back in the 80's while in high school. Lovin' Oolite! Thank you much!
Now, about the buying fuel issue...
While bmaxa has made a correct update, the solution does not appear to check for sufficient credits before debiting while buying fuel. If you have fewer credits than required to max out your fuel and you buy fuel anyway, the fuel cost is debited, resulting in a negative "flip" of the credits variable. However, because the credits variable appears to be a positive integer type only, the result of the negative flip is that you end up with a quadrillion credits.
My ten year old, who discovered the bug, has made the most of this bug.
My first post from an original Elite gamer back in the 80's while in high school. Lovin' Oolite! Thank you much!
Now, about the buying fuel issue...
While bmaxa has made a correct update, the solution does not appear to check for sufficient credits before debiting while buying fuel. If you have fewer credits than required to max out your fuel and you buy fuel anyway, the fuel cost is debited, resulting in a negative "flip" of the credits variable. However, because the credits variable appears to be a positive integer type only, the result of the negative flip is that you end up with a quadrillion credits.
My ten year old, who discovered the bug, has made the most of this bug.
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am