Original Post
languages with C like syntax allow you full control of layout etc, but this can cause bugs, like this one that kept me busy for 2 days. I had been refactoring my resource loading system and removed something from a render list class into something else, then gone for a cup of tea, leaving behind this code:
Spot the error.
Another one which wasted me a whole hour of a 48 hour competition, and can be blamed on me being too keen to accept suggestions from VS2k8 intellisense: (paraphrased)
The challenge - post your favorite dumbass coding mistakes that wasted time and/or money to find.
public void AddItem(Matrix position, IRenderable3D i)
{
// if we have run out of space, reallocate with 2x the amount of space
if (CurrentIndex >= capacity - 1)
Grow(2);
if(! i.GetMaterial().Linked)
this.
renderables[CurrentIndex].absolute_position = position;
renderables[CurrentIndex].item = i;
CurrentIndex++;
}
Spot the error.
Another one which wasted me a whole hour of a 48 hour competition, and can be blamed on me being too keen to accept suggestions from VS2k8 intellisense: (paraphrased)
void GameObject::SetSize(float w, float h)
{
this->width = w;
this->health = h;
}
The challenge - post your favorite dumbass coding mistakes that wasted time and/or money to find.
