| 87 | } |
| 88 | |
| 89 | Maybe<RuleConstPtr> Rule::parse(Json const& rule) { |
| 90 | String key = rule.getString(0); |
| 91 | if (key == "worldGenMustContainLiquid") |
| 92 | return as<Rule>(make_shared<const WorldGenMustContainLiquidRule>()); |
| 93 | if (key == "worldGenMustNotContainLiquid") |
| 94 | return as<Rule>(make_shared<const WorldGenMustNotContainLiquidRule>()); |
| 95 | |
| 96 | if (key == "worldGenMustContainSolidForeground") |
| 97 | return as<Rule>(make_shared<const WorldGenMustContainSolidRule>(TileLayer::Foreground)); |
| 98 | if (key == "worldGenMustContainAirForeground") |
| 99 | return as<Rule>(make_shared<const WorldGenMustContainAirRule>(TileLayer::Foreground)); |
| 100 | |
| 101 | if (key == "worldGenMustContainSolidBackground") |
| 102 | return as<Rule>(make_shared<const WorldGenMustContainSolidRule>(TileLayer::Background)); |
| 103 | if (key == "worldGenMustContainAirBackground") |
| 104 | return as<Rule>(make_shared<const WorldGenMustContainAirRule>(TileLayer::Background)); |
| 105 | |
| 106 | if (key == "allowOverdrawing") |
| 107 | return as<Rule>(make_shared<const AllowOverdrawingRule>()); |
| 108 | if (key == "ignorePartMaximumRule") |
| 109 | return as<Rule>(make_shared<const IgnorePartMaximumRule>()); |
| 110 | if (key == "maxSpawnCount") |
| 111 | return as<Rule>(make_shared<const MaxSpawnCountRule>(rule)); |
| 112 | if (key == "doNotConnectToPart") |
| 113 | return as<Rule>(make_shared<const DoNotConnectToPartRule>(rule)); |
| 114 | if (key == "doNotCombineWith") |
| 115 | return as<Rule>(make_shared<const DoNotCombineWithRule>(rule)); |
| 116 | |
| 117 | Logger::error("Unknown dungeon rule: {}", key); |
| 118 | return Maybe<RuleConstPtr>(); |
| 119 | } |
| 120 | |
| 121 | bool Rule::checkTileCanPlace(Vec2I, DungeonGeneratorWriter*) const { |
| 122 | return true; |
no test coverage detected