From f7f9b68bb955ed192b45c4e244140d76185fc173 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Sun, 12 Apr 2020 16:28:47 +0200 Subject: [PATCH] Introduce tagged element iteration macros. --- src/taglist.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/taglist.h b/src/taglist.h index 51cc82ce9..e44696d3e 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -28,3 +28,24 @@ void Taglist_AddToSectors (const size_t tag, const size_t itemid); void Taglist_AddToLines (const size_t tag, const size_t itemid); void Taglist_AddToMapthings (const size_t tag, const size_t itemid); #endif //__R_TAGLIST__ + +#define Tag_IterateSectors(tag, sc)\ +size_t kk;\ +if(tags_sectors[tag])\ + for(kk = 0, sc = tags_sectors[tag]->elements[0];\ + kk < tags_sectors[tag]->count;\ + sc = tags_sectors[tag]->elements[++kk]) + +#define Tag_IterateLines(tag, li)\ +size_t kk;\ +if(tags_lines[tag])\ + for(kk = 0, li = tags_lines[tag]->elements[0];\ + kk < tags_lines[tag]->count;\ + li = tags_lines[tag]->elements[++kk]) + +#define Tag_IterateMapthings(tag, mt)\ +size_t kk;\ +if(tags_mapthings[tag])\ + for(kk = 0, mt = tags_mapthings[tag]->elements[0];\ + kk < tags_mapthings[tag]->count;\ + mt = tags_mapthings[tag]->elements[++kk])