engine/time/source/CreatureStatsIncrementer.cpp
// Increment the stat as necessary.  Whenever the current number of marks is
// greater than the stat, the stat is incremented.  This can happen multiple
// times.
Increment the stat as necessary.  Whenever the current number of marks is
greater than the stat, the stat is incremented.  This can happen multiple
times.
Increment the stat as necessary . Whenever the current number of marks is greater than the stat the stat is incremented . This can happen multiple times .
void CreatureStatsIncrementer::increment_stat_if_necessary(pair<Statistic&, string>& stat_pair, IMessageManager& manager)
{
  Statistic& stat = stat_pair.first;
  Marks& marks = stat.get_marks_ref();
  bool incremented_stat = false;
  int marks_cur = marks.get_value();
  if (marks_cur >= stat.get_base() && RNG::percent_chance(PCT_CHANCE_INCREMENT_STATISTIC))
  {
    while (marks_cur >= stat.get_base())
    {
      marks_cur -= stat.get_base();
      marks.set_value(marks_cur);
      stat.set_base(stat.get_base() + 1);
      stat.set_current(stat.get_current() + 1);
      incremented_stat = true;
    }
  }
  if (incremented_stat)
  {
    manager.add_new_message(StringTable::get(stat_pair.second));
    manager.send();
  }
}
void CreatureStatsIncrementer :: increment_stat_if_necessary ( pair < Statistic & , string > & stat_pair , IMessageManager & manager ) { Statistic & stat = stat_pair . first ; Marks & marks = stat . get_marks_ref ( ) ; bool incremented_stat = false ; int marks_cur = marks . get_value ( ) ; if ( marks_cur >= stat . get_base ( ) && RNG :: percent_chance ( PCT_CHANCE_INCREMENT_STATISTIC ) ) { while ( marks_cur >= stat . get_base ( ) ) { marks_cur -= stat . get_base ( ) ; marks . set_value ( marks_cur ) ; stat . set_base ( stat . get_base ( ) + 1 ) ; stat . set_current ( stat . get_current ( ) + 1 ) ; incremented_stat = true ; } } if ( incremented_stat ) { manager . add_new_message ( StringTable :: get ( stat_pair . second ) ) ; manager . send ( ) ; } }
Increment the stat as necessary.
Increment the stat as necessary .