OK, I've been reading a couple different c++ books and I started making a console based text adventure game for my kids. As I learn new things from the books I add/update my code, like when I learned about classes I made a class for the player, one for the monster, one for items you can get, etc.
My program has gotten much bigger now and I would like to make sure that I am structuring it correctly.
What are some good programming practices that I should follow in regards to where I should put various functions, etc. For example, I made a Player.h file where I declared my cPlayer class. Then I made a Player.cpp file where I defined all of it's members. I made a Chest.h file to create a class for chest armor, but I defined everything right where I declared it (string GetName(){return chestName;}), etc., no .cpp file for Chest.
My main cpp file, where the main() function is located, has like 12 #include statements, a bunch of function prototypes, constant declarations, and class instance statements. Do people usually make a separate header file to hold all of the stuff before main() and then just include that just to keep things neat and tidy? I put most of my functions in this main cpp file below the main() function, but I did create a couple separate files for other functions, like I made a Wait.cpp file that pauses the game for a number of milliseconds.
How do I know when I should put a function under the main() function or put it in it's own cpp file? What about classes?
Also, I have a Location.cpp file where I can call functions in it from the main.cpp file, but I can't call main.cpp functions from the Location.cpp file, or I can't call the wait() function from within Locations.cpp. What do I need to add to do that?
Thanks!