diff options
author | Andrey Nazarov <skuller@skuller.net> | 2009-09-16 10:38:24 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2009-09-16 10:38:24 +0000 |
commit | 719b6d9b0b6fb9544186dd02ffd8aa69e189e3f2 (patch) | |
tree | 960ef885102abf7fc5846a37c0f2c47918a1b535 | |
parent | f963e1292cb6710891979d7296dbe06d87f19988 (diff) |
Use FOR_EACH_DRAWOBJ[_SAFE] macros.
-rw-r--r-- | source/cl_scrn.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/cl_scrn.c b/source/cl_scrn.c index eac15b3..4e0eb7f 100644 --- a/source/cl_scrn.c +++ b/source/cl_scrn.c @@ -579,6 +579,11 @@ typedef struct { color_t color; } drawobj_t; +#define FOR_EACH_DRAWOBJ( obj ) \ + LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) +#define FOR_EACH_DRAWOBJ_SAFE( obj, next ) \ + LIST_FOR_EACH_SAFE( drawobj_t, obj, next, &scr_objects, entry ) + static LIST_DECL( scr_objects ); static void SCR_Color_g( genctx_t *ctx ) { @@ -618,7 +623,7 @@ static void SCR_Draw_f( void ) { } Com_Printf( "Name X Y\n" "--------------- ---- ----\n" ); - LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) { + FOR_EACH_DRAWOBJ( obj ) { s = obj->macro ? obj->macro->name : obj->cvar->name; Com_Printf( "%-15s %4d %4d\n", s, obj->x, obj->y ); } @@ -678,7 +683,7 @@ static void SCR_Draw_g( genctx_t *ctx ) { Prompt_AddMatch( ctx, "all" ); - LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) { + FOR_EACH_DRAWOBJ( obj ) { s = obj->macro ? obj->macro->name : obj->cvar->name; if( !Prompt_AddMatch( ctx, s ) ) { break; @@ -711,7 +716,7 @@ static void SCR_UnDraw_f( void ) { s = Cmd_Argv( 1 ); if( !strcmp( s, "all" ) ) { - LIST_FOR_EACH_SAFE( drawobj_t, obj, next, &scr_objects, entry ) { + FOR_EACH_DRAWOBJ_SAFE( obj, next ) { Z_Free( obj ); } List_Init( &scr_objects ); @@ -726,7 +731,7 @@ static void SCR_UnDraw_f( void ) { } deleted = qfalse; - LIST_FOR_EACH_SAFE( drawobj_t, obj, next, &scr_objects, entry ) { + FOR_EACH_DRAWOBJ_SAFE( obj, next ) { if( obj->macro == macro && obj->cvar == cvar ) { List_Remove( &obj->entry ); Z_Free( obj ); @@ -744,7 +749,7 @@ static void draw_objects( void ) { int x, y; drawobj_t *obj; - LIST_FOR_EACH( drawobj_t, obj, &scr_objects, entry ) { + FOR_EACH_DRAWOBJ( obj ) { x = obj->x; y = obj->y; if( x < 0 ) { |