Неразрешенный внешний символ где-то. Не могу найти. Требуется помощь

Я воссоздаю pacMan из visual studio как проект для своего класса структур данных. Пока в моем коде есть неразрешенный внешний символ, но я не могу найти, что вызывает его в коде. Я написал четыре класса; Игрок, Актер, Лабиринт и Игра. Вот они

Игрок:

class player :public Actor {

public:
    player(Game*game, CConsole* gameConsole) :Actor(game, gameConsole){};

    void testAMove(){
        char in;
        gameConsole->getInput(in);
        if (gameConsole->getInput(in) == '4'){
            gameConsole->printChar(playerX, playerY, ' ');
            gameConsole->printChar(playerX - 1, playerY, '@'); 
            pelletCount--;
        }
        else if (gameConsole->getInput(in) == '6'){
            gameConsole->printChar(playerX, playerY, ' ');
            gameConsole->printChar(playerX + 1, playerY, '@');
            pelletCount--;
        }
        else if (gameConsole->getInput(in) == '2'){
            gameConsole->printChar(playerX, playerY, ' ');
            gameConsole->printChar(playerX, playerY-1, '@');
            pelletCount--;
        }
        else if (gameConsole->getInput(in) == '8'){
            gameConsole->printChar(playerX, playerY, ' ');
            gameConsole->printChar(playerX, playerY+1, '@');
            pelletCount--;
        }
}
private:
    int playerX;
    int playerY;
    Game* gamePointer;
    CConsole* gameConsole;
};

Игра:

class Game{
    public:
        Game(int delay){ 
            wait = delay;
            gacMan = new Game(wait);
            gameConsole = new CConsole(64, 24);
            maze = new Maze(gameConsole); 
            actor = new Actor(gacMan, gameConsole);
            gamer = new player(gacMan, gameConsole);
        }
        ~Game(){};// game destructor
        void testRun(){
            maze->loadMaze("MAZE0.TXT");
            maze->display();
            maze->displayActors();
            while (!mazeComplete){ gamer->testAMove(); }
        }
        int getPlayerStartX(){  
            return maze->playerXStart();
        } 
        int getPlayerStartY(){
            return maze->playerYstart();
        }
        bool mazeComplete(){
            if (getPelletCount() == 0) return true;
            else return false;
        }  
        int getPelletCount(){ return maze->getPellets(); }

    private:
        Maze* maze; 
        Actor* actor;
        player* gamer;
        Game* gacMan;
        CConsole* gameConsole;
        int wait; 
};

Актер:

class Actor{
    public:
         Actor(Game*game, CConsole* gameConsole){
            gamePointer = game;
            playerX = gamePointer->getPlayerStartX();
            playerY = gamePointer->getPlayerStartY();
            pelletCount = game->getPelletCount();
            console = gameConsole;
        } 
        virtual int getX(){
        return playerX; }
        virtual int getY(){ return playerY; }
       //virtual void move(){};

 private:
    Game* gamePointer;
    int playerX;
    int playerY; 
    CConsole* console;
protected:
    int pelletCount; 
}; 

Лабиринт:

class Maze {
public:
    Maze(CConsole*gameConsole){ console = gameConsole; }
    void display() const{

        for (int i = 0; i < HEIGHT; i++)
        {
            for (int j = 0; j < WIDTH; j++){ console->printChar(j, i,  gameBoard[i][j]); }
        }

    }; //prints walls to screen
    void displayActors() const{
        char ghostRoom = 'M';
        char gacMan = '@';
        console->setColor(blue, white);
        console->printChar(monsterX, monsterY, ghostRoom); // prints blue M on white background
        console->setColor(black, red);
        console->printChar(playerX, playerY, gacMan); // prints black @ on red background
    } 


    //prints @ in black on red background at position indicated in maze file by the @
    //print a blue M on a while background at position indicated in maze file by the $
    bool loadMaze(const string &filename){
        ifstream inFile;
        bool loaded = false; 
        pellets = 0;
        int height = 21;
        int width = 23;
        inFile.open(filename);
        if (inFile.is_open()){ loaded = true; }
        else{ return false; }
        for (int i = 0; i < HEIGHT; i++)
        {
            for (int j = 0; j < WIDTH; j++)
            {
                inFile.get(gameBoard[i][j]);
                if (gameBoard[i][j] == '$'){
                    monsterX = j;
                    monsterY = i;
                    gameBoard[i][j] = ' ';
                }    
                if (gameBoard[i][j] == '@'){ playerX = j; playerY = i; gameBoard[i][j] = ' '; }
                if (gameBoard[i][j] == '.'||'*'){ pellets++; }
            }
            inFile.get();

        }
        return loaded;
    }
    int getPellets(){ return pellets; };  
    int playerXStart(){
        return playerX;
    }
    int playerYstart(){
        return playerY;
    }//does NOT display anything to screen
    //returns true iff filename exists, you may assume it will be a valid maze file
    //store as needed so you can display it the same way it looks in the file
private:
    int playerX, playerY;//values set by loadMaze and used by displayActors as starting
    int monsterX, monsterY;
    int pellets;
    char gameBoard[21][23];
    CConsole * console; 
}; 

Что я делаю? Что я должен исправить? Если бы кто-нибудь мог помочь мне, я был бы очень признателен. Благодарю.

0 ответов

Другие вопросы по тегам