src/ldObject.cpp

changeset 1135
8e0691be0b6f
parent 1125
d8f94e56d42e
child 1139
51303023d651
equal deleted inserted replaced
1134:daa9808d626e 1135:8e0691be0b6f
26 #include "canvas.h" 26 #include "canvas.h"
27 #include "colors.h" 27 #include "colors.h"
28 #include "glCompiler.h" 28 #include "glCompiler.h"
29 29
30 // List of all LDObjects 30 // List of all LDObjects
31 QMap<int32, LDObject*> g_allObjects; 31 QMap<qint32, LDObject*> g_allObjects;
32 32
33 enum { MAX_LDOBJECT_IDS = (1 << 24) }; 33 enum { MAX_LDOBJECT_IDS = (1 << 24) };
34 34
35 #define LDOBJ_DEFAULT_CTOR(T,BASE) \ 35 #define LDOBJ_DEFAULT_CTOR(T,BASE) \
36 T :: T (Model* model) : \ 36 T :: T (Model* model) : \
46 m_coords {Origin} 46 m_coords {Origin}
47 { 47 {
48 assert(_model != nullptr); 48 assert(_model != nullptr);
49 49
50 // Let's hope that nobody goes to create 17 million objects anytime soon... 50 // Let's hope that nobody goes to create 17 million objects anytime soon...
51 static int32 nextId = 1; // 0 shalt be null 51 static qint32 nextId = 1; // 0 shalt be null
52 if (nextId < MAX_LDOBJECT_IDS) 52 if (nextId < MAX_LDOBJECT_IDS)
53 m_id = nextId++; 53 m_id = nextId++;
54 else 54 else
55 m_id = 0; 55 m_id = 0;
56 56
624 return replacement; 624 return replacement;
625 } 625 }
626 626
627 // ============================================================================= 627 // =============================================================================
628 // 628 //
629 LDObject* LDObject::fromID(int32 id) 629 LDObject* LDObject::fromID(qint32 id)
630 { 630 {
631 return g_allObjects.value(id); 631 return g_allObjects.value(id);
632 } 632 }
633 633
634 // ============================================================================= 634 // =============================================================================

mercurial