negative cost for startfighter

I was introducing my nephew to GC on my laptop and he managed to get a negative value for the cost of the starfighter. He asked "does that mean I'll get money when I buy it?" Sure enough he got a gazillion credits. I think there needs to be a reasonableness check & assertion when 1) the price is read from the structure, 2) when the price is placed in the message to dialog box. If it is too much work to build an array (and hash its values so you know the array has not been stepped upon is still valid, perhaps just compare it to a global constant MAX_ITEM_COST. Needless to say all proper strategy and subtlety went out the window and it was buy, buy, buy: not quite the lesson I wanted him to learn.
Additionally, one of the report windows mentioned that 4 gaziliion percent of the population was unhappy. Having structures stepped on seems to a recurring issue, I know it is late in the development cycle but I am of the opinion that a code review to insert hash values and checking them on a turn by turn or even function call by function call basis might help localize their occurrance.
124 views 2 replies
Reply #1 Top
Er, rather than putting in checks to see if the bug is existing it would make sense to just fix the bug.

;)
Reply #2 Top
Fixing the bug would indeed be a Good Thing. There have been a number of occasions where structure values have been stomped on. As this is really a symptom of a deeper bug, it might not manifest itself in such a glaringly obvious fashion. An internal consistancy check assertion might flag early enough that that the time and effort of putting them in place might reduce debugging time over the course of several bugs as to pay for itself, especiqally since new logic, modules and other changes are being put in place on a regular basis. A well-thought out methodolgy would transfer over to "Mobilization" when it's development begins.
Anyway, here is more detail on the bug:

Build a Constructor to where you can still purchase the Constructor but it would compleat a scout.
Push purchase button then switch to the scout. The cost of the ship becomes a large negative value which, when you click purchase creats a credit into your account and voila enough funds to effortlessly conquer the galaxy.

I see there is a new build and will download and see if it still there.