public override void FromOSD(OSDMap map) { XPos = map["XPos"].AsInteger(); YPos = map["YPos"].AsInteger(); Width = map["Width"].AsInteger(); Depth = map["Depth"].AsInteger(); PlotClaimType = (PlotClaimType)map["ClaimType"].AsUInteger(); base.FromOSD(map); }
// PLOT CONTROL /// <summary> /// Constructs a building plot for a given position, size and claim type, does not /// alter any internal properties, this is just a helper method that allows you to /// create building plots quickly for use as parameters to other internal/external /// methods that the class provides. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="w"></param> /// <param name="d"></param> /// <param name="flags"></param> /// <returns></returns> public BuildingPlot MakePlot(int x, int y, int w, int d, PlotClaimType flags) { BuildingPlot plot = new BuildingPlot(); plot.XPos = x; plot.YPos = y; plot.Width = w; plot.Depth = d; plot.PlotClaimType = flags; return(plot); }
// PLOT CONTROL /// <summary> /// Constructs a building plot for a given position, size and claim type, does not /// alter any internal properties, this is just a helper method that allows you to /// create building plots quickly for use as parameters to other internal/external /// methods that the class provides. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="w"></param> /// <param name="d"></param> /// <param name="flags"></param> /// <returns></returns> public BuildingPlot MakePlot(int x, int y, int w, int d, PlotClaimType flags) { BuildingPlot plot = new BuildingPlot(); plot.xpos = x; plot.ypos = y; plot.width = (byte)w; plot.depth = (byte)d; plot.plotFlags = flags; return(plot); }
/// <summary> /// Finds which building plot is occupying the point of land specified. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public int FindPlot(int x, int y, int w, int d, out PlotClaimType type) { if (cityPlots.Count <= 0) { type = PlotClaimType.CLAIM_NONE; return(-1); } int idx = 0; foreach (BuildingPlot p in cityPlots) { if (p.Equals(MakePlot(x, y, w, d, PlotClaimType.CLAIM_BUILDING | PlotClaimType.CLAIM_COMPLEX))) { type = p.PlotClaimType; return(idx); } idx++; } type = PlotClaimType.CLAIM_NONE; return(-1); }
// PLOT CONTROL /// <summary> /// Constructs a building plot for a given position, size and claim type, does not /// alter any internal properties, this is just a helper method that allows you to /// create building plots quickly for use as parameters to other internal/external /// methods that the class provides. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="w"></param> /// <param name="d"></param> /// <param name="flags"></param> /// <returns></returns> public BuildingPlot MakePlot(int x, int y, int w, int d, PlotClaimType flags) { BuildingPlot plot = new BuildingPlot(); plot.XPos = x; plot.YPos = y; plot.Width = w; plot.Depth = d; plot.PlotClaimType = flags; return (plot); }
/// <summary> /// Finds which building plot is occupying the point of land specified. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public int FindPlot(int x, int y, int w, int d, out PlotClaimType type) { if (cityPlots.Count <= 0) { type = PlotClaimType.CLAIM_NONE; return (-1); } int idx = 0; foreach (BuildingPlot p in cityPlots) { if (p.Equals(MakePlot(x, y, w, d,PlotClaimType.CLAIM_BUILDING|PlotClaimType.CLAIM_COMPLEX))) { type = p.PlotClaimType; return (idx); } idx++; } type = PlotClaimType.CLAIM_NONE; return (-1); }
// PLOT CONTROL /// <summary> /// Constructs a building plot for a given position, size and claim type, does not /// alter any internal properties, this is just a helper method that allows you to /// create building plots quickly for use as parameters to other internal/external /// methods that the class provides. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="w"></param> /// <param name="d"></param> /// <param name="flags"></param> /// <returns></returns> public BuildingPlot MakePlot(int x, int y, int w, int d, PlotClaimType flags) { BuildingPlot plot = new BuildingPlot(); plot.xpos = x; plot.ypos = y; plot.width = (byte)w; plot.depth = (byte)d; plot.plotFlags = flags; return (plot); }