engine/generators/settlements/sector/source/ShadeGardenGenerator.cpp
// Generate the plants within the garden
Generate the plants within the garden
Generate the plants within the garden
void ShadeGardenGenerator::generate_plants(MapPtr map, const Coordinate& start_coord, const Coordinate& end_coord)
{
  TilePtr garden_tile;
  TileGenerator tg;
  int rand;    
  for (int row = start_coord.first+1; row < end_coord.first; row++)
  {
    for (int col = start_coord.second+1; col < end_coord.second; col++)
    {
      garden_tile = tg.generate(TileType::TILE_TYPE_FIELD);
      map->insert(row, col, garden_tile);
      rand = RNG::range(1, 6);
      ItemPtr plant;
      if (rand == 3)
      {
        plant = ItemManager::create_item(ItemIdKeys::ITEM_ID_FIDDLEHEAD_GREEN);
      }
      else if (rand > 3)
      {
        plant = ItemManager::create_item(ItemIdKeys::ITEM_ID_FERN);        
      }
      if (plant)
      {
        garden_tile->get_items()->add(plant);
      }
    }
  }  
}
void ShadeGardenGenerator :: generate_plants ( MapPtr map , const Coordinate & start_coord , const Coordinate & end_coord ) { TilePtr garden_tile ; TileGenerator tg ; int rand ; for ( int row = start_coord . first + 1 ; row < end_coord . first ; row ++ ) { for ( int col = start_coord . second + 1 ; col < end_coord . second ; col ++ ) { garden_tile = tg . generate ( TileType :: TILE_TYPE_FIELD ) ; map -> insert ( row , col , garden_tile ) ; rand = RNG :: range ( 1 , 6 ) ; ItemPtr plant ; if ( rand == 3 ) { plant = ItemManager :: create_item ( ItemIdKeys :: ITEM_ID_FIDDLEHEAD_GREEN ) ; } else if ( rand > 3 ) { plant = ItemManager :: create_item ( ItemIdKeys :: ITEM_ID_FERN ) ; } if ( plant ) { garden_tile -> get_items ( ) -> add ( plant ) ; } } } }
Generate the plants within the garden
Generate the plants within the garden
// Turn the underlying tiles into grass. // Small chance of no plant. // Otherwise: // Generate a fiddlehead green - this is good eatin'. // Generate a regular fern