SHARE
TWEET

Better argument

a guest Feb 13th, 2011 209 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <set>
  2. #include <string>
  3. #include <cstdlib>
  4.  
  5. bool battle_test_flag = false;
  6. int battle_test_troop_id;
  7. bool window_flag = false, debug_flag = false, hide_title_flag = false;
  8.  
  9. int main(int const argc, char const* argv[])
  10. {
  11.         std::set<std::string> args;
  12.         for(int i = 1; i < argc; ++i) args.insert(argv[i]);
  13.  
  14.         if(std::string(argv[1]) == "BattleTest") {
  15.                 battle_test_flag = true;
  16.                 battle_test_troop_id = (argc > 4)? atoi(argv[4]) : 0;
  17.         } else {
  18.                 if(args.find("Window") != args.end()) { window_flag = true; }
  19.                 if(args.find("TestPlay") != args.end()) { debug_flag = true; }
  20.                 if(args.find("HideTitle") != args.end()) { hide_title_flag = true; }
  21.         }
  22.  
  23.         return EXIT_SUCCESS;
  24. }
RAW Paste Data
Top