+The finance::has_money_or_assets method used for preventing bankrupt companies from using some tools uses the value of ATV_NON_FINANCIAL_ASSETS for TT_ALL, but this value is only correct if the finance history was recently recalculated, as book_new_vehicle doesn't keep it up to date. (Interestingly enough, update_assets - the only other method I can see that modifies a player's assets values - does.)
This meant that if you bought enough vehicles without doing something that would recalculate the history, e.g. opening the finance window or the month changing, the game could refuse to let you use some tools (e.g. terraforming) even though you did actually have some net wealth left.
Fix attached. I also changed has_money_or_assets to use the value of net wealth directly instead of recalculating it from account balance + assets apparently needlessly.
EDIT: I really should at least try compiling my patch first.
Attached patch has been updated