| 755 | //----------------------------------------------------------------------------- |
| 756 | |
| 757 | void SimObject::setId(SimObjectId newId) |
| 758 | { |
| 759 | if(!mFlags.test(Added)) |
| 760 | mId = newId; |
| 761 | else |
| 762 | { |
| 763 | // get this object out of the id dictionary if it's in it |
| 764 | Sim::gIdDictionary->remove(this); |
| 765 | |
| 766 | // Free current Id. |
| 767 | // Assign new one. |
| 768 | mId = newId ? newId : Sim::gNextObjectId++; |
| 769 | Sim::gIdDictionary->insert(this); |
| 770 | } |
| 771 | |
| 772 | dSprintf( mIdString, sizeof( mIdString ), "%u", mId ); |
| 773 | } |
| 774 | |
| 775 | //----------------------------------------------------------------------------- |
| 776 | |