src/ldtypes.cpp

changeset 503
bebe09014dd6
parent 500
cad8cdc42a64
child 504
6a1fa662bfc1
equal deleted inserted replaced
502:f6534d591f80 503:bebe09014dd6
251 251
252 // ============================================================================= 252 // =============================================================================
253 // ----------------------------------------------------------------------------- 253 // -----------------------------------------------------------------------------
254 LDObject::~LDObject() 254 LDObject::~LDObject()
255 { // Remove this object from the selection array if it is there. 255 { // Remove this object from the selection array if it is there.
256 for (int i = 0; i < g_win->sel().size(); ++i) 256 g_win->sel().removeOne (this);
257 if (g_win->sel() [i] == this)
258 g_win->sel().erase (i);
259 257
260 // Delete the GL lists 258 // Delete the GL lists
261 GL::deleteLists (this); 259 GL::deleteLists (this);
262 260
263 // Remove this object from the list of LDObjects 261 // Remove this object from the list of LDObjects
264 int pos; 262 g_LDObjects.removeOne (this);
265
266 if ((pos = g_LDObjects.find (this)) != -1)
267 g_LDObjects.erase (pos);
268 } 263 }
269 264
270 // ============================================================================= 265 // =============================================================================
271 // ----------------------------------------------------------------------------- 266 // -----------------------------------------------------------------------------
272 static void transformObject (LDObject* obj, matrix transform, vertex pos, short parentcolor) 267 static void transformObject (LDObject* obj, matrix transform, vertex pos, short parentcolor)
364 objsToCompile << file->obj (target); 359 objsToCompile << file->obj (target);
365 360
366 obj->swap (file->obj (target)); 361 obj->swap (file->obj (target));
367 } 362 }
368 363
369 objsToCompile.makeUnique(); 364 removeDuplicates (objsToCompile);
370 365
371 // The objects need to be recompiled, otherwise their pick lists are left with 366 // The objects need to be recompiled, otherwise their pick lists are left with
372 // the wrong index colors which messes up selection. 367 // the wrong index colors which messes up selection.
373 for (LDObject * obj : objsToCompile) 368 for (LDObject* obj : objsToCompile)
374 g_win->R()->compileObject (obj); 369 g_win->R()->compileObject (obj);
375 } 370 }
376 371
377 // ============================================================================= 372 // =============================================================================
378 // ----------------------------------------------------------------------------- 373 // -----------------------------------------------------------------------------

mercurial