This commit is contained in:
aozhiwei 2022-12-25 16:14:55 +08:00
parent f330657fbd
commit 7e67bc5f5e

View File

@ -21,18 +21,17 @@ namespace mt
const mt::Robot* Robot::RandRobot(std::set<int>& refreshed_robot_set) const mt::Robot* Robot::RandRobot(std::set<int>& refreshed_robot_set)
{ {
#if 0 int try_count = 0;
int try_count = 0; while (true) {
while (true) { const mt::Robot* tmp_robot_meta = raw_list[rand() % raw_list.size()];
MetaData::Robot& tmp_robot_meta = loader_->robot_list[rand() % loader_->robot_list.size()]; if (refreshed_robot_set.find(tmp_robot_meta->id()) == refreshed_robot_set.end()) {
if (refreshed_robot_set.find(tmp_robot_meta.pb->id()) == refreshed_robot_set.end()) { return tmp_robot_meta;
return &tmp_robot_meta; }
} ++try_count;
++try_count; if (try_count > 3000) {
if (try_count > 3000) { return nullptr;
return nullptr; }
} }
} }
#endif
}
} }