Advertisement
Vultraz

Untitled

Aug 27th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1.     auto get_initial_type_selection = [this]()->int {
  2.         auto get_selection = [&](ng::level::TYPE type) {
  3.             return std::find_if(level_types_.begin(), level_types_.end(), [type](level_type_info& info) {
  4.                 return info.first == type;
  5.             });
  6.         };
  7.  
  8.         const ng::level::TYPE saved_value = ng::level::TYPE::from_int(preferences::level_type());
  9.  
  10.         const auto saved_selection = get_selection(saved_value);
  11.         const auto default_selection = get_selection(ng::level::TYPE::SCENARIO);
  12.  
  13.         if((game_config::debug || saved_value != ng::level::TYPE::SP_CAMPAIGN) && saved_selection != level_types_.end()) {
  14.             return saved_selection - level_types_.begin();
  15.         }
  16.  
  17.         return default_selection - level_types_.begin();
  18.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement