Sign in to follow this  
firewall1

primary expression expected

Recommended Posts

firewall1    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this