| 1398 | } |
| 1399 | |
| 1400 | static bool setTile(color_ostream& out, df::coord pos, TileType target) { |
| 1401 | if (!Maps::isValidTilePos(pos)) { |
| 1402 | out.printerr("Invalid map position: ({}, {}, {})\n", pos.x, pos.y, pos.z); |
| 1403 | return false; |
| 1404 | } |
| 1405 | |
| 1406 | if (!is_valid_enum_item(target.shape)) { |
| 1407 | out.printerr("Invalid shape type: {}\n", ENUM_AS_STR(target.shape)); |
| 1408 | return false; |
| 1409 | } |
| 1410 | if (!is_valid_enum_item(target.material)) { |
| 1411 | out.printerr("Invalid material type: {}\n", ENUM_AS_STR(target.material)); |
| 1412 | return false; |
| 1413 | } |
| 1414 | if (!is_valid_enum_item(target.special)) { |
| 1415 | out.printerr("Invalid special type: {}\n", ENUM_AS_STR(target.special)); |
| 1416 | return false; |
| 1417 | } |
| 1418 | if (!is_valid_enum_item(target.variant)) { |
| 1419 | out.printerr("Invalid variant type: {}\n", ENUM_AS_STR(target.variant)); |
| 1420 | return false; |
| 1421 | } |
| 1422 | if (target.hidden < -1 || target.hidden > 1) { |
| 1423 | out.printerr("Invalid hidden value: {}\n", target.hidden); |
| 1424 | return false; |
| 1425 | } |
| 1426 | if (target.light < -1 || target.light > 1) { |
| 1427 | out.printerr("Invalid light value: {}\n", target.light); |
| 1428 | return false; |
| 1429 | } |
| 1430 | if (target.subterranean < -1 || target.subterranean > 1) { |
| 1431 | out.printerr("Invalid subterranean value: {}\n", target.subterranean); |
| 1432 | return false; |
| 1433 | } |
| 1434 | if (target.skyview < -1 || target.skyview > 1) { |
| 1435 | out.printerr("Invalid skyview value: {}\n", target.skyview); |
| 1436 | return false; |
| 1437 | } |
| 1438 | if (target.aquifer < -1 || target.aquifer > 2) { |
| 1439 | out.printerr("Invalid aquifer value: {}\n", target.aquifer); |
| 1440 | return false; |
| 1441 | } |
| 1442 | if (target.autocorrect < 0 || target.autocorrect > 1) { |
| 1443 | out.printerr("Invalid autocorrect value: {}\n", target.autocorrect); |
| 1444 | return false; |
| 1445 | } |
| 1446 | if (target.material == df::tiletype_material::STONE) { |
| 1447 | if (target.stone_material != -1 && !isStoneInorganic(target.stone_material)) { |
| 1448 | out.printerr("Invalid stone material: {}\n", target.stone_material); |
| 1449 | return false; |
| 1450 | } |
| 1451 | if (!is_valid_enum_item(target.vein_type)) { |
| 1452 | out.printerr("Invalid vein type: {}\n", ENUM_AS_STR(target.vein_type)); |
| 1453 | return false; |
| 1454 | } |
| 1455 | } |
| 1456 | else { |
| 1457 | target.stone_material = -1; |
no test coverage detected