General purpose c++ code from my game