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(); |
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 |
} |
} |