WorldGenerator.cpp 502 B

12345678910111213141516
  1. #include "server/world/WorldGenerator.h"
  2. #include "common/world/HighMap.h"
  3. #include "server/Game.h"
  4. void WorldGenerator::generate(World& w) {
  5. const Block& stone = Game::blocks.getBlock("stone");
  6. HighMap map(w.getSize(), w.getHeight());
  7. for(int x = 0; x < w.getSize(); x++) {
  8. for(int z = 0; z < w.getSize(); z++) {
  9. int height = map.getHeight(x, z);
  10. for(int y = 0; y < height; y++) {
  11. w.setBlock(x, y, z, stone);
  12. }
  13. }
  14. }
  15. }