* Place new trees. * * This function takes care of the selected tree placer algorithm and * place randomly the trees for a new game. */
| 467 | * place randomly the trees for a new game. |
| 468 | */ |
| 469 | void GenerateTrees() |
| 470 | { |
| 471 | uint i, total; |
| 472 | |
| 473 | if (_settings_game.game_creation.tree_placer == TP_NONE) return; |
| 474 | |
| 475 | switch (_settings_game.game_creation.tree_placer) { |
| 476 | case TP_ORIGINAL: i = _settings_game.game_creation.landscape == LandscapeType::Arctic ? 15 : 6; break; |
| 477 | case TP_IMPROVED: i = _settings_game.game_creation.landscape == LandscapeType::Arctic ? 4 : 2; break; |
| 478 | default: NOT_REACHED(); |
| 479 | } |
| 480 | |
| 481 | total = Map::ScaleBySize(DEFAULT_TREE_STEPS); |
| 482 | if (_settings_game.game_creation.landscape == LandscapeType::Tropic) total += Map::ScaleBySize(DEFAULT_RAINFOREST_TREE_STEPS); |
| 483 | total *= i; |
| 484 | uint num_groups = (_settings_game.game_creation.landscape != LandscapeType::Toyland) ? Map::ScaleBySize(GB(Random(), 0, 5) + 25) : 0; |
| 485 | total += num_groups * DEFAULT_TREE_STEPS; |
| 486 | SetGeneratingWorldProgress(GWP_TREE, total); |
| 487 | |
| 488 | if (num_groups != 0) PlaceTreeGroups(num_groups); |
| 489 | |
| 490 | for (; i != 0; i--) { |
| 491 | PlaceTreesRandomly(); |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Plant a tree. |
no test coverage detected