Improve game rules configuration screen
This commit is contained in:
		@@ -91,18 +91,28 @@ impl GameRules {
 | 
			
		||||
 | 
			
		||||
        let mut errors = vec![];
 | 
			
		||||
 | 
			
		||||
        if self.map_width < config.min_map_width || self.map_width > config.max_map_width {
 | 
			
		||||
            errors.push("Map width is outside bounds!");
 | 
			
		||||
        if self.map_width < config.min_map_width {
 | 
			
		||||
            errors.push("Map width is too small!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.map_height < config.min_map_height || self.map_height > config.max_map_height {
 | 
			
		||||
            errors.push("Map height is outside bounds!");
 | 
			
		||||
        if self.map_width > config.max_map_width {
 | 
			
		||||
            errors.push("Map width is too big!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.boats_list().len() < config.min_boats_number
 | 
			
		||||
            || self.boats_list().len() > config.max_boats_number
 | 
			
		||||
        {
 | 
			
		||||
            errors.push("The number of boats is invalid!");
 | 
			
		||||
        if self.map_height < config.min_map_height {
 | 
			
		||||
            errors.push("Map height is too small!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.map_height > config.max_map_height {
 | 
			
		||||
            errors.push("Map height is too big!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.boats_list().len() < config.min_boats_number {
 | 
			
		||||
            errors.push("There is not enough boats!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if self.boats_list().len() > config.max_boats_number {
 | 
			
		||||
            errors.push("There are too many boats!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for boat in self.boats_list() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user