Boscop Member

Joined: 05 Sep 2007 Posts: 17 Location: Germany
|
Posted: Sat Dec 08, 2007 8:39 pm Post subject: |
|
|
I'm encountering another problem:
I need two varialbe-length arrays in a structure (in the LEVEL structure, more exactly) and tried this:
| c: | // Header File // Created 27.11.2007; 17:46:10 #ifndef ALIEN_H #define ALIEN_H #define COORD_SHIFT 7 typedef enum { MOVE, WAIT, SET_ANGLE, INC_ANGLE, DEC_ANGLE, SET_X, INC_X, DEC_X, SET_Y, INC_Y, DEC_Y, END_CODE, } COMMAND; typedef char CODE; typedef struct { const unsigned char *sprt; unsigned char width; unsigned char sprt_width; unsigned char sprt_height; } ALIEN_SPRITE; #define ALIEN_NUMBER 1 ALIEN_SPRITE alien_sprites[ALIEN_NUMBER] = { {_alien_1, 16, 2, 16}, }; typedef struct { short x, y; unsigned char angle; unsigned char speed; unsigned char id; //alien type unsigned char line; //line in the code unsigned char counter; CODE *code; } ALIEN; typedef struct { const short x, y; const unsigned char speed; const unsigned char id; //alien type const unsigned char group; const unsigned char line; //line in the code const unsigned char counter; } LEVEL_ALIEN; typedef struct { const unsigned char alien_nr; const LEVEL_ALIEN *aliens; const CODE *code; } LEVEL; #define LEVEL_NR 1 const LEVEL levels[LEVEL_NR] = { { 2, (const LEVEL_ALIEN *)&{ { 32, //x 32, //y 1, //speed 0, //type 0, //group 0, //line 0, //counter }, { 60, 32, 1, 0, 0, 0, 0, } }, (const CODE *)&{ DEC_ANGLE, 64, MOVE, 100, INC_ANGLE, 64, MOVE, 30, INC_ANGLE, 64, MOVE, 100, INC_ANGLE, 64, MOVE, 30, END_CODE, } }, }; const LEVEL *current_lvl; ALIEN *aliens;
|
but I get around 158 warnings, saying all the same:
'Initialization of ... makes pointer from integer without a cast'
and
'Braces around scalar initializer'
or
'Missing initializer, near declaration of...'
They are related to lines of the level's definition.
It didn't help to write casts into the definition...
What did I do wrong?
// EDIT by saubue: Added syntax highlighting |
|