/[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.56 by reallysoft, Sat Jul 5 08:27:06 2003 UTC revision 1.57 by reallysoft, Sat Jul 5 16:53:11 2003 UTC
# Line 918  bool world::InitWorld() Line 918  bool world::InitWorld()
918          return false;          return false;
919      }      }
920    
921      world::InitLayers();      world::BroadcastMessage("init", Value(), false, true, true);
922        // currently no floor listens to "init"
923    
924      player::InitMoveCounter();      player::InitMoveCounter();
925      display::StatusBar *sb = display::GetStatusBar();      display::StatusBar *sb = display::GetStatusBar();
# Line 1276  namespace Line 1277  namespace
1277      }      }
1278  }  }
1279    
1280    void
1281  // called after all stones have been set  world::BroadcastMessage(const std::string& msg, const Value& value,
1282  // sends message "init" to all objects                          bool to_floors, bool to_items, bool to_stones) {
 void world::InitLayers() {  
     string init_msg("init");  
1283      int    width  = level->w;      int    width  = level->w;
1284      int    height = level->h;      int    height = level->h;
1285    
1286      for (int x = 0; x<width; ++x) {      for (int y = 0; y<height; ++y) {
1287          for (int y = 0; y<height; ++y) {          for (int x = 0; x<width; ++x) {
             GridPos p(x, y);  
             if (Floor *fl = GetFloor(p)) {  
                 SendMessage(fl, init_msg);  
             }  
         }  
     }  
     for (int x = 0; x<width; ++x) {  
         for (int y = 0; y<height; ++y) {  
1288              GridPos p(x, y);              GridPos p(x, y);
1289              if (Item *it = GetItem(p)) {              if (to_floors) if (Floor *fl = GetFloor(p)) SendMessage(fl, msg, value);
1290                  SendMessage(it, init_msg);              if (to_items)  if (Item *it  = GetItem(p))  SendMessage(it, msg, value);
1291              }              if (to_stones) if (Stone *st = GetStone(p)) SendMessage(st, msg, value);
         }  
     }  
     for (int x = 0; x<width; ++x) {  
         for (int y = 0; y<height; ++y) {  
             GridPos p(x, y);  
             if (Stone *st = GetStone(p)) {  
                 SendMessage(st, init_msg);  
             }  
1292          }          }
1293      }      }
1294  }  }

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

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