diff --git a/.gitignore b/.gitignore index baf6585..c4d1df2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +build build.* +build.sh # Compiled Lua sources luac.out diff --git a/CropRotation.lua b/CropRotation.lua index 07aa3b6..fd39865 100644 --- a/CropRotation.lua +++ b/CropRotation.lua @@ -848,7 +848,7 @@ end function CropRotation.inj_densityMapUtil_updateSowingArea(superFunc, fruitIndex, startWorldX, startWorldZ, widthWorldX, widthWorldZ, heightWorldX, heightWorldZ, fieldGroundType, angle, growthState, blockedSprayTypeIndex) local fruitDesc = g_fruitTypeManager:getFruitTypeByIndex(fruitIndex) - if fruitDesc and fruitDesc.rotation.enabled then + if fruitDesc and fruitDesc.rotation and fruitDesc.rotation.enabled then local modifiers = g_cropRotation.modifiers local terrainSize = g_currentMission.terrainSize or 1024 @@ -1089,7 +1089,10 @@ function CropRotation:getRotationYieldMultiplier(prevIndex, lastIndex, currentIn end function CropRotation:getRotationReturnPeriodMultiplier(prev, last, current) - local returnPeriod = current.rotation.returnPeriod + local returnPeriod = 3 + if current.rotation then + returnPeriod = current.rotation.returnPeriod + end -- monoculture local result = 0.0 - ((current.index == last and current.index == prev) and 0.05 or 0) diff --git a/CropRotationData.lua b/CropRotationData.lua index d622d1a..2de4761 100644 --- a/CropRotationData.lua +++ b/CropRotationData.lua @@ -128,7 +128,7 @@ function CropRotationData:process(crops, overwrite, cropsXmlFileName) self.crModule.log:debug("CropRotationData:process()") if overwrite then - self.crModule.log:debug('CropRotationData:process(): overwrite crop rotation matrix by discarding entries created so far') + self.crModule.log:debug('CropRotationData:process(): overwrite crop rotation matrix (discard entries created so far)') self.matrix = {} end @@ -179,20 +179,19 @@ end ---------------------------------------------------------------------- function CropRotationData:postLoad() - self.crModule.log:debug("CropRotationData:postLoad(): list fruits in rotation ...") + self.crModule.log:info("CropRotationData:postLoad(): list fruits in rotation ...") for fruitIndex, fruitType in pairs(self.fruitTypeManager:getFruitTypes()) do if fruitType.rotation ~= nil then if fruitType.rotation.enabled then - self.crModule.log:debug(string.format("ENABLED fruit(%d): %s RP=%d", fruitIndex, fruitType.name, fruitType.rotation.returnPeriod)) + self.crModule.log:info(string.format("ENABLED fruit(%d): %s RP=%d", fruitIndex, fruitType.name, fruitType.rotation.returnPeriod)) else - self.crModule.log:debug(string.format("DISABLED fruit(%d): %s", fruitIndex, fruitType.name)) + self.crModule.log:info(string.format("DISABLED fruit(%d): %s", fruitIndex, fruitType.name)) end else - local s = string.format("INVALID fruit(%d): %s", fruitIndex, fruitType.name) - self.crModule.log:warning(s) + self.crModule.log:warning(string.format("INVALID fruit(%d): %s", fruitIndex, fruitType.name)) end end - self.crModule.log:debug("CropRotationData:postLoad(): ... done") + self.crModule.log:info("CropRotationData:postLoad(): ... done") end diff --git a/gui/InGameMenuCropRotationPlanner.lua b/gui/InGameMenuCropRotationPlanner.lua index f4d86ae..4baaf9a 100644 --- a/gui/InGameMenuCropRotationPlanner.lua +++ b/gui/InGameMenuCropRotationPlanner.lua @@ -47,7 +47,7 @@ function InGameMenuCropRotationPlanner:initialize() self.fruitIndexToCropIndexMap = {} for i, fruitDesc in pairs(g_fruitTypeManager:getFruitTypes()) do - if fruitDesc ~= nil and fruitDesc.rotation ~= nil then + if fruitDesc and fruitDesc.rotation then if fruitDesc.rotation.enabled then table.insert(self.cropIndexToFruitIndexMap, {index = i}) self.fruitIndexToCropIndexMap[i] = #self.cropIndexToFruitIndexMap @@ -81,7 +81,6 @@ function InGameMenuCropRotationPlanner:initialize() end end end - end self:updateRotation() diff --git a/modDesc.xml b/modDesc.xml index 7db1daa..9d363d8 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -1,7 +1,7 @@ Bodzio528 - 2.5.0.4 + 2.5.0.5 <en>Crop Rotation</en> <de>Fruchtfolge</de> @@ -25,6 +25,9 @@ Key features: - detailed in-game help menu (with pictures!) - crop rotation planner to visualize potential yield +Changelog 2.5.0.5: +- fixed issue with mod loading stuck at 95% + Changelog 2.5.0.2: - added premium expansion crops to rotation table: carrot, beetroot and parsnip