Skip to content

Commit

Permalink
Remove unused methods from stomach.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Davi authored and Davi-DeGanne committed Oct 28, 2019
1 parent 8ca757d commit 63936e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 75 deletions.
57 changes: 2 additions & 55 deletions src/stomach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,49 +253,6 @@ void stomach_contents::absorb_water( player &p, units::volume amount )
p.mod_thirst( -units::to_milliliter( amount ) / 5 );
}

void stomach_contents::absorb_kcal( int amount )
{
if( amount <= 0 ) {
return;
}
calories_absorbed += amount;
calories -= amount;
if( calories < 0 ) { // just a little trickery to avoid overflow
calories_absorbed += calories;
calories = 0;
}
}

bool stomach_contents::absorb_vitamin( const vitamin_id &vit, int amount )
{
if( amount <= 0 ) {
return false;
}
vitamins_absorbed[vit] += amount;
vitamins[vit] -= amount;
if( vitamins[vit] < 0 ) {
vitamins_absorbed[vit] += vitamins[vit];
vitamins[vit] = amount;
}
return true;
}

bool stomach_contents::absorb_vitamin( const std::pair<vitamin_id, int> &vit )
{
return absorb_vitamin( vit.first, vit.second );
}

bool stomach_contents::absorb_vitamins( const std::map<vitamin_id, int> &vitamins )
{
bool absorbed = false;
for( const std::pair<vitamin_id, int> vit : vitamins ) {
if( absorb_vitamin( vit ) ) {
absorbed = true;
}
}
return absorbed;
}

stomach_pass_rates stomach_contents::get_pass_rates( bool stomach )
{
stomach_pass_rates rates;
Expand Down Expand Up @@ -378,11 +335,6 @@ void stomach_contents::mod_calories( int cal )
calories += cal;
}

void stomach_contents::set_calories( int cal )
{
calories = cal;
}

void stomach_contents::mod_nutr( int nutr )
{
// nutr is legacy type code, this function simply converts old nutrition to new kcal
Expand Down Expand Up @@ -420,11 +372,6 @@ int stomach_contents::get_calories_absorbed() const
return calories_absorbed;
}

void stomach_contents::set_calories_absorbed( int cal )
{
calories_absorbed = cal;
}

units::volume stomach_contents::get_water() const
{
return water;
Expand All @@ -445,7 +392,7 @@ void Character::initialize_stomach_contents()
{
stomach = stomach_contents( 2500_ml );
guts = stomach_contents( 24000_ml );
guts.set_calories( 300 );
stomach.set_calories( 800 );
guts.mod_calories( 300 );
stomach.mod_calories( 800 );
stomach.mod_contents( 475_ml );
}
20 changes: 0 additions & 20 deletions src/stomach.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,10 @@ class stomach_contents

int get_calories() const;
int get_calories_absorbed() const;
void set_calories_absorbed( int cal );
units::volume get_water() const;

// changes calorie amount
void mod_calories( int calories );
// sets calories amount
void set_calories( int cal );

// changes calorie amount based on old nutr value
void mod_nutr( int nutr );
Expand Down Expand Up @@ -131,21 +128,4 @@ class stomach_contents
// when did this stomach_contents call stomach_contents::ingest()
time_point last_ate;

// turns calories into absorbed calories.
// they are not added to your fat stores just yet
// only does anything if the input is a positive number
void absorb_kcal( int amount );
// absorbs a single vitamin.
// does not add it to player vitamins yet
// returns true if vitamins are absorbed
bool absorb_vitamin( const vitamin_id &vit, int amount );
// absorbs a single vitamin
// does not add it to player vitamins yet
// returns true if vitamins are absorbed
bool absorb_vitamin( const std::pair<vitamin_id, int> &vit );
// absorbs multiple vitamins
// does not add it to player vitamins yet
// returns true if any vitamins are absorbed
bool absorb_vitamins( const std::map<vitamin_id, int> &vitamins );

};

0 comments on commit 63936e8

Please sign in to comment.