Saturday, July 02, 2005

A user just found and reported an obscure bug in democracy. I've patched it and given him a new exe, but I'll wait a while before doing a full game update, as its quite a rare bug. He was reducing the number of smokers or drinkers to zero, and a crash happened when it tried to reduce them further. This takes some effort, as the rate of reduction is on a sliding scale, he must have really wanted clean living citizens!

the dodgy code was this :

int chosen = rand()%(Outputs.size());

where Outputs.size() could return 0. I just return early now if it is zero. Lesson learned, is that rand()%x is way too dangerous to use without checks. I will probably write some new wrapper code for rand() later and add it to my engine. Democracy is the most bug-free game I've ever written, and I'm hoping to make it 100% bug free.

I stupidly left my BF2 CD at work. As the game uses online authentication, a CD check seems somewhat redundant if you ask me (and very annoying).

In other news, I was contcated by a publisher interested in Democracy, although I'm not getting my hopes up, as publishers advance offers are often pretty low. The game sells so well online I'm in no hurry to sign a retail deal.