From 5bcd18639490ac8d8f647525a508e83b94259aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kriv=C3=A1cs=20Schr=C3=B8der?= Date: Thu, 23 May 2024 09:43:12 +0200 Subject: [PATCH] fix: type checking code was a bit too specific --- CHANGELOG.md | 8 ++++++-- .../FarmingHysteresis/Defs/FarmingHysteresisControlDef.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cb3120..14a6e78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,13 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Type checking code was a bit too narrow, causing exceptions where they weren't appropriate. + ## [0.8.0] - 2024-05-22 ### Added - Added compatibility with Vanilla Plants Expanded - More Plants' custom aquatic and sandy growing zones. -- Added filtering to hysteresis tab -- Added a setting for counting all items on a map instead of only items in storage +- Added filtering to hysteresis tab. +- Added a setting for counting all items on a map instead of only items in storage. ## [0.7.0] - 2024-05-21 diff --git a/Source/FarmingHysteresis/Defs/FarmingHysteresisControlDef.cs b/Source/FarmingHysteresis/Defs/FarmingHysteresisControlDef.cs index c580075..4998934 100644 --- a/Source/FarmingHysteresis/Defs/FarmingHysteresisControlDef.cs +++ b/Source/FarmingHysteresis/Defs/FarmingHysteresisControlDef.cs @@ -41,7 +41,7 @@ public FarmingHysteresisControlWorker Worker private void ValidatePlantGrowerType(IPlantToGrowSettable plantGrower, string method) { - if (controlledClass != plantGrower.GetType()) + if (!controlledClass.IsAssignableFrom(plantGrower.GetType())) { throw new InvalidOperationException($"Called {nameof(FarmingHysteresisControlDef)}.{method} with an IPlantToGrowSettable of the wrong type. Expected {controlledClass.FullName}, got {plantGrower.GetType().FullName}"); }