| 1217 | } |
| 1218 | |
| 1219 | command_result processCommand(color_ostream &out, std::vector<std::string> &commands, int start, int end, bool & endLoop, bool hasConsole = false) |
| 1220 | { |
| 1221 | tiletypes_options opts; |
| 1222 | if (commands.size() == size_t(start)) |
| 1223 | { |
| 1224 | return executePaintJob(out, opts); |
| 1225 | } |
| 1226 | |
| 1227 | int loc = start; |
| 1228 | |
| 1229 | std::string command = commands[loc++]; |
| 1230 | tolower(command); |
| 1231 | |
| 1232 | if (command == "help" || command == "?") |
| 1233 | { |
| 1234 | help(out, commands, loc, end); |
| 1235 | } |
| 1236 | else if (command == "quit" || command == "q") |
| 1237 | { |
| 1238 | endLoop = true; |
| 1239 | } |
| 1240 | else if (command == "filter" || command == "f") |
| 1241 | { |
| 1242 | processTileType(out, filter, commands, loc, end, true); |
| 1243 | } |
| 1244 | else if (command == "paint" || (command == "p" && commands.size() > 1)) |
| 1245 | { |
| 1246 | processTileType(out, paint, commands, loc, end, false); |
| 1247 | } |
| 1248 | else if (command == "point" || command == "p") |
| 1249 | { |
| 1250 | delete brush; |
| 1251 | brush = new RectangleBrush(1,1); |
| 1252 | } |
| 1253 | else if (command == "range" || command == "r") |
| 1254 | { |
| 1255 | int width = 1, height = 1, zLevels = 1; |
| 1256 | |
| 1257 | command_result res = parseRectangle(out, commands, loc, end, |
| 1258 | width, height, zLevels, hasConsole); |
| 1259 | if (res != CR_OK) |
| 1260 | { |
| 1261 | return res; |
| 1262 | } |
| 1263 | |
| 1264 | delete brush; |
| 1265 | brush = new RectangleBrush(width, height, zLevels, 0, 0, 0); |
| 1266 | } |
| 1267 | else if (command == "block") |
| 1268 | { |
| 1269 | delete brush; |
| 1270 | brush = new BlockBrush(); |
| 1271 | } |
| 1272 | else if (command == "column") |
| 1273 | { |
| 1274 | delete brush; |
| 1275 | brush = new ColumnBrush(); |
| 1276 | } |
no test coverage detected