engine/calculators/source/DepthBasedDangerLevelCalculator.cpp
// Calculate the danger level for any map dependent on depth (underworld,
// certain overworld).  This is the base danger level, +/- the delta in depth.
Calculate the danger level for any map dependent on depth (underworld,
certain overworld).  This is the base danger level, +/- the delta in depth.
Calculate the danger level for any map dependent on depth ( underworld certain overworld ) . This is the base danger level + / - the delta in depth .
int DepthBasedDangerLevelCalculator::calculate(MapPtr map, MapPtr new_map) const
{
  int danger_level = 0;
  if (map)
  {
    danger_level = map->get_danger();
    if (new_map)
    {
      Depth map_depth = map->size().depth();
      Depth new_map_depth = new_map->size().depth();
      int new_map_cur_depth = new_map_depth.get_current();
      int delta = calculate_delta(map_depth, new_map_depth);
      if (is_more_dangerous(delta, new_map_cur_depth))
      {
        delta = std::abs(delta);
      }
      else
      {
        delta = std::abs(delta) * -1;
      }
      danger_level += delta;
    }
  }
  return danger_level;
}
int DepthBasedDangerLevelCalculator :: calculate ( MapPtr map , MapPtr new_map ) const { int danger_level = 0 ; if ( map ) { danger_level = map -> get_danger ( ) ; if ( new_map ) { Depth map_depth = map -> size ( ) . depth ( ) ; Depth new_map_depth = new_map -> size ( ) . depth ( ) ; int new_map_cur_depth = new_map_depth . get_current ( ) ; int delta = calculate_delta ( map_depth , new_map_depth ) ; if ( is_more_dangerous ( delta , new_map_cur_depth ) ) { delta = std :: abs ( delta ) ; } else { delta = std :: abs ( delta ) * -1 ; } danger_level += delta ; } } return danger_level ; }
Calculate the danger level for any map dependent on depth (underworld,
certain overworld).
Calculate the danger level for any map dependent on depth ( underworld certain overworld ) .