pioneerspacesim/pioneer — pull request #2418 by fluffyfreak (2013-09-10 14:41:33+00:00)
Title: Bug fix for repeatedly loading terrain.

# Description:
Bug fix for repeatedly loading terrain which should fix issue #2405

I found that it was reloading the terrain heightmap for each and every patch requested due to my changes to unify the heightmaps :( Stupid mistake on my part testing with an SSD again so I hardly noticed anything.

Changed the Patch generation jobs to use the terrain pointer directly and to store it as a RefCountedPtr, made the terrain base class inherit from RefCounted and fixed up other minor things. This is probably the way I should originally have done it but I dislike passing pointer around across threads etc.

I've tested it, hyperspacing to and from the Sol system, checked that terrain is destroyed and reloaded and quit during generation etc. So far I haven't seen any issues but will try testing on my low-end Linux test box now.

# Commits:
Avoid using the terrain instance.
Make Terrain a RefCountedPtr object.
Hand off the terrain to a RefCountedPtr for each patch generation job.

Andy