From 7b10050a21caeb94ee3adf5a38a332b26482cf7f Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Tue, 23 Mar 2004 17:25:15 +0000 Subject: [PATCH] - removed unneded typedef's for structs SVN-Revision: 329 --- src/badguy.h | 27 +++++++++++++-------------- src/bitmask.h | 4 ++-- src/button.h | 46 ++++++++++++++++++++++------------------------ src/gameloop.cpp | 1 - src/level.h | 5 ++--- src/leveleditor.h | 9 ++++----- src/menu.h | 10 ++++------ src/physic.h | 15 +++++++-------- src/player.h | 5 ++--- src/special.h | 24 +++++++++++------------- src/text.h | 17 ++++++++--------- src/texture.h | 14 +++++++------- src/timer.h | 13 ++++++------- src/type.h | 33 +++++++++++++++------------------ src/world.h | 48 ++++++++++++++++++++++-------------------------- 15 files changed, 125 insertions(+), 146 deletions(-) diff --git a/src/badguy.h b/src/badguy.h index 60b74c308..b30807b0f 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -30,20 +30,19 @@ /* Badguy type: */ -typedef struct bad_guy_type - { - int mode; - DyingType dying; - int kind; - bool seen; - int dir; - int frame; - base_type base; - base_type old_base; - timer_type timer; - physic_type physic; - } -bad_guy_type; +struct bad_guy_type +{ + int mode; + DyingType dying; + int kind; + bool seen; + int dir; + int frame; + base_type base; + base_type old_base; + timer_type timer; + physic_type physic; +}; /* Bad guy kinds: */ diff --git a/src/bitmask.h b/src/bitmask.h index cc2b9a430..915b21c59 100644 --- a/src/bitmask.h +++ b/src/bitmask.h @@ -84,11 +84,11 @@ #define BITW_MASK 31 #define BITN(n) ((BITW)1 << (n)) -typedef struct bitmask +struct bitmask { int w,h; BITW *bits; -} bitmask; +}; /* Creates a bitmask of width w and height h. * The mask is automatically cleared when created. diff --git a/src/button.h b/src/button.h index ee86dfede..5af5d35e2 100644 --- a/src/button.h +++ b/src/button.h @@ -22,21 +22,20 @@ enum ButtonState { BUTTON_HOVER }; -typedef struct button_type - { - texture_type icon; - texture_type* bkgd; - char *info; - SDLKey shortcut; - int x; - int y; - int w; - int h; - bool show_info; - ButtonState state; - int tag; - } -button_type; +struct button_type +{ + texture_type icon; + texture_type* bkgd; + char *info; + SDLKey shortcut; + int x; + int y; + int w; + int h; + bool show_info; + ButtonState state; + int tag; +}; void button_load(button_type* pbutton,char* icon_file, char* info, SDLKey shortcut, int x, int y); button_type* button_create(char* icon_file, char* info, SDLKey shortcut, int x, int y); @@ -46,15 +45,14 @@ void button_free(button_type* pbutton); void button_event(button_type* pbutton, SDL_Event* event); int button_get_state(button_type* pbutton); -typedef struct button_panel_type - { - int num_items; - int hidden; - int x,y; - int w,h; - button_type* item; - } -button_panel_type; +struct button_panel_type +{ + int num_items; + int hidden; + int x,y; + int w,h; + button_type* item; +}; void button_panel_init(button_panel_type* pbutton_panel, int x, int y, int w, int h); void button_panel_free(button_panel_type* pbutton_panel); diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 1d071e378..084be64a1 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -1326,7 +1326,6 @@ void drawshape(float x, float y, unsigned char c) texture_draw(&img_solid[3], x, y); else if (c == '$') { - z = (frame / 2) % 6; if (z < 4) diff --git a/src/level.h b/src/level.h index aefc1ee28..f9cdbff7e 100644 --- a/src/level.h +++ b/src/level.h @@ -40,7 +40,7 @@ class st_subset #define LEVEL_NAME_MAX 20 -typedef struct st_level +struct st_level { std::string name; std::string theme; @@ -53,8 +53,7 @@ typedef struct st_level int bkgd_blue; int width; float gravity; -} -st_level; +}; extern texture_type img_bkgd, img_bkgd_tile[2][4], img_solid[4], img_brick[2]; diff --git a/src/leveleditor.h b/src/leveleditor.h index 8c83582d7..5e6b6d769 100644 --- a/src/leveleditor.h +++ b/src/leveleditor.h @@ -16,11 +16,10 @@ #ifndef SUPERTUX_LEVELEDITOR_H #define SUPERTUX_LEVELEDITOR_H -typedef struct square - { - int x1, y1, x2, y2; - } -square; +struct square +{ + int x1, y1, x2, y2; +}; /* selection modes */ enum { diff --git a/src/menu.h b/src/menu.h index 7cf9dbec0..fc991a4c6 100644 --- a/src/menu.h +++ b/src/menu.h @@ -32,7 +32,7 @@ enum MenuItemKind { MN_HL /* horizontal line */ }; -typedef struct menu_item_type +struct menu_item_type { MenuItemKind kind; int toggled; @@ -40,14 +40,13 @@ typedef struct menu_item_type char *input; string_list_type* list; void* target_menu; - } -menu_item_type; +}; menu_item_type* menu_item_create(MenuItemKind kind, char *text, int init_toggle, void* target_menu); void menu_item_change_text (menu_item_type* pmenu_item, const char *text); void menu_item_change_input(menu_item_type* pmenu_item, const char *text); -typedef struct menu_type +struct menu_type { // center of the menu on the screen int x; @@ -58,8 +57,7 @@ typedef struct menu_type int arrange_left; menu_item_type *item; timer_type effect; -} -menu_type; +}; void menu_init (menu_type* pmenu); void menu_free (menu_type* pmenu); diff --git a/src/physic.h b/src/physic.h index 38f923f20..f980bcb8c 100644 --- a/src/physic.h +++ b/src/physic.h @@ -22,15 +22,14 @@ enum { /* Physic type: */ -typedef struct physic_type +struct physic_type { - int state; - float start_vy; - float start_vx; - float acceleration; - unsigned int start_time; - } -physic_type; + int state; + float start_vy; + float start_vx; + float acceleration; + unsigned int start_time; +}; /* global variables. */ extern float gravity; diff --git a/src/player.h b/src/player.h index 488432472..cdbd0cb2b 100644 --- a/src/player.h +++ b/src/player.h @@ -58,7 +58,7 @@ struct player_input_type void player_input_init(player_input_type* pplayer_input); -typedef struct player_type +struct player_type { player_input_type input; player_keymap_type keymap; @@ -82,8 +82,7 @@ typedef struct player_type timer_type frame_timer; physic_type vphysic; physic_type hphysic; -} -player_type; +}; extern texture_type tux_life, tux_right[3], tux_left[3], diff --git a/src/special.h b/src/special.h index 379979dc2..2bdb6dd5c 100644 --- a/src/special.h +++ b/src/special.h @@ -31,20 +31,18 @@ enum { UPGRADE_HERRING }; -typedef struct upgrade_type - { - int kind; - base_type base; - base_type old_base; - } -upgrade_type; +struct upgrade_type +{ + int kind; + base_type base; + base_type old_base; +}; -typedef struct bullet_type - { - base_type base; - base_type old_base; - } -bullet_type; +struct bullet_type +{ + base_type base; + base_type old_base; +}; extern texture_type img_bullet; extern bitmask* bm_bullet; diff --git a/src/text.h b/src/text.h index 0e8b99563..f14343fc3 100644 --- a/src/text.h +++ b/src/text.h @@ -16,15 +16,14 @@ #include "texture.h" /* Text type */ -typedef struct text_type - { - texture_type chars; - texture_type shadow_chars; - int kind; - int w; - int h; - } -text_type; +struct text_type +{ + texture_type chars; + texture_type shadow_chars; + int kind; + int w; + int h; +}; /* Kinds of texts. */ enum { diff --git a/src/texture.h b/src/texture.h index 7b83befa6..06bc1ddb4 100644 --- a/src/texture.h +++ b/src/texture.h @@ -22,13 +22,13 @@ #include "screen.h" /* Texture type */ -typedef struct texture_type - { - SDL_Surface* sdl_surface; - unsigned gl_texture; - int w; - int h; - } texture_type; +struct texture_type +{ + SDL_Surface* sdl_surface; + unsigned gl_texture; + int w; + int h; +}; void texture_setup(void); extern void (*texture_load) (texture_type* ptexture, const std::string& file, int use_alpha); diff --git a/src/timer.h b/src/timer.h index 372adcc62..3328e80ac 100644 --- a/src/timer.h +++ b/src/timer.h @@ -14,13 +14,12 @@ #define SUPERTUX_TIMER_H /* Timer type */ -typedef struct timer_type - { - unsigned int period; - unsigned int time; - unsigned int (*get_ticks) (void); - } -timer_type; +struct timer_type +{ + unsigned int period; + unsigned int time; + unsigned int (*get_ticks) (void); +}; extern unsigned int st_pause_ticks, st_pause_count; diff --git a/src/type.h b/src/type.h index 45d92b800..e450ecd99 100644 --- a/src/type.h +++ b/src/type.h @@ -17,25 +17,22 @@ /* 'Base' type for game objects */ -typedef struct base_type - { - float x; - float y; - float xm; - float ym; - float width; - float height; - } -base_type; - - -typedef struct string_list_type +struct base_type { - int num_items; - int active_item; - char **item; - } -string_list_type; + float x; + float y; + float xm; + float ym; + float width; + float height; +}; + +struct string_list_type +{ + int num_items; + int active_item; + char **item; +}; void string_list_init(string_list_type* pstring_list); char* string_list_active(string_list_type* pstring_list); diff --git a/src/world.h b/src/world.h index 5acc38936..243ac8ec1 100644 --- a/src/world.h +++ b/src/world.h @@ -21,11 +21,10 @@ #define NO_BOUNCE 0 #define BOUNCE 1 -typedef struct bouncy_distro_type /*It is easier to read the sources IMHO, if we don't write something like int a,b,c; */ - { - base_type base; - } -bouncy_distro_type; +struct bouncy_distro_type +{ + base_type base; +}; extern texture_type img_distro[4]; @@ -37,37 +36,34 @@ void bouncy_distro_collision(bouncy_distro_type* pbouncy_distro, int c_object); #define BOUNCY_BRICK_MAX_OFFSET 8 #define BOUNCY_BRICK_SPEED 0.9 -typedef struct broken_brick_type - { - base_type base; - timer_type timer; - } -broken_brick_type; +struct broken_brick_type +{ + base_type base; + timer_type timer; +}; void broken_brick_init(broken_brick_type* pbroken_brick, float x, float y, float xm, float ym); void broken_brick_action(broken_brick_type* pbroken_brick); void broken_brick_draw(broken_brick_type* pbroken_brick); -typedef struct bouncy_brick_type - { - float offset; - float offset_m; - int shape; - base_type base; - } -bouncy_brick_type; +struct bouncy_brick_type +{ + float offset; + float offset_m; + int shape; + base_type base; +}; void bouncy_brick_init(bouncy_brick_type* pbouncy_brick, float x, float y); void bouncy_brick_action(bouncy_brick_type* pbouncy_brick); void bouncy_brick_draw(bouncy_brick_type* pbouncy_brick); -typedef struct floating_score_type - { - int value; - timer_type timer; - base_type base; - } -floating_score_type; +struct floating_score_type +{ + int value; + timer_type timer; + base_type base; +}; void floating_score_init(floating_score_type* pfloating_score, float x, float y, int s); void floating_score_action(floating_score_type* pfloating_score); -- 2.11.0