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

Diff of /enigma/src/world.cc

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

revision 1.23 by reallysoft, Mon May 5 12:41:05 2003 UTC revision 1.24 by reallysoft, Thu May 8 00:03:59 2003 UTC
# Line 1109  world::SetStone(GridPos p, Stone* st) Line 1109  world::SetStone(GridPos p, Stone* st)
1109      changed_stones.push_back(p);      changed_stones.push_back(p);
1110  }  }
1111    
1112  #if defined(USE_IMPULSES)  static Object *theImpulseSender = 0;
1113    
1114    Object *
1115    world::ImpulseSender() {
1116        return theImpulseSender;
1117    }
1118    
1119  void  void
1120  world::SendImpulse(GridPos p, Direction dir)  world::SendImpulse(GridPos p, Direction dir, Object *sender)
1121  {  {
1122      if (Stone *st = GetStone(p)) {      if (Stone *st = GetStone(p)) {
1123  //         fprintf(stderr, "Sending impulse to stone at position %i/%i direction=%s\n", p.x, p.y, to_suffix(dir).c_str());          Object *oldImpulseSender = theImpulseSender;
1124          st->on_impulse(dir);          theImpulseSender         = sender;
     }  
 }  
1125    
1126  #else          st->on_impulse(dir);
   
 bool  
 world::MaybeMoveStone(GridPos p, Direction dir)  
1127    
1128  {          theImpulseSender = oldImpulseSender;
     GridPos newp = move(p,dir);  
     if (GetStone(newp) == 0)  
     {  
         Stone *st = GetStone(p);  
         if (st && st->is_movable())  
         {  
             st->play_sound ("st-move");  
             SetStone(newp, YieldStone(p));  
             st->on_move();  
             if (Item *it = GetItem(newp))  
                 it->on_stonehit(st);  
             return true;  
         }  
1129      }      }
     return false;  
1130  }  }
1131    
 #endif  
   
1132  void  void
1133  world::SwapStones(GridPos p, GridPos newp)  world::SwapStones(GridPos p, GridPos newp)
1134  {  {

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

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