Melchior FRANZ:
I understand that the new hud/runway feature is still very experimental, and that the search criteria for the active runway don't necessarily make much sense. (We are searching for a runway on /sim/presets/airport-id that matches the current wind direction best, and not the tuned in ILS runway or something!) Anyway: the new hud code completely denies the possibility of globals->get_runways()->search() not finding a runway and returning false. There's always a runway found at KSFO, but not so at e.g. LOXL, in which case we are handing garbage over to sg_geodesy.cxx and find ourselves caught in an endless loop in geo_direct_wgs_84().
This commit is contained in:
parent
c537267f96
commit
fee003e8cc
2 changed files with 4 additions and 10 deletions
|
@ -692,7 +692,7 @@ private:
|
||||||
bool boundOutsidePoints(sgdVec3 v, sgdVec3 m);
|
bool boundOutsidePoints(sgdVec3 v, sgdVec3 m);
|
||||||
bool drawLine(sgdVec3 a1, sgdVec3 a2, sgdVec3 p1, sgdVec3 p2);
|
bool drawLine(sgdVec3 a1, sgdVec3 a2, sgdVec3 p1, sgdVec3 p2);
|
||||||
void drawArrow();
|
void drawArrow();
|
||||||
FGRunway get_active_runway();
|
bool get_active_runway(FGRunway& rwy);
|
||||||
void get_rwy_points(sgdVec3 *points);
|
void get_rwy_points(sgdVec3 *points);
|
||||||
void setLineWidth(void);
|
void setLineWidth(void);
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,6 @@ runway_instr::runway_instr(int x,
|
||||||
float scale_data,
|
float scale_data,
|
||||||
bool working):instr_item(x,y,width,height,NULL,scale_data,0,working)
|
bool working):instr_item(x,y,width,height,NULL,scale_data,0,working)
|
||||||
{
|
{
|
||||||
runway = get_active_runway();
|
|
||||||
get_rwy_points(points3d);
|
|
||||||
stippleOut=0xFFFF;
|
stippleOut=0xFFFF;
|
||||||
stippleCen=0xFFFF;
|
stippleCen=0xFFFF;
|
||||||
arrowScale = 1.0;
|
arrowScale = 1.0;
|
||||||
|
@ -65,7 +63,7 @@ runway_instr::runway_instr(int x,
|
||||||
}
|
}
|
||||||
|
|
||||||
void runway_instr::draw() {
|
void runway_instr::draw() {
|
||||||
if (!is_broken()) {
|
if (!is_broken() && get_active_runway(runway)) {
|
||||||
glPushAttrib(GL_LINE_STIPPLE | GL_LINE_STIPPLE_PATTERN | GL_LINE_WIDTH);
|
glPushAttrib(GL_LINE_STIPPLE | GL_LINE_STIPPLE_PATTERN | GL_LINE_WIDTH);
|
||||||
float modelView[4][4],projMat[4][4];
|
float modelView[4][4],projMat[4][4];
|
||||||
bool anyLines;
|
bool anyLines;
|
||||||
|
@ -90,8 +88,6 @@ void runway_instr::draw() {
|
||||||
}
|
}
|
||||||
//Set the camera to the cockpit view to get the view of the runway from the cockpit
|
//Set the camera to the cockpit view to get the view of the runway from the cockpit
|
||||||
ssgSetCamera((sgVec4 *)cockpit_view->get_VIEW());
|
ssgSetCamera((sgVec4 *)cockpit_view->get_VIEW());
|
||||||
//Get the currently active runway and the 3d points
|
|
||||||
runway = get_active_runway();
|
|
||||||
get_rwy_points(points3d);
|
get_rwy_points(points3d);
|
||||||
//Get the current project matrix
|
//Get the current project matrix
|
||||||
ssgGetProjectionMatrix(projMat);
|
ssgGetProjectionMatrix(projMat);
|
||||||
|
@ -150,13 +146,11 @@ void runway_instr::draw() {
|
||||||
}//if not broken
|
}//if not broken
|
||||||
}
|
}
|
||||||
|
|
||||||
FGRunway runway_instr::get_active_runway() {
|
bool runway_instr::get_active_runway(FGRunway& runway) {
|
||||||
FGEnvironment stationweather =
|
FGEnvironment stationweather =
|
||||||
((FGEnvironmentMgr *)globals->get_subsystem("environment"))->getEnvironment();
|
((FGEnvironmentMgr *)globals->get_subsystem("environment"))->getEnvironment();
|
||||||
double hdg = stationweather.get_wind_from_heading_deg();
|
double hdg = stationweather.get_wind_from_heading_deg();
|
||||||
FGRunway runway;
|
return globals->get_runways()->search( fgGetString("/sim/presets/airport-id"), int(hdg), &runway);
|
||||||
globals->get_runways()->search( fgGetString("/sim/presets/airport-id"), int(hdg), &runway);
|
|
||||||
return runway;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void runway_instr::get_rwy_points(sgdVec3 *points3d) {
|
void runway_instr::get_rwy_points(sgdVec3 *points3d) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue