Changeset 8d9d38 for molecuilder/src/World.cpp
- Timestamp:
- Feb 25, 2010, 4:43:02 PM (16 years ago)
- Children:
- 3db67e
- Parents:
- 2e6496
- File:
-
- 1 edited
-
molecuilder/src/World.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/World.cpp
r2e6496 r8d9d38 47 47 OBSERVE; 48 48 molecule *mol = NULL; 49 mol = new molecule(periode); 50 molecules_deprecated->insert(mol); 49 mol = NewMolecule(); 51 50 assert(!molecules.count(currMoleculeId)); 51 mol->setId(currMoleculeId++); 52 52 // store the molecule by ID 53 molecules[ currMoleculeId++] = mol;53 molecules[mol->getId()] = mol; 54 54 mol->signOn(this); 55 55 return mol; 56 } 57 58 void World::destroyMolecule(molecule* mol){ 59 OBSERVE; 60 destroyMolecule(mol->getId()); 61 } 62 63 void World::destroyMolecule(moleculeId_t id){ 64 OBSERVE; 65 molecule *mol = molecules[id]; 66 assert(mol); 67 DeleteMolecule(mol); 68 molecules.erase(id); 56 69 } 57 70 … … 83 96 } 84 97 85 void World::destroyAtom( int id) {98 void World::destroyAtom(atomId_t id) { 86 99 OBSERVE; 87 100 atom *atom = atoms[id]; … … 134 147 currMoleculeId(0), 135 148 periode(new periodentafel), 136 molecules_deprecated(new MoleculeListClass ),149 molecules_deprecated(new MoleculeListClass(this)), 137 150 atoms(), 138 151 molecules() … … 145 158 delete molecules_deprecated; 146 159 delete periode; 147 AtomSet::iterator iter; 148 for(iter=atoms.begin();iter!=atoms.end();++iter){ 149 DeleteAtom((*iter).second); 160 MoleculeSet::iterator molIter; 161 for(molIter=molecules.begin();molIter!=molecules.end();++molIter){ 162 DeleteMolecule((*molIter).second); 163 } 164 molecules.clear(); 165 AtomSet::iterator atIter; 166 for(atIter=atoms.begin();atIter!=atoms.end();++atIter){ 167 DeleteAtom((*atIter).second); 150 168 } 151 169 atoms.clear();
Note:
See TracChangeset
for help on using the changeset viewer.
