Changes in src/World.cpp [24a5e0:244d26]
- File:
-
- 1 edited
-
src/World.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/World.cpp
r24a5e0 r244d26 47 47 OBSERVE; 48 48 molecule *mol = NULL; 49 mol = NewMolecule(); 49 mol = new molecule(periode); 50 molecules_deprecated->insert(mol); 50 51 assert(!molecules.count(currMoleculeId)); 51 mol->setId(currMoleculeId++);52 52 // store the molecule by ID 53 molecules[ mol->getId()] = mol;53 molecules[currMoleculeId++] = 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);69 56 } 70 57 … … 96 83 } 97 84 98 void World::destroyAtom( atomId_t id) {85 void World::destroyAtom(int id) { 99 86 OBSERVE; 100 87 atom *atom = atoms[id]; … … 144 131 145 132 World::World() : 133 currAtomId(0), 134 currMoleculeId(0), 146 135 periode(new periodentafel), 136 molecules_deprecated(new MoleculeListClass), 147 137 atoms(), 148 currAtomId(0), 149 molecules(), 150 currMoleculeId(0), 151 molecules_deprecated(new MoleculeListClass(this)) 138 molecules() 152 139 { 153 140 molecules_deprecated->signOn(this); … … 158 145 delete molecules_deprecated; 159 146 delete periode; 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); 147 AtomSet::iterator iter; 148 for(iter=atoms.begin();iter!=atoms.end();++iter){ 149 DeleteAtom((*iter).second); 168 150 } 169 151 atoms.clear(); … … 206 188 // should see that it gets the updated new world 207 189 delete oldWorld; 208 return theWorld;209 190 } 210 191
Note:
See TracChangeset
for help on using the changeset viewer.
