Initializer must be braced enclosed?

Getting error: 59 C:\Users\Valued Customer\Desktop\Game\main.cpp initializer for `MoveData' must be brace-enclosed

I know it has to do with the nested struct, because it works if I remove it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <cstdlib>
#include <iostream>
#include <string>
#include <ctime>
#include <windows.h>

using namespace std;

      struct MoveData{
             struct Physical{
             string name;
             int type,
                 power,
                 accuracy,
                 uses;
             string effect;
             };
             };

      struct MonsterData{
             string name;
             int level,
                 exp,
                 type1,
                 type2,
                 lp,
                 attack,
                 defense,
                 special,
                 speed;
             MoveData moveset[4];
                 };

      struct ItemData{
             string name;
             };

      struct TrainerData{
             string name;
             MonsterData Party[5],
                         Storage[150];
             ItemData Inventory[20],
                      Bank[100];
             };

int main()
{
    MoveData::Physical allMove[] =
    {
             {"Pound", 1, 40, 100, 35},
             {"Scratch", 1, 50, 90, 30}
    };

    MonsterData allMonster[] =
    {
                 {"Bulbasuar", 1, 0, 11, 4, 45, 49, 49, 65, 45, allMove[0]},
                 {"Charmander", 1,  9, 0, 39, 52, 43, 60, 65},
                 {"Squirtle", 1, 0, 10, 0, 44, 48, 65, 64, 43}
    };

    system("PAUSE");
    return 0;
}
MonsterData contains array of MoveData.
But your allMove contain dara of type MoveData::Physical which is not MoveData and cannot be used to initialize it.
Remove allMove[0] from initializer list.
Topic archived. No new replies allowed.