renamed IF_MAP_CONTAINS_KEY to IF_KEY_EXISTS, and used a better implementation

This commit is contained in:
Zeno Rogue 2021-07-18 11:57:23 +02:00
parent 18c6aa7823
commit cd60b0ffb3
2 changed files with 3 additions and 3 deletions

View File

@ -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<bool(int sym, int uni)> hooks_handleKey;
EX hookset<bool(cell *c, const shiftmatrix& V)> hooks_drawcell;

View File

@ -577,8 +577,8 @@ typedef function<int(struct cell*)> 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