| 172 | } |
| 173 | |
| 174 | bool sFodderParameters::ProcessCLI(int argc, char *argv[]) { |
| 175 | |
| 176 | if (!mCliOptions) |
| 177 | PrepareOptions(); |
| 178 | |
| 179 | try { |
| 180 | auto result = mCliOptions->parse(argc, argv); |
| 181 | |
| 182 | if (result["appveyor"].as<bool>()) { |
| 183 | mAppVeyor = true; |
| 184 | } |
| 185 | |
| 186 | if (result["help"].as<bool>() == true) { |
| 187 | g_Debugger->Notice(mCliOptions->help()); |
| 188 | mShowHelp = true; |
| 189 | return false; |
| 190 | } |
| 191 | |
| 192 | if (result.count("pc")) |
| 193 | mDefaultPlatform = ePlatform::PC; |
| 194 | if (result.count("amiga")) |
| 195 | mDefaultPlatform = ePlatform::Amiga; |
| 196 | |
| 197 | if (result.count("engine")) { |
| 198 | if (result["engine"].as<std::string>() == "cf1") |
| 199 | mDefaultGame = eGame::CF1; |
| 200 | |
| 201 | if (result["engine"].as<std::string>() == "cf2") |
| 202 | mDefaultGame = eGame::CF2; |
| 203 | |
| 204 | } |
| 205 | |
| 206 | if (result["list-campaigns"].as<bool>() == true) { |
| 207 | g_Debugger->Notice("\nAvailable Campaigns\n\n"); |
| 208 | |
| 209 | for (auto& Name : g_Fodder->mVersions->GetCampaignNames()) |
| 210 | g_Debugger->Notice(Name); |
| 211 | |
| 212 | return false; |
| 213 | } |
| 214 | |
| 215 | if (result.count("demo-record-all")) { |
| 216 | mDemoRecord = true; |
| 217 | mDemoFile = "-"; |
| 218 | } |
| 219 | else { |
| 220 | mDemoFile = result["demo-record"].as<std::string>(); |
| 221 | if (mDemoFile.size()) |
| 222 | mDemoRecord = true; |
| 223 | else { |
| 224 | mDemoFile = result["demo-play"].as<std::string>(); |
| 225 | if (mDemoFile.size()) |
| 226 | mDemoPlayback = true; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | mShowAbout = result["about"].as<bool>(); |
| 231 | |