Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    r24a5e0 r244d26  
    4747  OBSERVE;
    4848  molecule *mol = NULL;
    49   mol = NewMolecule();
     49  mol = new molecule(periode);
     50  molecules_deprecated->insert(mol);
    5051  assert(!molecules.count(currMoleculeId));
    51   mol->setId(currMoleculeId++);
    5252  // store the molecule by ID
    53   molecules[mol->getId()] = mol;
     53  molecules[currMoleculeId++] = mol;
    5454  mol->signOn(this);
    5555  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);
    6956}
    7057
     
    9683}
    9784
    98 void World::destroyAtom(atomId_t id) {
     85void World::destroyAtom(int id) {
    9986  OBSERVE;
    10087  atom *atom = atoms[id];
     
    144131
    145132World::World() :
     133    currAtomId(0),
     134    currMoleculeId(0),
    146135    periode(new periodentafel),
     136    molecules_deprecated(new MoleculeListClass),
    147137    atoms(),
    148     currAtomId(0),
    149     molecules(),
    150     currMoleculeId(0),
    151     molecules_deprecated(new MoleculeListClass(this))
     138    molecules()
    152139{
    153140  molecules_deprecated->signOn(this);
     
    158145  delete molecules_deprecated;
    159146  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);
    168150  }
    169151  atoms.clear();
     
    206188  // should see that it gets the updated new world
    207189  delete oldWorld;
    208   return theWorld;
    209190}
    210191
Note: See TracChangeset for help on using the changeset viewer.