@@ -81,6 +81,7 @@ var Aircraft=Fiber.extend(function() {
81
81
this . heading = 0 ;
82
82
this . altitude = 0 ;
83
83
this . speed = 0 ;
84
+ this . groundSpeed = 0 ;
84
85
this . ds = 0 ;
85
86
86
87
this . radial = 0 ;
@@ -1317,9 +1318,28 @@ var Aircraft=Fiber.extend(function() {
1317
1318
if ( prop . game . option . get ( 'simplifySpeeds' ) == 'no' ) {
1318
1319
// Calculate the true air speed as indicated airspeed * 1.6% per 1000'
1319
1320
scaleSpeed *= 1 + ( this . altitude * 0.000016 ) ;
1321
+
1322
+ // Calculate movement including wind assuming wind speed
1323
+ // increases 2% per 1000'
1324
+ var wind = airport_get ( ) . wind ;
1325
+ var vector ;
1326
+ if ( this . isLanded ( ) ) {
1327
+ vector = vscale ( [ sin ( angle ) , cos ( angle ) ] , scaleSpeed ) ;
1328
+ }
1329
+ else {
1330
+ vector = vsum ( vscale ( [ sin ( wind . angle + Math . PI ) , cos ( wind . angle + Math . PI ) ] ,
1331
+ wind . speed * 0.000514444 * game_delta ( ) ) ,
1332
+ vscale ( [ sin ( angle ) , cos ( angle ) ] , scaleSpeed ) ) ;
1333
+ }
1334
+ this . ds = vlen ( vector ) ;
1335
+ this . groundSpeed = this . ds / 0.000514444 / game_delta ( ) ;
1336
+ this . position = vsum ( this . position , vector ) ;
1337
+ }
1338
+ else {
1339
+ this . ds = scaleSpeed ;
1340
+ this . groundSpeed = this . speed ;
1341
+ this . position = vsum ( this . position , vscale ( [ sin ( angle ) , cos ( angle ) ] , scaleSpeed ) ) ;
1320
1342
}
1321
- this . ds = scaleSpeed ;
1322
- this . position = vsum ( this . position , vscale ( [ sin ( angle ) , cos ( angle ) ] , scaleSpeed ) ) ;
1323
1343
1324
1344
this . distance = vlen ( this . position ) ;
1325
1345
this . radial = vradial ( this . position ) ;
0 commit comments