MCPcopy Create free account
hub / github.com/DFHack/dfhack / processTileType

Function processTileType

plugins/tiletypes.cpp:567–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567bool processTileType(color_ostream & out, TileType &paint, std::vector<std::string> &params, 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;

Callers 1

processCommandFunction · 0.85

Calls 11

tolowerFunction · 0.85
toupperFunction · 0.85
tointFunction · 0.85
is_valid_enum_itemFunction · 0.85
tryShapeFunction · 0.85
tryMaterialFunction · 0.85
trySpecialFunction · 0.85
tryVariantFunction · 0.85
find_enum_itemFunction · 0.85
findInorganicMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected