Jump to content
  • Advertisement
Sign in to follow this  
firewall1

primary expression expected

This topic is 3892 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

my program wont compile because of an error i cant solve.. i have and c++ file that defines all of my class funtions, but in every function definition i have an error (sometimes 2 or 3) per function saying "primary expression expected before ")"" etc etc.. im stumped on how to debug this..
void room::Init(int newX, int newY, int newWidth, int newBreadth)
{
    X = newX;
    Y = newY;
    Width = newWidth + 1; // This is so the room is as wide as we told it to be
    Breadth = newBreadth + 1; // This is so the room is as tall as we told it to be
    ASCIIMan.Init(X + Width - 2, Y + Breadth - 2, PlayerASCII);
}

int room::getBreadth()
{
    return Breadth;
}

int room::getWidth()
{
    return Width;
}

int room::getX()
{
    return X;
}

int room::getY()
{
    return Y;
}

bool room::isWalkable(char newASCIIChar)
{
    int tile = newASCIIChar;

    if (tile == FloorTileASCII ||
        tile == PlayerASCII)
    {
        return true;
    }
    else
    {
        return false;
    }
}

Character room::getPlayer()
{
    return ASCIIMan;
}

void room::draw()
{
    int drawX = X;
    int drawY = Y;

    // Draw the floor tiles
    while(drawX < X + Width)
    {
        while(drawY < Y + Breadth)
        {
            // Draw tile drawX, drawY
            console.Draw(drawX, drawY, FloorTileASCII);
            drawY++;
        }
        drawX++;
        drawY = Y;
    }

    // Draw the walls
    drawX = X;
    while(drawX < X + Width)
    {
        console.Draw(drawX, Y, HorizontalWallASCII);
        console.Draw(drawX, Y + Breadth, HorizontalWallASCII);
        drawX++;
    }
    drawY = Y;
    while(drawY < Y + Breadth)
    {
        console.Draw(X, drawY, VerticalWallASCII);
        console.Draw(X + Width, drawY, VerticalWallASCII);
        drawY++;
    }

    // Draw the corners
    console.Draw(X, Y, TopLeftCornerASCII);
    console.Draw(X + Width, Y, TopRightCornerASCII);
    console.Draw(X + Width, Y + Breadth, BotRightCornerASCII);
    console.Draw(X, Y + Breadth, BotLeftCornerASCII);
}void room::Init(int newX, int newY, int newWidth, int newBreadth)
{
    X = newX;
    Y = newY;
    Width = newWidth + 1; // This is so the room is as wide as we told it to be
    Breadth = newBreadth + 1; // This is so the room is as tall as we told it to be
    ASCIIMan.Init(X + Width - 2, Y + Breadth - 2, PlayerASCII);
}

int room::getBreadth()
{
    return Breadth;
}

int room::getWidth()
{
    return Width;
}

int room::getX()
{
    return X;
}

int room::getY()
{
    return Y;
}

bool room::isWalkable(char newASCIIChar)
{
    int tile = newASCIIChar;

    if (tile == FloorTileASCII ||
        tile == PlayerASCII)
    {
        return true;
    }
    else
    {
        return false;
    }
}

Character room::getPlayer()
{
    return ASCIIMan;
}

void room::draw()
{
    int drawX = X;
    int drawY = Y;

    // Draw the floor tiles
    while(drawX < X + Width)
    {
        while(drawY < Y + Breadth)
        {
            // Draw tile drawX, drawY
            console.Draw(drawX, drawY, FloorTileASCII);
            drawY++;
        }
        drawX++;
        drawY = Y;
    }

    // Draw the walls
    drawX = X;
    while(drawX < X + Width)
    {
        console.Draw(drawX, Y, HorizontalWallASCII);
        console.Draw(drawX, Y + Breadth, HorizontalWallASCII);
        drawX++;
    }
    drawY = Y;
    while(drawY < Y + Breadth)
    {
        console.Draw(X, drawY, VerticalWallASCII);
        console.Draw(X + Width, drawY, VerticalWallASCII);
        drawY++;
    }

    // Draw the corners
    console.Draw(X, Y, TopLeftCornerASCII);
    console.Draw(X + Width, Y, TopRightCornerASCII);
    console.Draw(X + Width, Y + Breadth, BotRightCornerASCII);
    console.Draw(X, Y + Breadth, BotLeftCornerASCII);
}
if anymore information is required.. just tell me.. ill edit this post.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!