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

Diff of /enigma/src/stones.cc

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

revision 1.15 by reallysoft, Sat Jun 28 23:12:00 2003 UTC revision 1.16 by reallysoft, Sun Jul 6 12:47:04 2003 UTC
# Line 28  using namespace world; Line 28  using namespace world;
28  using namespace enigma;  using namespace enigma;
29  using namespace stones;  using namespace stones;
30    
 namespace stones  
 {  
     player::Inventory *  
     get_inventory(const Actor *a)  
     {  
         if (const Value *v = a->get_attrib("player"))  
             return player::GetInventory(to_int(*v));  
         return 0;  
     }  
   
     Item *wielded_item (Actor *a) {  
         if (player::Inventory *inv = get_inventory(a))  
             return inv->get_item(0);  
         return 0;  
     }  
   
     bool wielded_item_is(Actor *a, const string &kind)  
     {  
         if (player::Inventory *inv = get_inventory(a))  
             if (Item *it = inv->get_item(0))  
                 return it->get_kind() == kind;  
         return false;  
     }  
 }  
   
31  // *******************************************************************************  // *******************************************************************************
32  //  Stones under development :  //  Stones under development :
33    
# Line 69  namespace Line 44  namespace
44          {}          {}
45    
46          void actor_hit (const StoneContact &sc) {          void actor_hit (const StoneContact &sc) {
47              if (player::Inventory *inv = get_inventory(sc.actor)) {              if (player::Inventory *inv = player::GetInventory(sc.actor)) {
48                  GridPos  p  = find_pipe_endpoint();                  if (Item *it = inv->get_item(0)) {
49                  Item    *it = inv->get_item(0);                      GridPos p = find_pipe_endpoint();
50    
51                  if (it->is_kind("it-brake")) {                      if (it->is_kind("it-brake")) {
52                      if (!GetStone(p)) {                          if (!GetStone(p)) {
53                          it = inv->yield_first();                              it = inv->yield_first();
54                          world::SetItemAsStone(p, it);                              world::SetItemAsStone(p, it);
55                            }
56                      }                      }
57                  }                      else {
58                  else {                          if (!GetItem (p)) {
59                      if (!GetItem (p)) {                              it = inv->yield_first();
60                          it = inv->yield_first();                              world::SetItem(p, it);
61                          world::SetItem(p, it);                              it->on_drop(sc.actor);
62                          it->on_drop(sc.actor);                          }
63                      }                      }
64                  }                  }
65              }              }

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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