/[enigma]/enigma/src/stones_simple.cc
ViewVC logotype

Diff of /enigma/src/stones_simple.cc

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

revision 1.38 by reallysoft, Fri Jul 18 17:18:38 2003 UTC revision 1.39 by reallysoft, Mon Jul 21 08:22:50 2003 UTC
# Line 335  set_stone("st-swap", 10,10) Line 335  set_stone("st-swap", 10,10)
335  namespace  namespace
336  {  {
337      class SwapStone : public Stone, public TimeHandler {      class SwapStone : public Stone, public TimeHandler {
         CLONEOBJ(SwapStone);  
   
338      public:      public:
339          SwapStone()          SwapStone()
340              : Stone("st-swap")              : Stone("st-swap")
# Line 347  namespace Line 345  namespace
345    
346      private:      private:
347    
348            // Object interface
349            SwapStone *clone();
350            void       dispose();
351    
352          // GridObject interface          // GridObject interface
353          void init_model();          void init_model();
354          void on_removal();          void on_removal();
# Line 366  namespace Line 368  namespace
368    
369      };      };
370    
371        SwapStone *SwapStone::clone() {
372            SwapStone *other        = new SwapStone(*this);
373            other->in_exchange_with = 0;
374            return other;
375        }
376    
377        void SwapStone::dispose() {
378            if (state == COME && in_exchange_with != 0) {
379                in_exchange_with->dispose();
380                delete in_exchange_with;
381            }
382            delete this;
383        }
384    
385      void SwapStone::on_removal() {      void SwapStone::on_removal() {
386          if (state == COME) {          if (state == COME) {
387              g_timer.remove_alarm(this);              g_timer.remove_alarm(this);

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39

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