Am Donnerstag, 29. November 2007 14:44 schrieb Hans Fugal:
> Is there not a way to sanity check the cloud cache size in the plib
> version before going ahead and segfaulting? Like notice that it's 0
> and set it to the lowest valid value. It seems that this would be a
> simple fix, and that there's really no excuse not to do it. Unless, of
> course, there is a real excuse...
This should do the trick: Instead of doing nothing when setting a new value to 
zero, the resolution and cacheSize is set to it's default value when trying 
to set it to zero.

It works on my copy, but maybe one of the screnegraph experts should comment 
this.

Torsten

Index: cloudfield.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/sky/cloudfield.cxx,v
retrieving revision 1.14.2.1
diff -u -p -r1.14.2.1 cloudfield.cxx
--- cloudfield.cxx      31 Jul 2007 01:19:11 -0000      1.14.2.1
+++ cloudfield.cxx      29 Nov 2007 15:18:13 -0000
@@ -80,6 +80,8 @@ int SGCloudField::get_CacheResolution(vo
 }

 void SGCloudField::set_CacheResolution(int resolutionPixels) {
+       if( resolutionPixels == 0 )
+               resolutionPixels = 64;
        if(cacheResolution == resolutionPixels)
                return;
        cacheResolution = resolutionPixels;
@@ -97,10 +99,10 @@ int SGCloudField::get_CacheSize(void) {

 void SGCloudField::set_CacheSize(int sizeKb) {
        // apply in rendering option dialog
+       if( sizeKb == 0 )
+               sizeKb = 1024;
        if(last_cache_size == sizeKb)
                return;
-       if(sizeKb == 0)
-               return;
        if(sizeKb)
                last_cache_size = sizeKb;
        if(enable3D) {

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to