本文整理汇总了C++中player::get_thirst方法的典型用法代码示例。如果您正苦于以下问题:C++ player::get_thirst方法的具体用法?C++ player::get_thirst怎么用?C++ player::get_thirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类player
的用法示例。
在下文中一共展示了player::get_thirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: absorb_water
void stomach_contents::absorb_water( player &p, units::volume amount )
{
if( water < amount ) {
amount = water;
water = 0_ml;
} else {
water -= amount;
}
if( p.get_thirst() < -100 ) {
return;
} else if( p.get_thirst() - units::to_milliliter( amount / 5 ) < -100 ) {
p.set_thirst( -100 );
}
p.mod_thirst( -units::to_milliliter( amount ) / 5 );
}
示例2: cap_nutrition_thirst
// Caps both actual nutrition/thirst and stomach capacity
void cap_nutrition_thirst( player &p, int capacity, bool food, bool water )
{
if( ( food && p.get_hunger() < capacity ) ||
( water && p.get_thirst() < capacity ) ) {
p.add_msg_if_player( _( "You can't finish it all!" ) );
}
if( p.get_hunger() < capacity ) {
p.mod_stomach_food( p.get_hunger() - capacity );
p.set_hunger( capacity );
}
if( p.get_thirst() < capacity ) {
p.mod_stomach_water( p.get_thirst() - capacity );
p.set_thirst( capacity );
}
add_msg( m_debug, "%s nutrition cap: hunger %d, thirst %d, stomach food %d, stomach water %d",
p.disp_name().c_str(), p.get_hunger(), p.get_thirst(), p.get_stomach_food(),
p.get_stomach_water() );
}