From 6eb28aabcfdad215340c8903e23de0a0f4fe0278 Mon Sep 17 00:00:00 2001
From: Matthew Maring <56924612+hayden2000@users.noreply.github.com>
Date: Wed, 29 Jul 2020 21:25:56 -0400
Subject: [PATCH] Prepare for propogation of winds, bug-fix for wind clearing

---
 Nasal/FMGC/winds.nas   | 70 +++++++++++++++++++++-------------------
 Nasal/MCDU/WINDCLB.nas | 43 ++++++++++++++++---------
 Nasal/MCDU/WINDCRZ.nas | 72 ++++++++++++++++++++++++++++--------------
 Nasal/MCDU/WINDDES.nas | 46 ++++++++++++++++++---------
 4 files changed, 146 insertions(+), 85 deletions(-)

diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas
index 327b3831..790fec4e 100644
--- a/Nasal/FMGC/winds.nas
+++ b/Nasal/FMGC/winds.nas
@@ -7,14 +7,16 @@ var wind = {
 		w.heading = 0;
 		w.magnitude = 0;
 		w.altitude = "";
+		w.set = 0;
 		return w;
 	},
 	
-	newcopy: func(heading, magnitude, altitude) {
+	newcopy: func(heading, magnitude, altitude, set) {
 		var w = {parents: [wind]};
 		w.heading = heading;
 		w.magnitude = magnitude;
 		w.altitude = altitude;
+		w.set = set;
 		return w;
 	}
 };
@@ -24,13 +26,15 @@ var alt_wind = {
 		var aw = {parents: [alt_wind]};
 		aw.heading = 0;
 		aw.magnitude = 0;
+		aw.set = 0;
 		return aw;
 	},
 	
-	newcopy: func(heading, magnitude) {
+	newcopy: func(heading, magnitude, set) {
 		var aw = {parents: [alt_wind]};
-		aw.heading = heading ;
+		aw.heading = heading;
 		aw.magnitude = magnitude;
+		aw.set = set;
 		return aw;
 	}
 };
@@ -40,13 +44,15 @@ var sat_temp = {
 		var st = {parents: [sat_temp]};
 		st.temp = 0;
 		st.altitude = "";
+		st.set = 0;
 		return st;
 	},
 	
-	newcopy: func(temp, altitude) {
+	newcopy: func(temp, altitude, set) {
 		var st = {parents: [sat_temp]};
 		st.temp = temp;
 		st.altitude = altitude;
+		st.set = set;
 		return st;
 	}
 };
@@ -121,13 +127,13 @@ var windController = {
 		var id = me.clb_winds[n].id;
 		var type = me.clb_winds[n].type;
 		var includeWind = me.clb_winds[n].includeWind;
-		var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude);
-		var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude);
-		var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude);
-		var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude);
-		var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude);
-		var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude);
-		var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude);
+		var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude, me.clb_winds[n].wind1.set);
+		var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude, me.clb_winds[n].wind2.set);
+		var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude, me.clb_winds[n].wind3.set);
+		var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude, me.clb_winds[n].wind4.set);
+		var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude, me.clb_winds[n].wind5.set);
+		var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude, me.clb_winds[n].sat1.set);
+		var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude, me.clb_winds[n].alt1.set);
 		return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
 	},
 	
@@ -135,13 +141,13 @@ var windController = {
 		var id = me.crz_winds[n].id;
 		var type = me.crz_winds[n].type;
 		var includeWind = me.crz_winds[n].includeWind;
-		var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude);
-		var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude);
-		var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude);
-		var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude);
-		var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude);
-		var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude);
-		var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude);
+		var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude, me.crz_winds[n].wind1.set);
+		var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude, me.crz_winds[n].wind2.set);
+		var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude, me.crz_winds[n].wind3.set);
+		var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude, me.crz_winds[n].wind4.set);
+		var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude, me.crz_winds[n].wind5.set);
+		var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude, me.crz_winds[n].sat1.set);
+		var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude, me.crz_winds[n].alt1.set);
 		return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
 	},
 	
@@ -149,13 +155,13 @@ var windController = {
 		var id = me.des_winds[n].id;
 		var type = me.des_winds[n].type;
 		var includeWind = me.des_winds[n].includeWind;
-		var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude);
-		var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude);
-		var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude);
-		var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude);
-		var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude);
-		var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude);
-		var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude);
+		var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude, me.des_winds[n].wind1.set);
+		var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude, me.des_winds[n].wind2.set);
+		var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude, me.des_winds[n].wind3.set);
+		var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude, me.des_winds[n].wind4.set);
+		var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude, me.des_winds[n].wind5.set);
+		var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude, me.des_winds[n].sat1.set);
+		var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude, me.des_winds[n].alt1.set);
 		return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
 	},
 	
@@ -165,13 +171,13 @@ var windController = {
 			var id = me.winds[n][i].id;
 			var type = me.winds[n][i].type;
 			var includeWind = me.winds[n][i].includeWind;
-			var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude);
-			var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude);
-			var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude);
-			var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude);
-			var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude);
-			var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude);
-			var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude);
+			var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude, me.winds[n][i].wind1.set);
+			var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude, me.winds[n][i].wind2.set);
+			var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude, me.winds[n][i].wind3.set);
+			var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude, me.winds[n][i].wind4.set);
+			var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude, me.winds[n][i].wind5.set);
+			var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude, me.winds[n][i].sat1.set);
+			var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude, me.winds[n][i].alt1.set);
 			append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1));
 		}
 		return tempWind;
diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas
index 7b69a85b..49fae708 100644
--- a/Nasal/MCDU/WINDCLB.nas
+++ b/Nasal/MCDU/WINDCLB.nas
@@ -53,17 +53,13 @@ var windCLBPage = {
 			computer_temp = me.computer;
 		}
 		
-		#debug.dump(fmgc.windController.clb_winds[0]);
-		#debug.dump(fmgc.windController.clb_winds[1]);
-		#debug.dump(fmgc.windController.clb_winds[2]);
-		
-		if (fmgc.windController.clb_winds[computer_temp] == 0 or fmgc.windController.clb_winds[computer_temp].wind1.altitude == "") {
+		if (fmgc.windController.clb_winds[computer_temp] == 0 or !fmgc.windController.clb_winds[computer_temp].wind1.set) {
 			me.items = 1;
-		} else if (fmgc.windController.clb_winds[computer_temp].wind2.altitude == "") {
+		} else if (!fmgc.windController.clb_winds[computer_temp].wind2.set) {
 			me.items = 2;
-		} else if (fmgc.windController.clb_winds[computer_temp].wind3.altitude == "") {
+		} else if (!fmgc.windController.clb_winds[computer_temp].wind3.set) {
 			me.items = 3;
-		} else if (fmgc.windController.clb_winds[computer_temp].wind4.altitude == "") {
+		} else if (!fmgc.windController.clb_winds[computer_temp].wind4.set) {
 			me.items = 4;
 		} else {
 			me.items = 5;
@@ -71,7 +67,7 @@ var windCLBPage = {
 		
 		if (me.items >= 5) {
 			var windStore = fmgc.windController.clb_winds[computer_temp].wind5;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][4] = 1;
 			} else {
@@ -84,7 +80,7 @@ var windCLBPage = {
 		
 		if (me.items >= 4) {
 			var windStore = fmgc.windController.clb_winds[computer_temp].wind4;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][3] = 1;
 			} else {
@@ -97,7 +93,7 @@ var windCLBPage = {
 		
 		if (me.items >= 3) {
 			var windStore = fmgc.windController.clb_winds[computer_temp].wind3;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][2] = 1;
 			} else {
@@ -110,7 +106,7 @@ var windCLBPage = {
 		
 		if (me.items >= 2) {
 			var windStore = fmgc.windController.clb_winds[computer_temp].wind2;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][1] = 1;
 			} else {
@@ -123,7 +119,7 @@ var windCLBPage = {
 		
 		if (me.items >= 1) {
 			var windStore = fmgc.windController.clb_winds[computer_temp].wind1;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
 				me.fontMatrix[0][0] = 1;
 			} else {
@@ -205,27 +201,31 @@ var windCLBPage = {
 					if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
 						computer_temp = me.computer;
 					}
-					#print(computer_temp);
 					if (index == 5) {
 						fmgc.windController.clb_winds[computer_temp].wind5.heading = winds[0];
 						fmgc.windController.clb_winds[computer_temp].wind5.magnitude = winds[1];
 						fmgc.windController.clb_winds[computer_temp].wind5.altitude = winds[2];
+						fmgc.windController.clb_winds[computer_temp].wind5.set = 1;
 					} else if (index == 4) {
 						fmgc.windController.clb_winds[computer_temp].wind4.heading = winds[0];
 						fmgc.windController.clb_winds[computer_temp].wind4.magnitude = winds[1];
 						fmgc.windController.clb_winds[computer_temp].wind4.altitude = winds[2];
+						fmgc.windController.clb_winds[computer_temp].wind4.set = 1;
 					} else if (index == 3) {
 						fmgc.windController.clb_winds[computer_temp].wind3.heading = winds[0];
 						fmgc.windController.clb_winds[computer_temp].wind3.magnitude = winds[1];
 						fmgc.windController.clb_winds[computer_temp].wind3.altitude = winds[2];
+						fmgc.windController.clb_winds[computer_temp].wind3.set = 1;
 					} else if (index == 2) {
 						fmgc.windController.clb_winds[computer_temp].wind2.heading = winds[0];
 						fmgc.windController.clb_winds[computer_temp].wind2.magnitude = winds[1];
 						fmgc.windController.clb_winds[computer_temp].wind2.altitude = winds[2];
+						fmgc.windController.clb_winds[computer_temp].wind2.set = 1;
 					} else if (index == 1) {
 						fmgc.windController.clb_winds[computer_temp].wind1.heading = winds[0];
 						fmgc.windController.clb_winds[computer_temp].wind1.magnitude = winds[1];
 						fmgc.windController.clb_winds[computer_temp].wind1.altitude = winds[2];
+						fmgc.windController.clb_winds[computer_temp].wind1.set = 1;
 					}
 					mcdu_scratchpad.scratchpads[me.computer].empty();
 					if (me.items == index and index != 5) {
@@ -246,44 +246,57 @@ var windCLBPage = {
 						fmgc.windController.clb_winds[computer_temp].wind5.heading = 0;
 						fmgc.windController.clb_winds[computer_temp].wind5.magnitude = 0;
 						fmgc.windController.clb_winds[computer_temp].wind5.altitude = "";
+						fmgc.windController.clb_winds[computer_temp].wind5.set = 0;
 					} else if (index == 4) {
 						fmgc.windController.clb_winds[computer_temp].wind4.heading = 0;
 						fmgc.windController.clb_winds[computer_temp].wind4.magnitude = 0;
 						fmgc.windController.clb_winds[computer_temp].wind4.altitude = "";
+						fmgc.windController.clb_winds[computer_temp].wind4.set = 0;
 					} else if (index == 3) {
 						fmgc.windController.clb_winds[computer_temp].wind3.heading = 0;
 						fmgc.windController.clb_winds[computer_temp].wind3.magnitude = 0;
 						fmgc.windController.clb_winds[computer_temp].wind3.altitude = "";
+						fmgc.windController.clb_winds[computer_temp].wind3.set = 0;
 					} else if (index == 2) {
 						fmgc.windController.clb_winds[computer_temp].wind2.heading = 0;
 						fmgc.windController.clb_winds[computer_temp].wind2.magnitude = 0;
 						fmgc.windController.clb_winds[computer_temp].wind2.altitude = "";
+						fmgc.windController.clb_winds[computer_temp].wind2.set = 0;
 					} else if (index == 1) {
 						fmgc.windController.clb_winds[computer_temp].wind1.heading = 0;
 						fmgc.windController.clb_winds[computer_temp].wind1.magnitude = 0;
 						fmgc.windController.clb_winds[computer_temp].wind1.altitude = "";
+						fmgc.windController.clb_winds[computer_temp].wind1.set = 0;
 					}
 				} else {
 					if (index <= 1) {
 						fmgc.windController.clb_winds[computer_temp].wind1.heading = fmgc.windController.clb_winds[computer_temp].wind2.heading;
 						fmgc.windController.clb_winds[computer_temp].wind1.magnitude = fmgc.windController.clb_winds[computer_temp].wind2.magnitude;
 						fmgc.windController.clb_winds[computer_temp].wind1.altitude = fmgc.windController.clb_winds[computer_temp].wind2.altitude;
+						fmgc.windController.clb_winds[computer_temp].wind1.set = fmgc.windController.clb_winds[computer_temp].wind2.set;
 					}
 					if (index <= 2) {
 						fmgc.windController.clb_winds[computer_temp].wind2.heading = fmgc.windController.clb_winds[computer_temp].wind3.heading;
 						fmgc.windController.clb_winds[computer_temp].wind2.magnitude = fmgc.windController.clb_winds[computer_temp].wind3.magnitude;
 						fmgc.windController.clb_winds[computer_temp].wind2.altitude = fmgc.windController.clb_winds[computer_temp].wind3.altitude;
+						fmgc.windController.clb_winds[computer_temp].wind2.set = fmgc.windController.clb_winds[computer_temp].wind3.set;
 					}
 					if (index <= 3) {
 						fmgc.windController.clb_winds[computer_temp].wind3.heading = fmgc.windController.clb_winds[computer_temp].wind4.heading;
 						fmgc.windController.clb_winds[computer_temp].wind3.magnitude = fmgc.windController.clb_winds[computer_temp].wind4.magnitude;
 						fmgc.windController.clb_winds[computer_temp].wind3.altitude = fmgc.windController.clb_winds[computer_temp].wind4.altitude;
+						fmgc.windController.clb_winds[computer_temp].wind3.set = fmgc.windController.clb_winds[computer_temp].wind4.set;
 					}
 					if (index <= 4) {
 						fmgc.windController.clb_winds[computer_temp].wind4.heading = fmgc.windController.clb_winds[computer_temp].wind5.heading;
 						fmgc.windController.clb_winds[computer_temp].wind4.magnitude = fmgc.windController.clb_winds[computer_temp].wind5.magnitude;
 						fmgc.windController.clb_winds[computer_temp].wind4.altitude = fmgc.windController.clb_winds[computer_temp].wind5.altitude;
-					}	
+						fmgc.windController.clb_winds[computer_temp].wind4.set = fmgc.windController.clb_winds[computer_temp].wind5.set;
+					}
+					fmgc.windController.clb_winds[computer_temp].wind5.heading = 0;
+					fmgc.windController.clb_winds[computer_temp].wind5.magnitude = 0;
+					fmgc.windController.clb_winds[computer_temp].wind5.altitude = "";
+					fmgc.windController.clb_winds[computer_temp].wind5.set = 0;
 				}
 				mcdu_scratchpad.scratchpads[me.computer].empty();
 				me.items -= 1;
diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas
index 597cf936..be659068 100644
--- a/Nasal/MCDU/WINDCRZ.nas
+++ b/Nasal/MCDU/WINDCRZ.nas
@@ -66,27 +66,23 @@ var windCRZPage = {
 			computer_temp = me.computer;
 		}
 		
-		#debug.dump(fmgc.windController.crz_winds[0]);
-		#debug.dump(fmgc.windController.crz_winds[1]);
-		#debug.dump(fmgc.windController.crz_winds[2]);
-		
 		if (me.singleCRZ == 1) {
-			if (fmgc.windController.crz_winds[computer_temp] == 0 or fmgc.windController.crz_winds[computer_temp].wind1.altitude == "") {
+			if (fmgc.windController.crz_winds[computer_temp] == 0 or !fmgc.windController.crz_winds[computer_temp].wind1.set) {
 				me.items = 1;
-			} else if (fmgc.windController.crz_winds[computer_temp].wind2.altitude == "") {
+			} else if (!fmgc.windController.crz_winds[computer_temp].wind2.set) {
 				me.items = 2;
-			} else if (fmgc.windController.crz_winds[computer_temp].wind3.altitude == "") {
+			} else if (!fmgc.windController.crz_winds[computer_temp].wind3.set) {
 				me.items = 3;
 			} else {
 				me.items = 4;
 			}
 		} else {
 			me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location];
-			if (size(fmgc.windController.winds[computer_temp]) == 0 or fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude == "") {
+			if (size(fmgc.windController.winds[computer_temp]) == 0 or !fmgc.windController.winds[computer_temp][me.match_location].wind1.set) {
 				me.items = 1;
-			} else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") {
+			} else if (!fmgc.windController.winds[computer_temp][me.match_location].wind2.set) {
 				me.items = 2;
-			} else if (fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude == "") {
+			} else if (!fmgc.windController.winds[computer_temp][me.match_location].wind3.set) {
 				me.items = 3;
 			} else {
 				me.items = 4;
@@ -97,7 +93,7 @@ var windCRZPage = {
 		if (me.singleCRZ == 1) {
 			if (me.items >= 4) {
 				var windStore = fmgc.windController.crz_winds[computer_temp].wind4;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][3] = 1;
 				} else {
@@ -110,7 +106,7 @@ var windCRZPage = {
 		
 			if (me.items >= 3) {
 				var windStore = fmgc.windController.crz_winds[computer_temp].wind3;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][2] = 1;
 				} else {
@@ -123,7 +119,7 @@ var windCRZPage = {
 		
 			if (me.items >= 2) {
 				var windStore = fmgc.windController.crz_winds[computer_temp].wind2;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][1] = 1;
 				} else {
@@ -136,7 +132,7 @@ var windCRZPage = {
 		
 			if (me.items >= 1) {
 				var windStore = fmgc.windController.crz_winds[computer_temp].wind1;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
 					me.fontMatrix[0][0] = 1;
 				} else {
@@ -146,7 +142,7 @@ var windCRZPage = {
 			}
 			
 			var windStore = fmgc.windController.crz_winds[computer_temp].sat1;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
 				me.fontMatrix[0][4] = 1;
 			} else {
@@ -156,7 +152,7 @@ var windCRZPage = {
 		} else {
 			if (me.items >= 4) {
 				var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][3] = 1;
 				} else {
@@ -169,7 +165,7 @@ var windCRZPage = {
 		
 			if (me.items >= 3) {
 				var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][2] = 1;
 				} else {
@@ -182,7 +178,7 @@ var windCRZPage = {
 		
 			if (me.items >= 2) {
 				var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 					me.fontMatrix[0][1] = 1;
 				} else {
@@ -195,7 +191,7 @@ var windCRZPage = {
 		
 			if (me.items >= 1) {
 				var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1;
-				if (windStore.altitude != "") {
+				if (windStore.set) {
 					me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
 					me.fontMatrix[0][0] = 1;
 				} else {
@@ -205,7 +201,7 @@ var windCRZPage = {
 			}
 			
 			var windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
 				me.fontMatrix[0][4] = 1;
 			} else {
@@ -292,13 +288,14 @@ var windCRZPage = {
 					if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
 						computer_temp = me.computer;
 					}
-					#print(computer_temp);
 					if (me.singleCRZ == 1) {
 						fmgc.windController.crz_winds[computer_temp].sat1.temp = winds[0];
 						fmgc.windController.crz_winds[computer_temp].sat1.altitude = winds[1];
+						fmgc.windController.crz_winds[computer_temp].sat1.set = 1;
 					} else {
 						fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = winds[0];
 						fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = winds[1];
+						fmgc.windController.winds[computer_temp][me.match_location].sat1.set = 1;
 					}
 					mcdu_scratchpad.scratchpads[me.computer].empty();
 					me._setupPageWithData();
@@ -313,6 +310,7 @@ var windCRZPage = {
 				}
 				fmgc.windController.crz_winds[computer_temp].sat1.temp = 0;
 				fmgc.windController.crz_winds[computer_temp].sat1.altitude = "";
+				fmgc.windController.crz_winds[computer_temp].sat1.set = 0;
 				mcdu_scratchpad.scratchpads[me.computer].empty();
 				me._setupPageWithData();
 				me.updateTmpy();
@@ -334,42 +332,49 @@ var windCRZPage = {
 					if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
 						computer_temp = me.computer;
 					}
-					#print(computer_temp);
 					if (me.singleCRZ == 1) {
 						if (index == 4) {
 							fmgc.windController.crz_winds[computer_temp].wind4.heading = winds[0];
 							fmgc.windController.crz_winds[computer_temp].wind4.magnitude = winds[1];
 							fmgc.windController.crz_winds[computer_temp].wind4.altitude = winds[2];
+							fmgc.windController.crz_winds[computer_temp].wind4.set = 1;
 						} else if (index == 3) {
 							fmgc.windController.crz_winds[computer_temp].wind3.heading = winds[0];
 							fmgc.windController.crz_winds[computer_temp].wind3.magnitude = winds[1];
 							fmgc.windController.crz_winds[computer_temp].wind3.altitude = winds[2];
+							fmgc.windController.crz_winds[computer_temp].wind3.set = 1;
 						} else if (index == 2) {
 							fmgc.windController.crz_winds[computer_temp].wind2.heading = winds[0];
 							fmgc.windController.crz_winds[computer_temp].wind2.magnitude = winds[1];
 							fmgc.windController.crz_winds[computer_temp].wind2.altitude = winds[2];
+							fmgc.windController.crz_winds[computer_temp].wind2.set = 1;
 						} else if (index == 1) {
 							fmgc.windController.crz_winds[computer_temp].wind1.heading = winds[0];
 							fmgc.windController.crz_winds[computer_temp].wind1.magnitude = winds[1];
 							fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2];
+							fmgc.windController.crz_winds[computer_temp].wind1.set = 1;
 						}
 					} else {
 						if (index == 4) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = winds[0];
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = winds[1];
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = winds[2];
+							fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 1;
 						} else if (index == 3) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = winds[0];
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = winds[1];
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = winds[2];
+							fmgc.windController.winds[computer_temp][me.match_location].wind3.set = 1;
 						} else if (index == 2) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = winds[0];
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = winds[1];
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = winds[2];
+							fmgc.windController.winds[computer_temp][me.match_location].wind2.set = 1;
 						} else if (index == 1) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = winds[0];
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = winds[1];
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = winds[2];
+							fmgc.windController.winds[computer_temp][me.match_location].wind1.set = 1;
 						}
 					}
 					mcdu_scratchpad.scratchpads[me.computer].empty();
@@ -386,42 +391,52 @@ var windCRZPage = {
 				if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
 					computer_temp = me.computer;
 				}
-				#print(computer_temp);
 				if (me.singleCRZ == 1) {
 					if (me.items == index) {
 						if (index == 4) {
 							fmgc.windController.crz_winds[computer_temp].wind4.heading = 0;
 							fmgc.windController.crz_winds[computer_temp].wind4.magnitude = 0;
 							fmgc.windController.crz_winds[computer_temp].wind4.altitude = "";
+							fmgc.windController.crz_winds[computer_temp].wind4.set = 0;
 						} else if (index == 3) {
 							fmgc.windController.crz_winds[computer_temp].wind3.heading = 0;
 							fmgc.windController.crz_winds[computer_temp].wind3.magnitude = 0;
 							fmgc.windController.crz_winds[computer_temp].wind3.altitude = "";
+							fmgc.windController.crz_winds[computer_temp].wind3.set = 0;
 						} else if (index == 2) {
 							fmgc.windController.crz_winds[computer_temp].wind2.heading = 0;
 							fmgc.windController.crz_winds[computer_temp].wind2.magnitude = 0;
 							fmgc.windController.crz_winds[computer_temp].wind2.altitude = "";
+							fmgc.windController.crz_winds[computer_temp].wind2.set = 0;
 						} else if (index == 1) {
 							fmgc.windController.crz_winds[computer_temp].wind1.heading = 0;
 							fmgc.windController.crz_winds[computer_temp].wind1.magnitude = 0;
 							fmgc.windController.crz_winds[computer_temp].wind1.altitude = "";
+							fmgc.windController.crz_winds[computer_temp].wind1.set = 0;
 						}
 					} else {
 						if (index <= 1) {
 							fmgc.windController.crz_winds[computer_temp].wind1.heading = fmgc.windController.crz_winds[computer_temp].wind2.heading;
 							fmgc.windController.crz_winds[computer_temp].wind1.magnitude = fmgc.windController.crz_winds[computer_temp].wind2.magnitude;
 							fmgc.windController.crz_winds[computer_temp].wind1.altitude = fmgc.windController.crz_winds[computer_temp].wind2.altitude;
+							fmgc.windController.crz_winds[computer_temp].wind1.set = fmgc.windController.crz_winds[computer_temp].wind2.set;
 						}
 						if (index <= 2) {
 							fmgc.windController.crz_winds[computer_temp].wind2.heading = fmgc.windController.crz_winds[computer_temp].wind3.heading;
 							fmgc.windController.crz_winds[computer_temp].wind2.magnitude = fmgc.windController.crz_winds[computer_temp].wind3.magnitude;
 							fmgc.windController.crz_winds[computer_temp].wind2.altitude = fmgc.windController.crz_winds[computer_temp].wind3.altitude;
+							fmgc.windController.crz_winds[computer_temp].wind2.set = fmgc.windController.crz_winds[computer_temp].wind3.set;
 						}
 						if (index <= 3) {
 							fmgc.windController.crz_winds[computer_temp].wind3.heading = fmgc.windController.crz_winds[computer_temp].wind4.heading;
 							fmgc.windController.crz_winds[computer_temp].wind3.magnitude = fmgc.windController.crz_winds[computer_temp].wind4.magnitude;
 							fmgc.windController.crz_winds[computer_temp].wind3.altitude = fmgc.windController.crz_winds[computer_temp].wind4.altitude;
+							fmgc.windController.crz_winds[computer_temp].wind3.set = fmgc.windController.crz_winds[computer_temp].wind4.set;
 						}
+						fmgc.windController.crz_winds[computer_temp].wind4.heading = 0;
+						fmgc.windController.crz_winds[computer_temp].wind4.magnitude = 0;
+						fmgc.windController.crz_winds[computer_temp].wind4.altitude = "";
+						fmgc.windController.crz_winds[computer_temp].wind4.set = 0;
 					}
 				} else {
 					if (me.items == index) {
@@ -429,35 +444,46 @@ var windCRZPage = {
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = "";
+							fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 0;
 						} else if (index == 3) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = "";
+							fmgc.windController.winds[computer_temp][me.match_location].wind3.set = 0;
 						} else if (index == 2) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = "";
+							fmgc.windController.winds[computer_temp][me.match_location].wind2.set = 0;
 						} else if (index == 1) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = 0;
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = "";
+							fmgc.windController.winds[computer_temp][me.match_location].wind1.set = 0;
 						}
 					} else {
 						if (index <= 1) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = fmgc.windController.winds[computer_temp][me.match_location].wind2.heading;
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude;
 							fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude;
+							fmgc.windController.winds[computer_temp][me.match_location].wind1.set = fmgc.windController.winds[computer_temp][me.match_location].wind2.set;
 						}
 						if (index <= 2) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = fmgc.windController.winds[computer_temp][me.match_location].wind3.heading;
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude;
 							fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude;
+							fmgc.windController.winds[computer_temp][me.match_location].wind2.set = fmgc.windController.winds[computer_temp][me.match_location].wind3.set;
 						}
 						if (index <= 3) {
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = fmgc.windController.winds[computer_temp][me.match_location].wind4.heading;
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude;
 							fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude;
+							fmgc.windController.winds[computer_temp][me.match_location].wind3.set = fmgc.windController.winds[computer_temp][me.match_location].wind4.set;
 						}
+						fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = 0;
+						fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = 0;
+						fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = "";
+						fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 0;
 					}
 				}
 				mcdu_scratchpad.scratchpads[me.computer].empty();
diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas
index 6b5460de..e7add02d 100644
--- a/Nasal/MCDU/WINDDES.nas
+++ b/Nasal/MCDU/WINDDES.nas
@@ -54,17 +54,13 @@ var windDESPage = {
 			computer_temp = me.computer;
 		}
 		
-		# debug.dump(fmgc.windController.des_winds[0]);
-# 		debug.dump(fmgc.windController.des_winds[1]);
-# 		debug.dump(fmgc.windController.des_winds[2]);
-		
-		if (fmgc.windController.des_winds[computer_temp] == 0 or fmgc.windController.des_winds[computer_temp].wind1.altitude == "") {
+		if (fmgc.windController.des_winds[computer_temp] == 0 or !fmgc.windController.des_winds[computer_temp].wind1.set) {
 			me.items = 1;
-		} else if (fmgc.windController.des_winds[computer_temp].wind2.altitude == "") {
+		} else if (!fmgc.windController.des_winds[computer_temp].wind2.set) {
 			me.items = 2;
-		} else if (fmgc.windController.des_winds[computer_temp].wind3.altitude == "") {
+		} else if (!fmgc.windController.des_winds[computer_temp].wind3.set) {
 			me.items = 3;
-		} else if (fmgc.windController.des_winds[computer_temp].wind4.altitude == "") {
+		} else if (!fmgc.windController.des_winds[computer_temp].wind4.set) {
 			me.items = 4;
 		} else {
 			me.items = 5;
@@ -72,7 +68,7 @@ var windDESPage = {
 		
 		if (me.items >= 5) {
 			var windStore = fmgc.windController.des_winds[computer_temp].wind5;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][4] = 1;
 			} else {
@@ -85,7 +81,7 @@ var windDESPage = {
 		
 		if (me.items >= 4) {
 			var windStore = fmgc.windController.des_winds[computer_temp].wind4;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][3] = 1;
 			} else {
@@ -98,7 +94,7 @@ var windDESPage = {
 		
 		if (me.items >= 3) {
 			var windStore = fmgc.windController.des_winds[computer_temp].wind3;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][2] = 1;
 			} else {
@@ -111,7 +107,7 @@ var windDESPage = {
 		
 		if (me.items >= 2) {
 			var windStore = fmgc.windController.des_winds[computer_temp].wind2;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
 				me.fontMatrix[0][1] = 1;
 			} else {
@@ -124,7 +120,7 @@ var windDESPage = {
 		
 		if (me.items >= 1) {
 			var windStore = fmgc.windController.des_winds[computer_temp].wind1;
-			if (windStore.altitude != "") {
+			if (windStore.set) {
 				me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
 				me.fontMatrix[0][0] = 1;
 			} else {
@@ -137,7 +133,7 @@ var windDESPage = {
 		
 		if (fmgc.FMGCInternal.altAirportSet) {
 			var windStore = fmgc.windController.des_winds[computer_temp].alt1;
-			if (windStore.heading != 0 and windStore.magnitude != 0) {
+			if (windStore.set) {
 				me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
 				me.fontMatrix[1][0] = 1;
 			} else {
@@ -241,22 +237,27 @@ var windDESPage = {
 						fmgc.windController.des_winds[computer_temp].wind5.heading = winds[0];
 						fmgc.windController.des_winds[computer_temp].wind5.magnitude = winds[1];
 						fmgc.windController.des_winds[computer_temp].wind5.altitude = winds[2];
+						fmgc.windController.des_winds[computer_temp].wind5.set = 1;
 					} else if (index == 4) {
 						fmgc.windController.des_winds[computer_temp].wind4.heading = winds[0];
 						fmgc.windController.des_winds[computer_temp].wind4.magnitude = winds[1];
 						fmgc.windController.des_winds[computer_temp].wind4.altitude = winds[2];
+						fmgc.windController.des_winds[computer_temp].wind4.set = 1;
 					} else if (index == 3) {
 						fmgc.windController.des_winds[computer_temp].wind3.heading = winds[0];
 						fmgc.windController.des_winds[computer_temp].wind3.magnitude = winds[1];
 						fmgc.windController.des_winds[computer_temp].wind3.altitude = winds[2];
+						fmgc.windController.des_winds[computer_temp].wind3.set = 1;
 					} else if (index == 2) {
 						fmgc.windController.des_winds[computer_temp].wind2.heading = winds[0];
 						fmgc.windController.des_winds[computer_temp].wind2.magnitude = winds[1];
 						fmgc.windController.des_winds[computer_temp].wind2.altitude = winds[2];
+						fmgc.windController.des_winds[computer_temp].wind2.set = 1;
 					} else if (index == 1) {
 						fmgc.windController.des_winds[computer_temp].wind1.heading = winds[0];
 						fmgc.windController.des_winds[computer_temp].wind1.magnitude = winds[1];
 						fmgc.windController.des_winds[computer_temp].wind1.altitude = winds[2];
+						fmgc.windController.des_winds[computer_temp].wind1.set = 1;
 					}
 					mcdu_scratchpad.scratchpads[me.computer].empty();
 					if (me.items == index and index != 5) {
@@ -277,44 +278,57 @@ var windDESPage = {
 						fmgc.windController.des_winds[computer_temp].wind5.heading = 0;
 						fmgc.windController.des_winds[computer_temp].wind5.magnitude = 0;
 						fmgc.windController.des_winds[computer_temp].wind5.altitude = "";
+						fmgc.windController.des_winds[computer_temp].wind5.set = 0;
 					} else if (index == 4) {
 						fmgc.windController.des_winds[computer_temp].wind4.heading = 0;
 						fmgc.windController.des_winds[computer_temp].wind4.magnitude = 0;
 						fmgc.windController.des_winds[computer_temp].wind4.altitude = "";
+						fmgc.windController.des_winds[computer_temp].wind4.set = 0;
 					} else if (index == 3) {
 						fmgc.windController.des_winds[computer_temp].wind3.heading = 0;
 						fmgc.windController.des_winds[computer_temp].wind3.magnitude = 0;
 						fmgc.windController.des_winds[computer_temp].wind3.altitude = "";
+						fmgc.windController.des_winds[computer_temp].wind3.set = 0;
 					} else if (index == 2) {
 						fmgc.windController.des_winds[computer_temp].wind2.heading = 0;
 						fmgc.windController.des_winds[computer_temp].wind2.magnitude = 0;
 						fmgc.windController.des_winds[computer_temp].wind2.altitude = "";
+						fmgc.windController.des_winds[computer_temp].wind2.set = 0;
 					} else if (index == 1) {
 						fmgc.windController.des_winds[computer_temp].wind1.heading = 0;
 						fmgc.windController.des_winds[computer_temp].wind1.magnitude = 0;
 						fmgc.windController.des_winds[computer_temp].wind1.altitude = "";
+						fmgc.windController.des_winds[computer_temp].wind1.set = 0;
 					}
 				} else {
 					if (index <= 1) {
 						fmgc.windController.des_winds[computer_temp].wind1.heading = fmgc.windController.des_winds[computer_temp].wind2.heading;
 						fmgc.windController.des_winds[computer_temp].wind1.magnitude = fmgc.windController.des_winds[computer_temp].wind2.magnitude;
 						fmgc.windController.des_winds[computer_temp].wind1.altitude = fmgc.windController.des_winds[computer_temp].wind2.altitude;
+						fmgc.windController.des_winds[computer_temp].wind1.set = fmgc.windController.des_winds[computer_temp].wind2.set;
 					}
 					if (index <= 2) {
 						fmgc.windController.des_winds[computer_temp].wind2.heading = fmgc.windController.des_winds[computer_temp].wind3.heading;
 						fmgc.windController.des_winds[computer_temp].wind2.magnitude = fmgc.windController.des_winds[computer_temp].wind3.magnitude;
 						fmgc.windController.des_winds[computer_temp].wind2.altitude = fmgc.windController.des_winds[computer_temp].wind3.altitude;
+						fmgc.windController.des_winds[computer_temp].wind2.set = fmgc.windController.des_winds[computer_temp].wind3.set;
 					}
 					if (index <= 3) {
 						fmgc.windController.des_winds[computer_temp].wind3.heading = fmgc.windController.des_winds[computer_temp].wind4.heading;
 						fmgc.windController.des_winds[computer_temp].wind3.magnitude = fmgc.windController.des_winds[computer_temp].wind4.magnitude;
 						fmgc.windController.des_winds[computer_temp].wind3.altitude = fmgc.windController.des_winds[computer_temp].wind4.altitude;
+						fmgc.windController.des_winds[computer_temp].wind3.set = fmgc.windController.des_winds[computer_temp].wind4.set;
 					}
 					if (index <= 4) {
 						fmgc.windController.des_winds[computer_temp].wind4.heading = fmgc.windController.des_winds[computer_temp].wind5.heading;
 						fmgc.windController.des_winds[computer_temp].wind4.magnitude = fmgc.windController.des_winds[computer_temp].wind5.magnitude;
 						fmgc.windController.des_winds[computer_temp].wind4.altitude = fmgc.windController.des_winds[computer_temp].wind5.altitude;
-					}	
+						fmgc.windController.des_winds[computer_temp].wind4.set = fmgc.windController.des_winds[computer_temp].wind5.set;
+					}
+					fmgc.windController.des_winds[computer_temp].wind5.heading = 0;
+					fmgc.windController.des_winds[computer_temp].wind5.magnitude = 0;
+					fmgc.windController.des_winds[computer_temp].wind5.altitude = "";
+					fmgc.windController.des_winds[computer_temp].wind5.set = 0;
 				}
 				mcdu_scratchpad.scratchpads[me.computer].empty();
 				me.items -= 1;
@@ -336,6 +350,7 @@ var windDESPage = {
 				}
 				fmgc.windController.des_winds[computer_temp].alt1.heading = 0;
 				fmgc.windController.des_winds[computer_temp].alt1.magnitude = 0;
+				fmgc.windController.des_winds[computer_temp].alt1.set = 0;
 				mcdu_scratchpad.scratchpads[me.computer].empty();
 				me._setupPageWithData();
 				me.updateTmpy();
@@ -351,6 +366,7 @@ var windDESPage = {
 					}
 					fmgc.windController.des_winds[computer_temp].alt1.heading = winds[0];
 					fmgc.windController.des_winds[computer_temp].alt1.magnitude = winds[1];
+					fmgc.windController.des_winds[computer_temp].alt1.set = 1;
 					mcdu_scratchpad.scratchpads[me.computer].empty();
 					me._setupPageWithData();
 					me.updateTmpy();