public bool CheckHouseRegionValidSize(Rectangle regionArea, out Configuration.HouseSizeConfig problematicConfig)
        {
            int areaTotalTiles = regionArea.Width * regionArea.Height;

            problematicConfig = this.Config.MinSize;
            if (
                regionArea.Width < this.Config.MinSize.Width || regionArea.Height < this.Config.MinSize.Height ||
                areaTotalTiles < this.Config.MinSize.TotalTiles
                )
            {
                return(false);
            }

            problematicConfig = this.Config.MaxSize;
            if (
                regionArea.Width > this.Config.MaxSize.Width || regionArea.Height > this.Config.MaxSize.Height ||
                areaTotalTiles > this.Config.MaxSize.TotalTiles
                )
            {
                return(false);
            }

            problematicConfig = default(Configuration.HouseSizeConfig);
            return(true);
        }
 public InvalidHouseSizeException(Configuration.HouseSizeConfig restrictingConfig)
     : base("The size of the house does not match with the configured min / max settings.")
 {
     this.restrictingConfig = restrictingConfig;
 }
Beispiel #3
0
 public InvalidHouseSizeException(Configuration.HouseSizeConfig restrictingConfig) : base("The size of the house does not match with the configured min / max settings.")
 {
     this.restrictingConfig = restrictingConfig;
 }