Give each food item a food value, say from 1 to 10. An apple would be a 1, a pig's head would be a 10. When you want to rest for the night, a window pops up that tells you that you need 3 (or 5, whatever) food value per party member resting, and lets you pick whatever food items you want from those that you have, to add up to the required 12 (or 20, whatever). If you don't have the food, you gain only half the normal benefits of resting and you become Hungry. Once you're Hungry, you cannot rest at all until you have sufficient food. Then just make sure that each of the merchants always has at least a little bit of food available to buy. On the off chance that the player hasn't managed to collect the hundreds and hundreds of food items currently available in the world.