+
+ update_game_objects();
+ fix_old_tiles();
+ update_game_objects();
+ if(solids == 0)
+ throw std::runtime_error("sector does not contain a solid tile layer.");
+}
+
+void
+Sector::fix_old_tiles()
+{
+ // hack for now...
+ for(size_t x=0; x < solids->get_width(); ++x) {
+ for(size_t y=0; y < solids->get_height(); ++y) {
+ const Tile* tile = solids->get_tile(x, y);
+ Vector pos(x*32, y*32);
+
+ if(tile->getID() == 112) {
+ add_object(new InvisibleBlock(pos));
+ solids->change(x, y, 0);
+ } else if(tile->getID() == 295) {
+ add_object(new Spike(pos, Spike::NORTH));
+ solids->change(x, y, 0);
+ } else if(tile->getID() == 296) {
+ add_object(new Spike(pos, Spike::EAST));
+ solids->change(x, y, 0);
+ } else if(tile->getID() == 297) {
+ add_object(new Spike(pos, Spike::SOUTH));
+ solids->change(x, y, 0);
+ } else if(tile->getID() == 298) {
+ add_object(new Spike(pos, Spike::WEST));
+ solids->change(x, y, 0);
+ } else if(tile->getAttributes() & Tile::COIN) {
+ add_object(new Coin(pos));
+ solids->change(x, y, 0);
+ } else if(tile->getAttributes() & Tile::FULLBOX) {
+ add_object(new BonusBlock(pos, tile->getData()));
+ solids->change(x, y, 0);
+ } else if(tile->getAttributes() & Tile::BRICK) {
+ add_object(new Brick(pos, tile->getData()));
+ solids->change(x, y, 0);
+ } else if(tile->getAttributes() & Tile::GOAL) {
+ add_object(new SequenceTrigger(pos, "endsequence"));
+ solids->change(x, y, 0);
+ }
+ }
+ }