| 565 | } |
| 566 | |
| 567 | bool processTileType(color_ostream & out, TileType &paint, std::vector<std::string> ¶ms, int start, int end, bool isFilter) |
| 568 | { |
| 569 | if (start == end) |
| 570 | { |
| 571 | out << "Missing argument." << std::endl; |
| 572 | return false; |
| 573 | } |
| 574 | |
| 575 | int loc = start; |
| 576 | std::string option = params[loc++]; |
| 577 | std::string value = end <= loc ? "" : params[loc++]; |
| 578 | tolower(option); |
| 579 | toupper(value); |
| 580 | int valInt; |
| 581 | if (value == "ANY") |
| 582 | { |
| 583 | valInt = -1; |
| 584 | } |
| 585 | else |
| 586 | { |
| 587 | valInt = toint(value, -2); |
| 588 | } |
| 589 | bool found = false; |
| 590 | |
| 591 | if (option == "any") |
| 592 | { |
| 593 | paint.clear(); |
| 594 | } |
| 595 | else if (option == "shape" || option == "sh" || option == "s") |
| 596 | { |
| 597 | if (is_valid_enum_item((df::tiletype_shape)valInt)) |
| 598 | { |
| 599 | paint.shape = (df::tiletype_shape)valInt; |
| 600 | found = true; |
| 601 | } |
| 602 | else |
| 603 | { |
| 604 | if (!tryShape(value, paint)) |
| 605 | { |
| 606 | out << "Unknown tile shape: " << value << std::endl; |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | else if (option == "material" || option == "mat" || option == "m") |
| 611 | { |
| 612 | // Setting the material conflicts with stone_material |
| 613 | paint.stone_material = -1; |
| 614 | |
| 615 | if (is_valid_enum_item((df::tiletype_material)valInt)) |
| 616 | { |
| 617 | paint.material = (df::tiletype_material)valInt; |
| 618 | found = true; |
| 619 | } |
| 620 | else |
| 621 | { |
| 622 | if (!tryMaterial(value, paint)) |
| 623 | { |
| 624 | out << "Unknown tile material: " << value << std::endl; |
no test coverage detected