I am attempting to create an array of a structure, but I am having an inexplicable error (inexplicable to me, anyway).
Here is the relevant section of the code:
// Structure for human characters
struct Char_Struct
{
int Mesh; // .X mesh file for the character
int Type; // 0 = Player, 1 = Ally, 2 = Enemy, 3 = Neutral
float Position[3]; // XYZ coordinate of the character's initial position in the level
float Rotation; // The character's initial rotation in the level
float Health_Max; // If max <= 0 the character is dead right from the start and therefore
float Health_Current; // only exists as a corpse, otherwise he/she will die when current <= 0
int Alert_Mode; // 0 = undetected, 1 = alert, 2 = searching, 3 = detected
};
// Structure for cover objects
struct Cover_Struct
{
int Mesh; // .X mesh file for the cover object
float Position[3]; // XYZ coordinate for the cover object's position
float Rotation; // Rotation of the cover object
float Heath_Max; // If max < 0 the cover object is indestructible,
float Health_Current; // otherwise it will be destroyed when current <= 0
};
// Structure for levels
struct Level
{
int Mesh; // .X mesh file for the cover object
float End_Position[3]; // A cube that ends the level when
float End_Scale[3]; // entered by the player
struct Cover_Struct Cover[]; // Array of all the cover objects in the level
struct Char_Struct Character[]; // Array of all the human characters in the level
};
And here is the error:
1>------ Build started: Project: Project, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>c:\users\owner\my stuff\games\projects\game\project\main.cpp(56) : error C2229: struct 'Level' has an illegal zero-sized array
1>Build log was saved at "file://c:\Users\Owner\My Stuff\Games\Projects\Game\Project\Debug\BuildLog.htm"
1>Project - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What really confuses me is that the array for the characters doesn't work, but the one for the cover objects (my game will have a Gears of War style cover system) does work.
Hail to the king baby
I love Evil Dead.