Skip to content
Snippets Groups Projects
Commit aa8f47e9 authored by Marco Matthies's avatar Marco Matthies
Browse files

Rename crop_state -> cropstate

parent 5561b648
No related branches found
No related tags found
No related merge requests found
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
mutable struct FarmPlot{T} <: ModelAgent mutable struct FarmPlot{T} <: ModelAgent
const id::Int64 const id::Int64
pixels::Vector{Tuple{Int64, Int64}} pixels::Vector{Tuple{Int64, Int64}}
crop_state :: T cropstate :: T
end end
croptype(f::FarmPlot{T}) where {T} = croptype(f.crop_state) croptype(f::FarmPlot{T}) where {T} = croptype(f.cropstate)
cropname(f::FarmPlot{T}) where {T} = cropname(croptype(f)) cropname(f::FarmPlot{T}) where {T} = cropname(croptype(f))
cropheight(f::FarmPlot{T}) where {T} = cropheight(f.crop_state) cropheight(f::FarmPlot{T}) where {T} = cropheight(f.cropstate)
cropcover(f::FarmPlot{T}) where {T} = cropcover(f.crop_state) cropcover(f::FarmPlot{T}) where {T} = cropcover(f.cropstate)
cropyield(f::FarmPlot{T}) where {T} = cropyield(f.crop_state) cropyield(f::FarmPlot{T}) where {T} = cropyield(f.cropstate)
""" """
stepagent!(farmplot, model) stepagent!(farmplot, model)
...@@ -21,7 +21,7 @@ cropyield(f::FarmPlot{T}) where {T} = cropyield(f.crop_state) ...@@ -21,7 +21,7 @@ cropyield(f::FarmPlot{T}) where {T} = cropyield(f.crop_state)
Update a farm plot by one day. Update a farm plot by one day.
""" """
function stepagent!(farmplot::FarmPlot{T}, model::SimulationModel) where T function stepagent!(farmplot::FarmPlot{T}, model::SimulationModel) where T
stepagent!(farmplot.crop_state, model) stepagent!(farmplot.cropstate, model)
end end
""" """
...@@ -32,7 +32,7 @@ Sow the specified crop on the farmplot. ...@@ -32,7 +32,7 @@ Sow the specified crop on the farmplot.
function sow!(farmplot::FarmPlot, model::SimulationModel, cropname::String) function sow!(farmplot::FarmPlot, model::SimulationModel, cropname::String)
#XXX test if the crop is sowable? #XXX test if the crop is sowable?
createevent!(model, farmplot.pixels, sowing) createevent!(model, farmplot.pixels, sowing)
sow!(farmplot.crop_state, model, cropname) sow!(farmplot.cropstate, model, cropname)
end end
""" """
...@@ -42,7 +42,7 @@ Harvest the crop of this farmplot. ...@@ -42,7 +42,7 @@ Harvest the crop of this farmplot.
""" """
function harvest!(farmplot::FarmPlot{T}, model::SimulationModel) where T function harvest!(farmplot::FarmPlot{T}, model::SimulationModel) where T
createevent!(model, farmplot.pixels, harvesting) createevent!(model, farmplot.pixels, harvesting)
harvest!(farmplot.crop_state, model) # TODO: multiply with area to return units of `g` harvest!(farmplot.cropstate, model) # TODO: multiply with area to return units of `g`
end end
## UTILITY FUNCTIONS ## UTILITY FUNCTIONS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment