The goal for this is to create a struct that includes a name, ID, fileName, and a boolean, then create an array of that structs. Here's what I came up with:
struct Amiibo
{
char *aName{};
char *ID{};
char *AudioFileName{};
bool alreadyPlayed{false};
};
Amiibo amii[20] = {
{"Mario","A5005B00","MARIO",false}, //0
{"Meta Knight","A5 00 02 00","MK"}, //1
{"Inkling", "A5 00 05 00","INK"}, //2
{"Donkey Kong","A5 00 01 00","DK"}, //3
{"Lucas","A5 00 0A 00","LUCAS"}, //4
{"Duck Hunt", "A5 00 08 00","DUCKH"}, //5
{"Ocarina of Time Link","A5 00 01 00","OOTL"}, //6
{"Breath of The Wild Link","random","BOTWL"}, //7
{"8-bit Link","random","8BITL"}, //8
{"Toon Link","random","TOONL"}, //9
{"Mr. Game and Watch","random","GANDW"}, //10
{"Falco","random","FALCO"}, //11
{"King Dedede","random","DEDEDE"}, //12
{"Mewtwo","random","MEWTWO"}, //13
{"Captain Falcon","random","CAPF"}, //14
{"ROB","random","ROB"}, //15
{"PAC-MAN","random","PACMAN"}, //16
{"Cloud","random","CLOUD"}, //17
{"Ness","random","NESS"}, //18
{"Ryu","random","RYU"} //19
};
This gives me the following error:
error: could not convert '{"Mario", "A5005B00", "MARIO", false}' from '' to 'Amiibo'
And the same error for all the other elements of the array. I tried changing amii[20] to a pointer using *amii[20]. That got me this error:
braces around scalar intializer for type "Amiibo"
I'm not sure what to make of that, since I'm fairly certain this isn't scalar type.
I'd really just like to make a struct array so I can cycle through these at random using a random seed. It shouldn't be that difficult, yet I'm running up against a wall. I'd appreciate any advice you all have to give. Thanks.
struct Amiibo {
...Amiibo(const char* name, const char* id, const char * audio) : aName{ name }, ID{ id }, AudioFileName{ audio } { ; }
and another one with 4 parameters... (btw you have to change internal types toconst char *
too, otherwise it'll yell about discarding qualifier)