| 598 | //============================================================================// |
| 599 | |
| 600 | void CmdLineOptions::parse(const std::vector<std::string>& tokens, bool fromWorldFile) { |
| 601 | // InertiaGameStyle maintained just for compatibility |
| 602 | // Same effect is achieved setting linear/angular Acceleration |
| 603 | gameOptions |= int(InertiaGameStyle); |
| 604 | |
| 605 | // parse command line |
| 606 | int playerCountArg = 0; |
| 607 | int playerCountArg2 = 0; |
| 608 | |
| 609 | for (int i = 0; i < (int)tokens.size(); i++) { |
| 610 | |
| 611 | const std::string& token = tokens[i]; |
| 612 | |
| 613 | if (token == "-admsg") { |
| 614 | const std::string msg = parseStringArg(i, tokens); |
| 615 | if ((advertisemsg != "") || msg.empty()) { |
| 616 | advertisemsg += "\\n"; |
| 617 | } |
| 618 | advertisemsg += msg; |
| 619 | } |
| 620 | else if (token == "-advertise") { |
| 621 | const std::string adList = parseStringArg(i, tokens); |
| 622 | if (checkCommaList(adList, 2048)) { |
| 623 | std::cerr << "Invalid group list for -advertise" << std::endl; |
| 624 | } |
| 625 | else { |
| 626 | advertiseGroups = adList; |
| 627 | } |
| 628 | } |
| 629 | else if (token == "-autoTeam") { |
| 630 | autoTeam = true; |
| 631 | } |
| 632 | else if (token == "-b") { |
| 633 | // random rotation to boxes in capture-the-flag game |
| 634 | randomBoxes = true; |
| 635 | } |
| 636 | else if (token == "-badwords") { |
| 637 | filterFilename = parseStringArg(i, tokens); |
| 638 | } |
| 639 | else if (token == "-ban") { |
| 640 | acl.ban(parseStringArg(i, tokens).c_str()); |
| 641 | } |
| 642 | else if (token == "-banfile") { |
| 643 | const std::string banFile = parseStringArg(i, tokens); |
| 644 | acl.setBanFile(banFile); |
| 645 | if (!acl.load()) { |
| 646 | std::cerr << "ERROR: could not load banfile [" |
| 647 | << banFile << "]" << std::endl; |
| 648 | usage(execName); |
| 649 | } |
| 650 | } |
| 651 | else if (token == "-botsPerIP") { |
| 652 | botsPerIP = parseIntArg(i, tokens); |
| 653 | } |
| 654 | else if (token == "-c") { |
| 655 | // capture the flag style |
| 656 | if (gameType == RabbitChase) { |
| 657 | std::cerr << "Capture the flag incompatible with Rabbit Chase" << std::endl; |