// destroys all objects in a particular area and container. (0 is not in a container) public int destroyArea(int x1, int y1, int x2, int y2, int containerId = 0) { util.sort(ref x1, ref x2); util.sort(ref y1, ref y2); int result = 0; // destroy objects result += this.execute("DELETE FROM " + this.tableName + "s WHERE x>=" + x1 + " AND y>=" + y1 + " AND x<=" + x2 + " AND y<=" + y2 + " AND containerId = " + containerId); // destroy disconnected objects result += this.destroyDisconnected(); // destroy disconnected attributes clsAttribute attribute = new clsAttribute(_db); result += attribute.destroyDisconnected(); return result; }
public int destroyContents(bool internalUseOnly = true) { int result = 0; // execute this same function for the imeadiate contents of each of this objects imeadiate contents List<clsObject> objects = this.getList("SELECT * FROM " + this.tableName + "s WHERE containerId = " + this.id + ";"); foreach (clsObject obj in objects) { result += obj.destroyContents(false); } // delete this objects imeadiate contents in one call result += this.execute("DELETE FROM " + this.tableName + "s WHERE containerId = " + this.id + ";"); // once all objects and their contents are destroyed then destroy all disconnected attributes in one call if (internalUseOnly == true) { clsAttribute attribute = new clsAttribute(_db); attribute.destroyDisconnected(); } return result; }