Thursday, March 04, 2010

NewStars Status

Cool little bug managed to waste a week of John's time...

I had noticed a difference in surface minerals for player 1 in 2401. Examining the mining code indicated it was probably due to scrapping the JOAT remote miner.

The code which calculates ship cost and scrap value is pretty complicated, so it seemed natural the bug would be there.

After digging into it, it became apparent that the bug was due to the miner being on a destroyer hull!

This is due to a copy/paste bug in the code which gives players their initial fleets:
In function makeInitialJoatMiner (copied from the make destroyer code)
Ship *design = new Ship(*(pd->gd_->hullList[destroyer_hull]));

Oops.

1 comment:

jdevale said...

Well, even though it wasted some of my time, it did cause me to notice a bunch of "Add code here" type comments I had left in the master/client reconciliation code. Now the server code would have flagged this error since the destroyer design was invalid. Also, the server actually trusted the ship design details embedded in a fleet object provided by the client! Talk about naive...