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

Diff of /enigma/src/items.cc

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

revision 1.18 by mhawlisch, Fri Apr 4 10:07:33 2003 UTC revision 1.19 by dheck, Fri Apr 4 19:42:09 2003 UTC
# Line 186  namespace Line 186  namespace
186              return value;              return value;
187          }          }
188      };      };
189    
190    //     class Coin1 : public Coin {
191    //     public:
192    //     };
193    
194    //     class Coin2 : public Coin {
195    //     public:
196    
197    //     };
198    //     class Coin4 : public Coin {
199    //     public:
200    
201    //     };
202  }  }
203    
204  //----------------------------------------  //----------------------------------------
# Line 402  namespace Line 415  namespace
415              SendMessage(a, "jump");              SendMessage(a, "jump");
416              return ITEM_KEEP;              return ITEM_KEEP;
417          }          }
418    
419            const ObjectTraits *get_traits () const {
420                static ObjectTraits traits("it-spring1", OBJTYPE_Item);
421                return &traits;
422            }
423      };      };
424    
425      class Spring2 : public Item {      class Spring2 : public Item {
# Line 414  namespace Line 432  namespace
432              SendMessage(a, "jump");              SendMessage(a, "jump");
433              return ITEM_DROP;              return ITEM_DROP;
434          }          }
435            const ObjectTraits *get_traits () const {
436                static ObjectTraits traits("it-spring2", OBJTYPE_Item);
437                return &traits;
438            }
439      };      };
440  }  }
441    
# Line 525  document(1,1, "Hello World") Line 547  document(1,1, "Hello World")
547  namespace  namespace
548  {  {
549      class Document : public Item {      class Document : public Item {
         CLONEOBJ(Document);  
550      public:      public:
551          Document() : Item("it-document") {          Document() : Item("it-document") {
552              set_attrib("text", "");              set_attrib("text", "");
553          }          }
554        private:
555            CLONEOBJ(Document);
556    
557          ItemAction activate(Actor *a, GridPos)          ItemAction activate(Actor *a, GridPos)
558          {          {
# Line 542  namespace Line 565  namespace
565              if (msg == "ignite")              if (msg == "ignite")
566                  SetItem(get_pos(), new Explosion(Explosion::WEAK));                  SetItem(get_pos(), new Explosion(Explosion::WEAK));
567          }          }
568            const ObjectTraits *get_traits () const {
569                static ObjectTraits traits("it-document", OBJTYPE_Item);
570                return &traits;
571            }
572      };      };
573  }  }
574    
# Line 586  namespace Line 613  namespace
613              // don't pick up burning dynamite              // don't pick up burning dynamite
614              return (state == IDLE);              return (state == IDLE);
615          }          }
616            const ObjectTraits *get_traits () const {
617                static ObjectTraits traits("it-dynamite", OBJTYPE_Item);
618                return &traits;
619            }
620      };      };
621  }  }
622    
# Line 789  namespace Line 820  namespace
820      class ShogunDot : public Item {      class ShogunDot : public Item {
821          CLONEOBJ(ShogunDot);          CLONEOBJ(ShogunDot);
822      public:      public:
823          ShogunDot();          ShogunDot(int size=1);
824      private:      private:
825          void set_size(int s) { set_attrib("size", s); }          void set_size(int s) { set_attrib("size", s); }
826          int get_size() const;          int get_size() const;
# Line 805  namespace Line 836  namespace
836      };      };
837  }  }
838    
839  ShogunDot::ShogunDot()  ShogunDot::ShogunDot(int size)
840      : Item("it-shogun"), activated(false)  : Item("it-shogun"), activated(false)
841  {  {
842      set_size(1);      set_size(size);
843  }  }
844    
845  int  int
# Line 834  ShogunDot::stone_change(Stone *st) Line 865  ShogunDot::stone_change(Stone *st)
865      }      }
866  }  }
867    
 #define streq(a,b) (strcmp((a), (b))==0)  
868  void  void
869  ShogunDot::message(const string &str, const Value &v)  ShogunDot::message(const string &str, const Value &v)
870  {  {
871      int         size = get_size();      int         size = get_size();
872      const char *s    = str.c_str();      const char *s    = str.c_str();
873    
874      if (activated && streq(s, "noshogun")) {      if (activated && 0==strcmp(s, "noshogun")) {
875          activated = false;          activated = false;
876          world::PerformAction(this, false);          world::PerformAction(this, false);
877      }      }
# Line 858  ShogunDot::message(const string &str, co Line 888  ShogunDot::message(const string &str, co
888      }      }
889  }  }
890    
 #undef streq  
   
891  //----------------------------------------  //----------------------------------------
892  // Magnet  // Magnet
893  //----------------------------------------  //----------------------------------------
# Line 1308  void items::Init() Line 1336  void items::Init()
1336      Register(new Pipe);      Register(new Pipe);
1337      Register(new Puller);      Register(new Puller);
1338      Register(new Seed);      Register(new Seed);
1339    
1340      Register(new ShogunDot);      Register(new ShogunDot);
1341        Register ("it-shogun-s", new ShogunDot(1));
1342        Register ("it-shogun-m", new ShogunDot(2));
1343        Register ("it-shogun-l", new ShogunDot(3));
1344    
1345      Register(new Spade);      Register(new Spade);
1346      Register(new Spring1);      Register(new Spring1);
1347      Register(new Spring2);      Register(new Spring2);

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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