/[enigma]/enigma/object_mixins.hh
ViewVC logotype

Diff of /enigma/object_mixins.hh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by dheck, Sun Nov 3 14:22:02 2002 UTC revision 1.10 by dheck, Sun Nov 10 08:35:22 2002 UTC
# Line 30  namespace world Line 30  namespace world
30          Object* clone() { return this; }        \          Object* clone() { return this; }        \
31          void dispose() {}          void dispose() {}
32    
33        
34    #define INSTANCELISTOBJ(type)                                                           \
35            typedef std::vector<type*> InstanceList;                                        \
36            static InstanceList instances;                                                  \
37            Object *clone() { type *o = new type; instances.push_back(o); return o;}        \
38            void dispose() {                                                                \
39                instances.erase(find(instances.begin(), instances.end(), this));            \
40                delete this;                                                                \
41            }
42        
43  //----------------------------------------  //----------------------------------------
44  // MovableStone  // MovableStone
45  //  //

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26