From 5561b648cdda86d3c547c3c3f956b8967906e4ff Mon Sep 17 00:00:00 2001
From: Marco Matthies <71844+marcom@users.noreply.github.com>
Date: Tue, 30 Jul 2024 09:59:31 +0200
Subject: [PATCH] Move createevent calls from CropState to FarmPlot sow! and
 harvest! functions

---
 src/crop/almass.jl   | 4 +---
 src/crop/farmplot.jl | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/crop/almass.jl b/src/crop/almass.jl
index 9203323..5ac4c53 100644
--- a/src/crop/almass.jl
+++ b/src/crop/almass.jl
@@ -195,10 +195,9 @@ end
 Change the cropstate to sow the specified crop.
 """
 function sow!(cs::CropState, model::SimulationModel, cropname::String)
-    createevent!(model, farmplot.pixels, sowing)
+    #XXX test if the crop is sowable?
     cs.croptype = model.crops[cropname]
     cs.phase = ALMaSS.sow
-    #XXX test if the crop is sowable?
 end
 
 """
@@ -207,7 +206,6 @@ end
 Harvest the crop of this cropstate.
 """
 function harvest!(cs::CropState, model::SimulationModel)
-    createevent!(model, farmplot.pixels, harvesting)
     cs.phase in [ALMaSS.harvest1, ALMaSS.harvest2] ?
         cs.phase = ALMaSS.harvest2 :
         cs.phase = ALMaSS.harvest1
diff --git a/src/crop/farmplot.jl b/src/crop/farmplot.jl
index b1c479a..39755b5 100644
--- a/src/crop/farmplot.jl
+++ b/src/crop/farmplot.jl
@@ -30,9 +30,9 @@ end
 Sow the specified crop on the farmplot.
 """
 function sow!(farmplot::FarmPlot, model::SimulationModel, cropname::String)
+    #XXX test if the crop is sowable?
     createevent!(model, farmplot.pixels, sowing)
     sow!(farmplot.crop_state, model, cropname)
-    #XXX test if the crop is sowable?
 end
 
 """
-- 
GitLab