Hello,

I have some troubles solving this compilation error:

Error: constructor cell.Cell.this (int x, int y, Noise noise) is not callable using argument types (int, int, Perlin)

The thing is Perlin implements the Noise interface.

Here is the line from cell.d throwing this error:

_terrain[h][w] = new Cell(w+offsetX,h+offsetY, Perlin.getInstance);

Here is the Cell constructor:
this(int x, int y, Noise noise) {
        _height = noise.getValue(x,y);
        _hasTree = uniform(0,2) == 0 ? true : false;
}

Perlin is a singleton with following code:
class Perlin : Noise{
        private:
                static Perlin _instance = null;
                this(){//some code}

        public:

                static Perlin getInstance(){
                        if(_instance is null){
                                _instance = new Perlin();
                        }
                        return _instance;
                }
}

The weirdest part is when I change the return type of the getInstance to Noise:
static Noise getInstance();

I get this error message:
Error: constructor cell.Cell.this (int x, int y, Noise noise) is not callable using argument types (int, int, Noise)

What am I doing wrong ?

Reply via email to