- FindPlayer(const __gnu_cxx::hash_map<std::string, Player>& players, PlayerType type, int limit = 0);
- int operator()(const SPInfo* node) const;
+ FindPlayer(const __gnu_cxx::hash_map<std::string, Player>& players, PlayerType type, int limit = 0): _players(players), _type(type), _limit(limit){
+ }
+ inline int operator()(const SPInfo* node) const{
+ if (_limit > 0 && node->cost >= _limit)
+ return -1;
+ for(__gnu_cxx::hash_map<std::string, Player>::const_iterator player = _players.begin();
+ player != _players.end(); ++player){
+ if (player->second.type == _type && player->second.location == node->name){
+ return 1;
+ }
+ }
+ return 0;
+ }
+