diff --git a/graph.cpp b/graph.cpp index 337e66e7..bc9e50c9 100644 --- a/graph.cpp +++ b/graph.cpp @@ -45,7 +45,7 @@ EX bool hide_player() { ; } -#define ADC(V,c) IF_MAP_CONTAINS_KEY(it, current_display->all_drawn_copies, c) for(const shiftmatrix& V: it->second) +#define ADC(V,c) IF_KEY_EXISTS(it, current_display->all_drawn_copies, c) for(const shiftmatrix& V: it->second) EX hookset hooks_handleKey; EX hookset hooks_drawcell; diff --git a/hyper.h b/hyper.h index 2ab21e3f..3c43b595 100644 --- a/hyper.h +++ b/hyper.h @@ -577,8 +577,8 @@ typedef function cellfunction; /* conditions */ -/** `IF_MAP_CONTAINS_KEY(it, map, key) statement` checks whether the map 'map' contain key 'key', and if so, executes statement with it set to the relevant iterator */ -#define IF_MAP_CONTAINS_KEY(it, map, key) for(auto it = map.find(key); it != map.end(); it = map.end()) +/** `IF_KEY_EXISTS(it, map, key) statement` checks whether the map 'map' contain key 'key', and if so, executes statement with it set to the relevant iterator */ +#define IF_KEY_EXISTS(it, map, key) for(auto it: {map.find(key)}) if(it != map.end()) // canAttack/moveval flags