/[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.70 by dheck, Mon Jul 7 16:42:00 2003 UTC revision 1.71 by reallysoft, Wed Jul 9 07:00:07 2003 UTC
# Line 167  namespace Line 167  namespace
167    
168      public:      public:
169          Umbrella() : Item ("it-umbrella") {}          Umbrella() : Item ("it-umbrella") {}
170      };      };
171    
172      class Key : public Item {      class Key : public Item {
173          CLONEOBJ(Key);          CLONEOBJ(Key);
# Line 857  namespace Line 857  namespace
857      class Trigger : public Item {      class Trigger : public Item {
858          CLONEOBJ(Trigger);          CLONEOBJ(Trigger);
859      public:      public:
860          Trigger() : Item("it-trigger"), objectcnt(0), have_stone(false) {          Trigger() : Item("it-trigger"), objectcnt(0), have_pressure(false) {
861              set_attrib("invisible", 0.0);              set_attrib("invisible", 0.0);
862          }          }
863      private:      private:
864          int objectcnt;          // number of objects on the trigger          int  objectcnt;         // number of objects on the trigger
865          bool have_stone;          bool have_pressure;
866    
867          bool actor_hit(Actor */*a*/) { return false; }          bool actor_hit(Actor */*a*/) { return false; }
868    
# Line 904  namespace Line 904  namespace
904  void  void
905  Trigger::stone_change(Stone *st)  Trigger::stone_change(Stone *st)
906  {  {
907      if (st == 0 && have_stone){      bool get_pressure = st && !st->is_floating();
         have_stone=false;  
         remove_object();  
     }  
908    
909      if (st != 0 && !st->is_floating() && !have_stone){      if (get_pressure != have_pressure) {
910          have_stone=true;          if (get_pressure)   add_object();
911          add_object();          else                remove_object();
912            have_pressure = get_pressure;
913      }      }
914  }  }
915    

Legend:
Removed from v.1.70  
changed lines
  Added in v.1.71

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