Re: fpe in src/Airports/GenAirports/rwy_nonprec.cxx
Alex Romosan <[email protected]>
| Newsgroups | gmane.games.flightgear.terragear.devel |
|---|---|
| Message-ID | <[email protected]> |
Alex Romosan <[email protected]> writes: > this patch needs to be applied to cure an fpe in rwy_nonprec.cxx: turns out rwy_visual.cxx and rwy_prec.cxx suffer from the same problem. attached find an updated patch (including rwy_nonprec.cxx). --alex-- -- | I believe the moment is at hand when, by a paranoiac and active | | advance of the mind, it will be possible (simultaneously with | | automatism and other passive states) to systematize confusion | | and thus to help to discredit completely the world of reality. | _______________________________________________ Terragear-devel mailing list [email protected] http://mail.flightgear.org/mailman/listinfo/terragear-devel
patch.rwy
(text/x-patch, 3.2 KB)
Index: src/Airports/GenAirports/rwy_nonprec.cxx
===================================================================
RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Airports/GenAirports/rwy_nonprec.cxx,v
retrieving revision 1.15
diff -u -r1.15 rwy_nonprec.cxx
--- a/src/Airports/GenAirports/rwy_nonprec.cxx 7 Apr 2004 04:25:35 -0000 1.15
+++ b/src/Airports/GenAirports/rwy_nonprec.cxx 10 Apr 2004 18:26:17 -0000
@@ -373,6 +373,9 @@
// fit the 'rest' texture in as many times as will go evenly into
// the remaining distance so we don't end up with a super short
// section at the end.
+ if ( end1_pct >= 1.0 ) {
+ return;
+ }
double ideal_rest_inc = ( 200.0 / length );
int divs = (int)((1.0 - end1_pct) / ideal_rest_inc) + 1;
double rest1_inc = (1.0 - end1_pct) / divs;
@@ -390,6 +393,9 @@
rwy_polys, texparams, accum );
}
+ if ( end2_pct >= 1.0 ) {
+ return;
+ }
ideal_rest_inc = ( 200.0 / length );
divs = (int)((1.0 - end2_pct) / ideal_rest_inc) + 1;
double rest2_inc = (1.0 - end2_pct) / divs;
Index: src/Airports/GenAirports/rwy_prec.cxx
===================================================================
RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Airports/GenAirports/rwy_prec.cxx,v
retrieving revision 1.17
diff -u -r1.17 rwy_prec.cxx
--- a/src/Airports/GenAirports/rwy_prec.cxx 7 Apr 2004 04:34:00 -0000 1.17
+++ b/src/Airports/GenAirports/rwy_prec.cxx 10 Apr 2004 18:26:36 -0000
@@ -575,6 +575,9 @@
// fit the 'rest' texture in as many times as will go evenly into
// the remaining distance so we don't end up with a super short
// section at the end.
+ if ( end1_pct >= 1.0 ) {
+ return;
+ }
double ideal_rest_inc = ( 200.0 / length );
int divs = (int)((1.0 - end1_pct) / ideal_rest_inc) + 1;
double rest1_inc = (1.0 - end1_pct) / divs;
@@ -592,6 +595,9 @@
rwy_polys, texparams, accum );
}
+ if ( end2_pct >= 1.0 ) {
+ return;
+ }
ideal_rest_inc = ( 200.0 / length );
divs = (int)((1.0 - end2_pct) / ideal_rest_inc) + 1;
double rest2_inc = (1.0 - end2_pct) / divs;
Index: src/Airports/GenAirports/rwy_visual.cxx
===================================================================
RCS file: /var/cvs/TerraGear-0.0/TerraGear/src/Airports/GenAirports/rwy_visual.cxx,v
retrieving revision 1.16
diff -u -r1.16 rwy_visual.cxx
--- a/src/Airports/GenAirports/rwy_visual.cxx 7 Apr 2004 04:25:35 -0000 1.16
+++ b/src/Airports/GenAirports/rwy_visual.cxx 10 Apr 2004 18:27:12 -0000
@@ -378,6 +378,9 @@
// fit the 'rest' texture in as many times as will go evenly into
// the remaining distance so we don't end up with a super short
// section at the end.
+ if ( end1_pct >= 1.0 ) {
+ return;
+ }
double ideal_rest_inc = ( 200.0 / length );
int divs = (int)((1.0 - end1_pct) / ideal_rest_inc) + 1;
double rest1_inc = (1.0 - end1_pct) / divs;
@@ -396,6 +399,9 @@
rwy_polys, texparams, accum );
}
+ if ( end2_pct >= 1.0 ) {
+ return;
+ }
ideal_rest_inc = ( 200.0 / length );
divs = (int)((1.0 - end2_pct) / ideal_rest_inc) + 1;
double rest2_inc = (1.0 - end2_pct) / divs;