parent
72d36140b3
commit
640e6ffde2
|
@ -19,7 +19,12 @@ GameAccount::GameAccount(string iName){
|
|||
name = iName;
|
||||
setLevel(new Primary(this));
|
||||
}
|
||||
|
||||
GameAccount::~GameAccount(){
|
||||
if(level){
|
||||
delete level;
|
||||
level = nullptr;
|
||||
}
|
||||
}
|
||||
void GameAccount::setLevel(Level* iLevel){
|
||||
if(level != nullptr){
|
||||
delete level;
|
||||
|
@ -48,6 +53,7 @@ void GameAccount::playCard(){
|
|||
this->level->upgradeLevel();
|
||||
}
|
||||
|
||||
|
||||
void GameAccount::win(){
|
||||
if (this->getScore() < 200){
|
||||
setScore(getScore() + 50);
|
|
@ -13,12 +13,7 @@ public:
|
|||
GameAccount(string iName);
|
||||
GameAccount(const GameAccount&) = delete;
|
||||
GameAccount& operator=(const GameAccount&) = delete;
|
||||
~GameAccount(){
|
||||
if(level){
|
||||
delete level;
|
||||
level = nullptr;
|
||||
}
|
||||
}
|
||||
~GameAccount();
|
||||
string getName();
|
||||
void win();
|
||||
void lose();
|
||||
|
@ -33,4 +28,4 @@ private:
|
|||
string name;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -66,7 +66,6 @@ Secondary::Secondary(){
|
|||
|
||||
Secondary::Secondary(Level* level){
|
||||
this->setGameAccount(level->getGameAccount());
|
||||
getGameAccount()->setLevel(level);
|
||||
}
|
||||
|
||||
void Secondary::doubleScore(){
|
||||
|
@ -99,7 +98,6 @@ Professional::Professional(){
|
|||
|
||||
Professional::Professional(Level* level){
|
||||
this->setGameAccount(level->getGameAccount());
|
||||
getGameAccount()->setLevel(level);
|
||||
}
|
||||
|
||||
void Professional::doubleScore(){
|
||||
|
@ -132,7 +130,6 @@ Final::Final(){
|
|||
|
||||
Final::Final(Level* level){
|
||||
this->setGameAccount(level->getGameAccount());
|
||||
getGameAccount()->setLevel(level);
|
||||
}
|
||||
|
||||
void Final::doubleScore(){
|
||||
|
|
Loading…
Reference in New Issue