/[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.60 by reallysoft, Thu Jun 26 10:48:36 2003 UTC revision 1.61 by dheck, Thu Jun 26 17:21:20 2003 UTC
# Line 1338  namespace Line 1338  namespace
1338          }          }
1339    
1340          void crack(const GridPos &p) {          void crack(const GridPos &p) {
1341              if (Item *it = GetItem(p))              if (Floor *fl = GetFloor(p)) {
1342                  SendMessage (it, "crack");                  string k = fl->get_kind();
1343              else if (Floor *fl = GetFloor(p))                  if (k != "fl-abyss" && k != "fl-water" && k != "fl-swamp") {
1344                  if (fl->get_kind() != "fl-abyss" && do_crack()) {                      if (Item *it = GetItem(p))
1345                      SetItem(p, MakeItem("it-crack"));                          SendMessage (it, "crack");
1346                        else if (do_crack())
1347                            SetItem(p, MakeItem("it-crack"));
1348                  }                  }
1349                }
1350          }          }
1351    
1352          void actor_enter(Actor */*a*/) {          void actor_enter(Actor *a) {
1353              SendMessage(this, "crack");              if (a->is_on_floor()) {
1354                    SendMessage(this, "crack");
1355              if (get_type() <= 3) {                  
1356                  GridPos p = get_pos();                  if (get_type() <= 3) {
1357                  crack (move(p, NORTH));                      GridPos p = get_pos();
1358                  crack (move(p, EAST));                      crack (move(p, NORTH));
1359                  crack (move(p, SOUTH));                      crack (move(p, EAST));
1360                  crack (move(p, WEST));                      crack (move(p, SOUTH));
1361                        crack (move(p, WEST));
1362                    }
1363              }              }
1364          }          }
1365          bool actor_hit(Actor *a) {          bool actor_hit(Actor *a) {
# Line 1376  namespace Line 1381  namespace
1381          bool do_crack() {          bool do_crack() {
1382              double brittleness = enigma::Brittleness;              double brittleness = enigma::Brittleness;
1383              double_attrib ("brittleness", &brittleness);              double_attrib ("brittleness", &brittleness);
1384              double rnd = rand() / (RAND_MAX+1.0);              double rnd = DoubleRand(0, 1);
1385              return rnd < brittleness;              return rnd < brittleness;
1386          }          }
1387      };      };

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

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