mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-20 16:37:40 +00:00
renamed IF_MAP_CONTAINS_KEY to IF_KEY_EXISTS, and used a better implementation
This commit is contained in:
4
hyper.h
4
hyper.h
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user