}
}
+void Terrain::DeleteObject(unsigned int id)
+{
+ for (int i = 0; i < subdivision; i++) {
+ for (int j = 0; j < subdivision; j++) {
+ for (unsigned int k = 0; k < patchobjects[i][j].size();) {
+ if (patchobjects[i][j][k] == id) {
+ /* Remove all occurences of id (there should never be more than 1 though) */
+ patchobjects[i][j].erase(patchobjects[i][j].begin() + k);
+ } else {
+ /* Update id of other objects if needed */
+ if (patchobjects[i][j][k] > id) {
+ patchobjects[i][j][k]--;
+ }
+ k++;
+ }
+ }
+ }
+ }
+}
+
void Terrain::DeleteDecal(int which)
{
if (decalstoggle) {
std::vector<Decal> decals;
void AddObject(XYZ where, float radius, int id);
+ void DeleteObject(unsigned int id);
void DeleteDecal(int which);
void MakeDecal(decal_type type, XYZ where, float size, float opacity, float rotation);
void MakeDecalLock(decal_type type, XYZ where, int whichx, int whichy, float size, float opacity, float rotation);
void Object::DeleteObject(int which)
{
objects.erase(objects.begin() + which);
+ terrain.DeleteObject(which);
}
void Object::MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale)