c++ - Function does not take 1 arguments when passing this into it -


i'm trying pass instance of this (the instance in question being gameengine class) playerbrain.run method takes gameengine * const argument corresponding this is. i'm curious cause such error thrown in case, when there no alternative function definitions run() or that. playerbrain own class, not descending anything. there's no alternative definitions run might cause problems. here's relevant code:

all public methods in playerbrain.h

#pragma once #include "gameengine.h" #include "species.h" #include "neuron.h" #include "genome.h" #include "genepool.h" #include "gene.h" #include <sys/stat.h> #include <vector> #include <iostream> #include <fstream> #include <windows.h> using namespace std;  class playerbrain { private:     int popsize;     int stalenessthreshold;     int timeoutconstant;     int currenttimeout;     int maxnodes;     int farthestdistance;     bool buttons[6]; // jason - shoot, left, right, up, down, jump in order     genepool p;      bool fileexists(string filename);     bool fitnessalreadymeasured();     void nextgenome();     void evaluatecurrent(genome * g);     void evaluatenetwork(vector<neuron*> * network, vector<int> inputs);     void loadpool(string filename);     double sigmoid(double sum);     vector<int> getinputs();     genome templategenome();     void pressakey();     void unpressakey();     vector<input *> oldbuttons;  public:     playerbrain();     void intialize();     void run(gameengine const *);     void close(); }; 

the actual implementation in .cpp

 void playerbrain::run(gameengine const * g) {     genome * current = p.getcurrentgenome();     int xpos = 0;     int bosslives = 0;     double fitness;     double timeoutbonus;      unpressakey();      if ((p.getcurrentframe() % 5) == 0)         evaluatecurrent(current);      pressakey();      xpos = g->getxposackvar();      bosslives = g->getbosslivesackvar();      if (xpos > farthestdistance) { farthestdistance = xpos; currenttimeout = timeoutconstant; }     currenttimeout--;     timeoutbonus = p.getcurrentframe() / 4;      if ((currenttimeout + timeoutbonus) <= 0) {          fitness = (farthestdistance - (p.getcurrentframe() / 2)) + 2000 * bosslives;          if (fitness == 0) { fitness = -1; }         current->setfitness(fitness);          if (fitness > p.getmaxfitness()) { p.setmaxfitness(fitness); }         p.setcurrentspecies(0);         p.setcurrentgenome(0);         while (fitnessalreadymeasured()) { nextgenome(); }     }     p.setcurrentframe(p.getcurrentframe() + 1); } 

the function call in gameengine.cpp`

while (true)     {            ......//irrelevant stuff             if (ticktimenow > ticktimetrigger)                 {                 if (dtimetrigger > m_painttimetrigger)                 {                     ....                     brain->run(this);                     ....                 }                 else sleep(1);             }             else waitmessage();         }     } 

the error follows: error c2660 'playerbrain::run': function not take 1 arguments


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -