/** * Determine what a funnel has filled out of game, using funnelcontainer.bday as a starting point. */ void retroactively_fill_from_funnel( item &it, const trap &tr, const time_point &start, const time_point &end, const tripoint &location ) { if( start > end || !tr.is_funnel() ) { return; } it.set_birthday( end ); // bday == last fill check auto data = sum_conditions( start, end, location ); // Technically 0.0 division is OK, but it will be cleaner without it if( data.rain_amount > 0 ) { const int rain = divide_roll_remainder( 1.0 / tr.funnel_turns_per_charge( data.rain_amount ), 1.0f ); it.add_rain_to_container( false, rain ); // add_msg(m_debug, "Retroactively adding %d water from turn %d to %d", rain, startturn, endturn); } if( data.acid_amount > 0 ) { const int acid = divide_roll_remainder( 1.0 / tr.funnel_turns_per_charge( data.acid_amount ), 1.0f ); it.add_rain_to_container( true, acid ); } }