Jump to content
  • Advertisement
Sign in to follow this  
SonicD007

parse error issue

This topic is 4527 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

Hi, I just got back to my game that I had left for some time now and it has a parse error on every Cahngeblah function. Not sure whats wrong. Here's the code.
#include <windows.h>
//--------------------------------------------------
//  Include Files
//--------------------------------------------------

#include "Player.h"
#include <string>
#include <fstream>
#include <iostream>

//---------------------------------------------------
//  Function Definitions
//---------------------------------------------------


int cPlayer::GetAttack()
{ 
    return P_Attack;
}

int cPlayer::GetMaxAttack()
{
    return P_MaxAttack;
}

int cPlayer::GetDefense()
{
    return P_Defense;
}

int cPlayer::GetMaxDefense()
{
    return P_MaxDefense;
}

int cPlayer::GetKi()
{
    return P_Ki;
}

int cPlayer::GetMaxKi()
{
    return P_MaxKi;
}

int cPlayer::GetLevel()
{
    return P_Level;
}

int cPlayer::GetExperience()
{
    return P_Experience;
}

int cPlayer::GetMaxExperience()
{
    return P_MaxExperience;
}

int cPlayer::GetPowerlevel()
{
    return P_Powerlevel;
}

int cPlayer::GetMaxPowerlevel()
{
    return P_MaxPowerlevel;
}

std::string cPlayer::GetName()
{
    return P_Name;
}

int cPlayer::GetZenni()
{
    return P_Zenni;
}

void cPlayer::SetName(std::string newname)
{
    P_Name = newname;
}

void cPlayer::SetAttack(int newattack)
{
    P_Attack = newattack;
}

void cPlayer::SetMaxAttack(int newmaxattack)
{
    P_MaxAttack = newmaxattack;
}

void cPlayer::SetDefense(int newdefense)
{
    P_Defense = newdefense;
}

void cPlayer::SetMaxDefense(int newmaxdefense)
{
    P_MaxDefense = newmaxdefense;
}

void cPlayer::SetExperience(int newexperience)
{
    P_Experience = newexperience;
}

void cPlayer::SetMaxExperience(int newmaxexperience)
{
    P_MaxExperience = newmaxexperience;
}

void cPlayer::SetZenni(int newzenni)
{
    P_Zenni = newzenni;
}

void cPlayer::SetKi(int newki)
{
    P_Ki = newki;
}

void cPlayer::SetMaxKi(int newmaxki)
{
    P_MaxKi = newmaxki;
}

void cPlayer::SetLevel(int newlevel)
{
    P_Level = newlevel;
}

void cPlayer::SetPowerlevel(int newpowerlvl)
{
    P_Powerlevel = newpowerlvl;
}

void cPlayer::SetMaxPowerlevel(int newmaxpowerlvl)
{
    P_MaxPowerlevel = newmaxpowerlvl;
}

void cPlayer::ChangeAttack(int amount)
{
    int newattack += amount;
}

void cPlayer::ChangeMaxAttack(int amount)
{
    int newmaxattack += amount;
}

void cPlayer::ChangeDefense(int amount)
{
    int newdefense += amount;
}

void cPlayer::ChangeMaxDefense(int amount)
{
    int newmaxdefense += amount;
}

void cPlayer::ChangeExperience(int amount)
{
    int newexperience += amount;
}

void cPlayer::ChangeMaxExperience(int amount)
{
    int newmaxexperience += amount;
}

void cPlayer::ChangeKi(int amount)
{
    int newki += amount;
}

void cPlayer::ChangeMaxKi(int amount)
{
    int newmaxki += amount;
}

void cPlayer::ChangePowerlevel(int amount)
{
    int newpowerlvl += amount;
}

void cPlayer::ChangeMaxPowerlevel(int amount)
{
    int newmaxpowerlvl += amount;
}

void cPlayer::ChangeZenni(int amount)
{
    int newzenni += amount;
}

parse error after += token Thats what it says for each Change function. I don't see where the mistake is.

Share this post


Link to post
Share on other sites
Advertisement
You declare a new int, don't initialize it, add something to it, and then throw it away. Why on earth would you do that?

Share this post


Link to post
Share on other sites
If you look closely at how the Change*() functions differ from the others, its that all the lines have the keyword "int" in them.

You may have wanted: ( taking one example )


void cPlayer::ChangeZenni(int amount)
{
P_Zenni += amount;
}

// instead of

void cPlayer::ChangeZenni(int amount)
{
int newzenni += amount;
}

Share this post


Link to post
Share on other sites
Also, if your get and set functions won't be doing anything other than getting and setting, you might as well make the member variables public.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!