@@ -58,36 +58,6 @@ var mission = {
5858 }
5959} ;
6060
61- // List of Mission Text Abbreviations
62- // This is used to keep the Objectives list remain within max 2 lines per
63- // objective
64- function abbreviate ( text ) {
65- // Add as many abbreviations as needed
66- // This will keep the text within a line if possible
67- text = text . replace ( "Air Defense" , "AD" ) ;
68- text = text . replace ( "Airbase" , "AB" ) ;
69- text = text . replace ( "Depot" , "Dep" ) ;
70- text = text . replace ( "Runway" , "Rwy" ) ;
71- text = text . replace ( "Complex" , "Cmplx" ) ;
72- text = text . replace ( "Tower" , "Twr" ) ;
73- text = text . replace ( "Control" , "Ctrl" ) ;
74- text = text . replace ( "Center" , "Ctr" ) ;
75- text = text . replace ( "Factory" , "Fac" ) ;
76- text = text . replace ( "Section" , "Sec" ) ;
77- text = text . replace ( "Warehouse" , "Wrhs" ) ;
78- text = text . replace ( "Maintenance" , "Maint." ) ;
79- text = text . replace ( "Hangar" , "Hngr" ) ;
80- text = text . replace ( "Battalion" , "BN" ) ;
81- text = text . replace ( "Brigade" , "BDE" ) ;
82- text = text . replace ( "Defense" , "Def." ) ;
83- text = text . replace ( "Manufacturer" , "Mfr." ) ;
84- text = text . replace ( "Bridge Bridge" , "Bridge" ) ;
85- text = text . replace ( "Village" , "Vill." ) ;
86- text = text . replace ( "Transport" , "Tpt." ) ;
87- text = text . replace ( "Station" , "Sta." ) ;
88- return text ;
89- }
90-
9161// MISSION DATA PROCESSING
9262function clearMissionData ( ) {
9363 mission . ppts = [ ] ;
@@ -127,10 +97,7 @@ function isTargetWaypoint(index) {
12797}
12898
12999function getSteerpointType ( index ) {
130- if ( isTargetWaypoint ( index ) ) {
131- return "TGT" ;
132- }
133- return "STPT" ;
100+ return ( isTargetWaypoint ( index ) ) ?"TGT" :"STPT" ;
134101}
135102
136103// Parse and create ppt object
@@ -244,31 +211,24 @@ function getMissionTime() {
244211
245212function getTankerIndex ( ) {
246213 for ( var i = 0 ; i < mission . targets . length ; i ++ ) {
247- if ( mission . targets [ i ] . action == Action . Refuel ) {
248- return i ;
249- }
214+ if ( mission . targets [ i ] . action == Action . Refuel ) return i ;
250215 }
251216 return - 1 ;
252217}
253218
254219function getHomePlateIndex ( ) {
255220 for ( var i = 0 ; i < mission . targets . length ; i ++ ) {
256- if ( mission . targets [ i ] . action == Action . Land ) {
257- return i ;
258- }
221+ if ( mission . targets [ i ] . action == Action . Land ) return i ;
259222 }
260223 return - 1 ;
261224}
262225
263226function getAlternateIndex ( ) {
264227 var index = getHomePlateIndex ( ) ;
265228 for ( var i = ( index + 1 ) ; i < mission . targets . length ; i ++ ) {
266- if ( mission . targets [ i ] . action == Action . Land ) {
267- index = i ;
268- break ;
269- }
229+ if ( mission . targets [ i ] . action == Action . Land ) return i ;
270230 }
271- return index ;
231+ return - 1 ;
272232}
273233
274234function getEstimatedFuelUntil ( index ) {
@@ -317,9 +277,7 @@ function getMaxHomePlateDistance() {
317277function getMissionDistance ( ) {
318278 var distance = 0 ;
319279 for ( var i = 0 ; i < mission . route . length ; i ++ ) {
320- if ( mission . targets [ i ] . action == Action . Land ) {
321- break ;
322- }
280+ if ( mission . targets [ i ] . action == Action . Land ) break ;
323281 distance += mission . route [ i ] . dist ;
324282 }
325283 return ( distance ) ;
0 commit comments