Working on worlds.

It's currently crashing.
This commit is contained in:
Godzil
2020-02-19 18:05:48 +00:00
parent efe46e2864
commit a82b67faa4
11 changed files with 195 additions and 15 deletions

View File

@@ -17,16 +17,16 @@
Intersect::Intersect()
{
this->allocated = MIN_ALLOC;
this->list = (Intersection *)calloc(sizeof(Shape *), MIN_ALLOC);
this->list = (Intersection *)calloc(sizeof(Intersection *), MIN_ALLOC);
this->num = 0;
}
void Intersect::add(Intersection i)
{
if ((this->num + 1) < this->allocated)
if ((this->num + 1) > this->allocated)
{
this->allocated *= 2;
this->list = (Intersection *)realloc(this->list, sizeof(Shape *) * this->allocated);
this->list = (Intersection *)realloc(this->list, sizeof(Intersection *) * this->allocated);
}
this->list[this->num++] = i;
}