small bug when charging for fuel v 1.72, and fuel capacity

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
bmaxa
Average
Average
Posts: 11
Joined: Thu Nov 06, 2008 2:14 pm
Location: Belgrade, Serbia

small bug when charging for fuel v 1.72, and fuel capacity

Post by bmaxa »

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:-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.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6629
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Hi bmaxa and welcome to the forums. Good to see a new member who fixes a bug on their first post.

Good catch with the fuel. Your fix has already hit SVN.
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

Great first post Bmaxa, you are very welcome to the Oolite Community.

Someone buy that man a Riedquat ale.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

Helecome to the forums Bmaxa
:D

By the way does anybody remember the first post of another_commander??

It was something like this

"Helo i have the code for a new equipment (advance navigational array) where do you want me to put it" :shock:
bmaxa
Average
Average
Posts: 11
Joined: Thu Nov 06, 2008 2:14 pm
Location: Belgrade, Serbia

Post by bmaxa »

Thank you all, I'm really hooked to this game ;)
StealthM93
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Tue Dec 30, 2008 3:41 pm

Still need to check for sufficient credits before debiting

Post by StealthM93 »

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. :)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6629
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Ha! We've got that smashed already! Fixed a few SVN revisions back :P
Will be OK for the next release (famous last words).
Oh, and welcome to Oolite.
Post Reply