

Read some of Frank’s own essays at Frank Views.įour Levels of Reality in Philip K. some of these may not be relevant to the save game code, some may be old COG stuff that the current engine doesn't even compile.Īll the calls to base class methods are explicit in the code: e.g., TPiece has TMover as a base class, and the so the save method for TPiece makes an explicit call to the save method in TMover.) You should be able to reconstruct all the class hierarchy from this.Thanks to Frank Bertrand and Yves Potin for contibuting this article to and to Yves for the new introduction. I've gotten better about this, but older code doesn't use it, though often the name of the variable should tell you whether it's of type char or char*: e.g., variables called "Name" are a good indication that they are strings.įinally, I'm including code for all Save(iostream) methods within my code. In some cases I don't use a Hungarian style prefix for string variables. when MSFT switched from PT to p, so did I, albeit a few years later. I follow some Hungarian-style naming conventions, so fVariable is usually a variable of type "float" and pVariable is a pointer, ppVariable a pointer to a pointer I also use code that uses PT and PTPT as the Hungarian-style prefixes, but this shouldn't be too confusing. the data that is not self explanatory you probably don't care about anyway. Similarly, the names of the actual data members should on the whole be self-explanatory. I can help sort these out if you're still interested and can't puzzle-out particular instantiations.


Player obviously goes with TPlayer) but in some cases it may not be obvious. It should be obvious in most cases which class instantiations go with which classes (i.e. I will include the code for the classes (or for the base classes, it gets tricky) after this method. This method also uses stream overrides for various classes of data, such as TPlayer. It also takes a pointer to a CHexWar object, which contains the data for detailed combat I'll include the data members of CHexWar and its base classes as well. sve file opened in text mode (I use fstream, but any iostream properly initialized will be OK). SaveGame_Stream takes a standard iostream on the. It is thorough, but I'm not sure the adjective "handy" applies since that generally connotes something that's easy with which to work. This should be all the code you need to program a loader for the.
