/// <summary> /// Add the given Map Object to the map /// </summary> /// <param name="pt">Point.</param> /// <param name="obj">Object.</param> public bool Add(Point pt, MapObject obj) { if (mapobjects.ContainsKey(pt)) { return(false); } this.mapobjects.Add(pt, obj); if (!this.MapArea.Contains(obj.Area)) { ReqestAreaMapUpdate = true; } areamap.Add(obj); return(true); }
/// <summary> /// Updates the Area Map object. /// </summary> /// <remark> /// Should be used after editting the Map objects /// </remark> public void UpdateAreaMap(bool UpdateAreaOfMap = true) { if (UpdateAreaOfMap) { this.UpdateAreaOfMap(); } areamap = new AreaMap <MapObject>(this.MapArea); foreach (var obj in mapobjects.Values) { if (!areamap.Add(obj)) { throw new Exception("Didn't add object"); } } this.ReqestDrawMapUpdate = true; }
private void ParseBlocks() { foreach (var str in this.mapfile.BlockNames) { var parts = str.Split(','); if (parts.Length != 4) { continue; } int x = int.Parse(parts[0]); int y = int.Parse(parts[1]); int w = int.Parse(parts[2]); int h = int.Parse(parts[3]); sections.Add(new MapSection(new Rectangle(x, y, w, h))); } }