(&self, rocket_id: UnitID, destination: MapLocation)
| 1927 | } |
| 1928 | |
| 1929 | fn ok_if_can_launch_rocket(&self, rocket_id: UnitID, destination: MapLocation) |
| 1930 | -> Result<(), GameError> { |
| 1931 | let rocket = self.my_unit(rocket_id)?; |
| 1932 | if destination.planet == self.planet() { |
| 1933 | Err(GameError::SamePlanet)?; |
| 1934 | } |
| 1935 | rocket.ok_if_can_launch_rocket()?; |
| 1936 | let map = &self.starting_map(destination.planet); |
| 1937 | if !map.on_map(destination) { |
| 1938 | Err(GameError::LocationOffMap)?; |
| 1939 | } |
| 1940 | if !map.is_passable_terrain_at(destination)? { |
| 1941 | Err(GameError::LocationNotEmpty)?; |
| 1942 | } |
| 1943 | Ok(()) |
| 1944 | } |
| 1945 | |
| 1946 | /// Whether the rocket can launch into space to the given destination. The |
| 1947 | /// rocket can launch if the it has never been used before. The destination |
no test coverage detected