[aquaria] crash :/
Andrew Church
achurch+aquaria at achurch.org
Wed Apr 27 02:14:13 EDT 2011
>>So all IngrediantData* fields should be replaced with std::string fields?
>
>With respect to the food holders, yes. (I don't want to comment on other
>uses of IngredientData at the moment since I haven't checked them in
>detail.) Then you'd have a lookup call in each function that currently
>dereferences the stored pointer.
Actually, if you really wanted to dig deep, you could reorganize the food
inventory handling as a whole, such that all operations go through (for
example) FoodInventory::foo() methods; that would keep you safe against
reallocs without needing dozens of getIngredientByName() calls in each
food handling routine.
Figuring out how to keep track of how many of each ingredient are in
which containers is left as an exercise to those who are not already
90% asleep. (:
--Andrew Church
achurch at achurch.org
http://achurch.org/
More information about the aquaria
mailing list