src/tgp.cpp
changeset 6357 f0f5e7d1713c
parent 6248 e4a2ed7e5613
child 6422 6679df1c05ba
equal deleted inserted replaced
6356:2f7f41367170 6357:f0f5e7d1713c
   396 
   396 
   397 		/* Transform height into 0..1 space */
   397 		/* Transform height into 0..1 space */
   398 		fheight = (double)(*h - h_min) / (double)(h_max - h_min);
   398 		fheight = (double)(*h - h_min) / (double)(h_max - h_min);
   399 		/* Apply sine transform depending on landscape type */
   399 		/* Apply sine transform depending on landscape type */
   400 		switch(_opt.landscape) {
   400 		switch(_opt.landscape) {
   401 			case LT_CANDY:
   401 			case LT_TOYLAND:
   402 			case LT_NORMAL:
   402 			case LT_TEMPERATE:
   403 				/* Move and scale 0..1 into -1..+1 */
   403 				/* Move and scale 0..1 into -1..+1 */
   404 				fheight = 2 * fheight - 1;
   404 				fheight = 2 * fheight - 1;
   405 				/* Sine transform */
   405 				/* Sine transform */
   406 				fheight = sin(fheight * M_PI_2);
   406 				fheight = sin(fheight * M_PI_2);
   407 				/* Transform it back from -1..1 into 0..1 space */
   407 				/* Transform it back from -1..1 into 0..1 space */
   408 				fheight = 0.5 * (fheight + 1);
   408 				fheight = 0.5 * (fheight + 1);
   409 				break;
   409 				break;
   410 
   410 
   411 			case LT_HILLY:
   411 			case LT_ARCTIC:
   412 				{
   412 				{
   413 					/* Arctic terrain needs special height distribution.
   413 					/* Arctic terrain needs special height distribution.
   414 					 * Redistribute heights to have more tiles at highest (75%..100%) range */
   414 					 * Redistribute heights to have more tiles at highest (75%..100%) range */
   415 					double sine_upper_limit = 0.75;
   415 					double sine_upper_limit = 0.75;
   416 					double linear_compression = 2;
   416 					double linear_compression = 2;
   427 						fheight = 0.5 * (fheight + 1.0) * m;
   427 						fheight = 0.5 * (fheight + 1.0) * m;
   428 					}
   428 					}
   429 				}
   429 				}
   430 				break;
   430 				break;
   431 
   431 
   432 			case LT_DESERT:
   432 			case LT_TROPIC:
   433 				{
   433 				{
   434 					/* Desert terrain needs special height distribution.
   434 					/* Desert terrain needs special height distribution.
   435 					 * Half of tiles should be at lowest (0..25%) heights */
   435 					 * Half of tiles should be at lowest (0..25%) heights */
   436 					double sine_lower_limit = 0.5;
   436 					double sine_lower_limit = 0.5;
   437 					double linear_compression = 2;
   437 					double linear_compression = 2;