I'm trying to create a class that contains structs of the following types:
struct gameObject
{
int row; // row position of the object
int column; // column position of the object
bool isFound; // flag to indicate if the object has been found (or is dead, in the case of the monster)
bool isVisible; // flag to indicate if the object can be seen on the board -add in week 4
};
struct playerObject
{
bool alive; // flag to indicate if the player is alive or dead
bool hasWeapon; // flag to indicate if the player has the weapon
bool hasTreasure; // flag to indicate if the player has the treasure
bool hasTorch; // flag to indicate if the player has the torch -add in week 4
bool hasNoisemaker; // flag to indicate if the player has the noisemaker -add in week 4
bool hasKey;
gameObject position; // variables for row, column and visibility
};
I'm doing this so I can have all of my "game pieces" and their data under one object to hopefully help with readability. The class I'm trying to declare is below:
class pieces{//the class for the game and player objects
public:
pieces();
~pieces();
gameObjectType hold = EMPTY; // Holds objects under the monster<bug fix>
// </WK6>
playerObject player = { true, false, false, false, false, false, { -1, -1, false, true } }; // the player
gameObject treasure ={ -1, -1, false, true }; // the treasure
gameObject monster = { -1, -1, false, true }; // the monster
gameObject weapon = { -1, -1, false, true }; // the weapon
gameObject torch = { -1, -1, false, true }; // the torch
gameObject noisemaker = { -1, -1, false, true }; // the noisemaker
gameObject key = { -1, -1, false, true };
gameObject caveExit = { -1, -1, false, true }; // the cave exit
};
The problem is that I keep getting a C2661 error. For all of my gameObject declarations it says error C2661: 'gameObject::gameObject' : no overloaded function takes 4 arguments
However, for my playerObject, it says the same except with 7 arguments instead of 4.
I've been at it for hours and I can't figure out what's going on.