Fix: Saving/loading a castle under construction results in segfault.

savegame: The inventory field of castles should be preserved even if the castle is still under construction.
Fix #52: Don't require double click to destroy buildings.

There is already a safety measure in the dialog box that needs to be confirmed before a building is destroyed. In addition, this fix allows the keyboard shortcut to activate the destroy button.
Fix #46: Replace problematic save path characters.

Add function to replace certain characters in a string (strreplace).
Replace problematic characters in file names. These are primarily a problem on windows platforms, but also other platforms using for example the FAT file system.
Fix #42: Print missing percentage sign in knight morale popup.
Fix #48: Remove visible cursor trail.

Store a buffer with the surface content potentially occluded by the cursor. Using this buffer the old cursor can be undrawn before it is moved.
Fix: playback of some sfx associated with working building.
building: Add BUILDING_IS_ACTIVE() macro to check activity bit.
Fix #48: Update cursor occulusion buffer on each frame to avoid glitch.
Fix: Initialize stock correctly such that it is recognized as an inventory building.
building: Add BUILDING_HAS_INVENTORY() macro.

Returns true for castles, and stocks that are complete and ready.
building: Convert packed stock field into struct.

As a side effect this fixes #53 by avoiding weird overflow errors.
building: Improve building checks through macros.

Add BUILDING_HAS_SERF() macro.
Use BUILDING_IS_BURNING() and BUILDING_IS_DONE() in more places.
building: Add macros for access to three more bits.

Add BUILDING_PLAYING_SFX() macro.
Add BUILDING_SERF_REQUESTED() macro.
Add BUILDING_SERF_REQUEST_FAIL() macro.
building: Add BUILDING_STATE() macro.
flag: Add and use FLAG_HAS_BUILDING() macro to guard access to building pointer.
flag: Add macros FLAG_PATHS() and FLAG_HAS_PATH().
building: Add comments describing access macros.
flag: Add accessor macros for flag struct fields.

Add macros FLAG_LAND_PATHS(), FLAG_IS_WATER_PATH(), FLAG_HAS_RESOURCES().
Add macros to check whether path has transporter: FLAG_TRANSPORTERS() and FLAG_HAS_TRANSPORTER().
Add macros FLAG_SERF_REQUEST_FAIL(), FLAG_SERF_REQUESTED().
Add macros for accessing transporter count: FLAG_TRANSPORTER_COUNT() and FLAG_LENGTH_CATEGORY().
Add macros for scheduled resources: FLAG_SCHEDULED_SLOT(), FLAG_IS_SCHEDULED().
Add macro FLAG_OTHER_END_DIR().
Add inventory related access macros: FLAG_HAS_INVENTORY(), FLAG_ACCEPTS_SERFS(), and FLAG_ACCEPTS_RESOURCES().
Add comments documenting flag accessor macros.
savegame: Remove incorrect TODO comment.
building: Move stock routing priorities to building struct.

Store the stock routing priority in building instead of flag, and store the requested resource type in building as well. This allows cleaner code for requesting resources and routing these correctly. It was necessary to add a pseudo resource type representing any food type, since this is the way food is requested by the mines. A RESOURCE_GROUP_FOOD was added to resource_type_t.