# void makeRandomHills ShTlTerrainSceneNode node s32 hillCount s32 maxRa

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89``` ```void makeRandomHills(ShTlTerrainSceneNode* node, s32 hillCount, s32 maxRadius) { double pi = 3.1415926535; // make hills std::vector > map; std::vector line; int high = 128; int size = getSize().Width; int n = size-1; for(int i=0; i<2*size-1; i++) { for(int j=0; j<2*size-1; j++) { line.push_back(0); } map.push_back(line); line.clear(); } map[n/2][n/2] = rand() %high; map[n/2][n+n/2] = rand() %high; map[n+n/2][n/2] = rand() %high; map[n+n/2][n+n/2] = rand() %high; int it = 2; while(it<=n) { int centri = n/it; for(int i = centri; isetHeight(i,j,map[i+n/2][j+n/2]; } } /* for(int n=0; n pos; pos.X = rand()%node->getSize().Width - radius; pos.Y = rand()%node->getSize().Height-radius; // decide if add or substract if(rand()%2==1) height = -height; // create hill using sinus and distance to center for(int j=0; j<=radius*2; j++) for(int i=0; i<=radius*2; i++) { f32 distance = core::vector2d(i-radius, j-radius).getLength(); if(distance <= radius) { f32 v = radius; v = v - distance; v = v / radius; v = v * pi / 2; v = sin(v); if(pos.X+i>=0 && pos.X+igetSize().Width+1 && pos.Y+j>=0 && pos.Y+jgetSize().Height+1) node->setHeight(pos.X+i, pos.Y+j, node->getHeight(pos.X+i, pos.Y+j)+v*height*node->getTileSize()); } } } */ } ```