C++ compatibility

Only C++ errors are fixed, no functionality changed.

Code now compatible with Visual Studio 2008. I think it's a good chance to increase number of active developers.
I don't agree, freeserf is not a library so we should prioritize consistent internal coding standards over accommodating  external use of headers. In any case you can include misc.h which will define the type.