Skip to content

Commit 1d4d3ae

Browse files
committed
Thread-safety with uniqueIDs
1 parent f326b27 commit 1d4d3ae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Entities/MovableObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace RTE {
2929

3030
AbstractClassInfo(MovableObject, SceneObject);
3131

32-
unsigned long int MovableObject::m_UniqueIDCounter = 1;
32+
std::atomic<unsigned long int> MovableObject::m_UniqueIDCounter = 1;
3333
std::string MovableObject::ms_EmptyString = "";
3434

3535
//////////////////////////////////////////////////////////////////////////////////////////

Entities/MovableObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ enum MOType
19561956
// Member variables
19571957
static Entity::ClassInfo m_sClass;
19581958
// Global counter with unique ID's
1959-
static unsigned long int m_UniqueIDCounter;
1959+
static std::atomic<unsigned long int> m_UniqueIDCounter;
19601960
// The type of MO this is, either Actor, Item, or Particle
19611961
int m_MOType;
19621962
float m_Mass; // In metric kilograms (kg).

0 commit comments

Comments
 (0)