I am trying to make a turn-based fighting game and there is a character class and a move class.
The error occurs when I was developing the character class part, in which there is a function TakeTurn(character oppoCharacter, cmove chosenMove, field currentField). It's meaning is letting the character object to cast a move against the opponent character. This function is composed with two other functions in the move class. First of them is spelling the move, and the other one is launching the move.
I tried everything I can and it still doesn't work. I guess the problem is related to the "this" pointer, but I am not sure.
In the character.cpp file:
void character::TakeTurn(character oppoCharacter, cmove chosenMove,field currentField){
chosenMove.SpellMove(this*, oppoCharacter, currentField.FStatusL);
chosenMove.LaunchMove(this*, oppoCharacter, currentField.FStatusL);
}
In the character.h file:
void TakeTurn(character oppoCharacter, cmove chosenMove,field currentField);
The error message:
[ 10%] Building CXX object CMakeFiles/gods.dir/character.cpp.o
/Users/otbooster/Downloads/2019up/cpp/gods/character.cpp:35:31: error: expected expression
chosenMove.SpellMove(this*, oppoCharacter, currentField.FStatusL);
^
/Users/otbooster/Downloads/2019up/cpp/gods/character.cpp:36:32: error: expected expression
chosenMove.LaunchMove(this*, oppoCharacter, currentField.FStatusL);
^
2 errors generated.
make[3]: *** [CMakeFiles/gods.dir/character.cpp.o] Error 1
make[2]: *** [CMakeFiles/gods.dir/all] Error 2
make[1]: *** [CMakeFiles/gods.dir/rule] Error 2
make: *** [gods] Error 2