diff --git a/.vs/Elite Power Management Simulator/v16/.suo b/.vs/Elite Power Management Simulator/v16/.suo index 51825dd..ac43ca3 100644 Binary files a/.vs/Elite Power Management Simulator/v16/.suo and b/.vs/Elite Power Management Simulator/v16/.suo differ diff --git a/Elite Power Management Simulator/Form1.cs b/Elite Power Management Simulator/Form1.cs index 96963e6..0c26682 100644 --- a/Elite Power Management Simulator/Form1.cs +++ b/Elite Power Management Simulator/Form1.cs @@ -31,10 +31,7 @@ namespace Elite_Power_Management_Simulator private void btn_reset_Click(object sender, EventArgs e) { - global.eng = 4; - global.sys = 4; - global.wep = 4; - update(); + pwr_reset(); } public void update() { @@ -43,215 +40,229 @@ namespace Elite_Power_Management_Simulator prog_wep.Value = global.wep; } + //Power Distribution Functions + public void pwr_reset() + { + global.eng = 4; + global.sys = 4; + global.wep = 4; + update(); + } + public void pwr_eng() + { + bool fin = false; + if (global.eng < 8) + { + if (global.eng == 7) + { + calc.e = 1; + } + else + { + calc.e = 2; + } + if (calc.e == 2) + { + if (global.sys >= 1 && global.wep >= 1 && !fin) + { + global.eng += 2; + global.sys -= 1; + global.wep -= 1; + fin = true; + } + if (global.sys < 1 && global.wep > 1 && !fin) + { + global.eng += 2; + global.wep -= 2; + fin = true; + } + if (global.sys > 1 && global.wep < 1 && !fin) + { + global.eng += 2; + global.sys -= 2; + fin = true; + } + } + if (calc.e == 1) + { + if (global.sys % 2 == 0) + { + if (global.wep >= 1 && !fin) + { + global.eng += 1; + global.wep -= 1; + fin = true; + } + /*else + { + if (!fin) + { + MessageBox.Show("Internal math error!"); + } + }*/ + } + else + { + if (global.sys >= 1 && !fin) + { + global.eng += 1; + global.sys -= 1; + fin = true; + } + /*else + { + if (!fin) + { + MessageBox.Show("Internal math error!"); + } + }*/ + } + } + + } + update(); + } + public void pwr_sys() + { + bool fin = false; + if (global.sys < 8) + { + if (global.sys == 7) + { + calc.e = 1; + } + else + { + calc.e = 2; + } + if (calc.e == 2) + { + if (global.eng >= 1 && global.wep >= 1 && !fin) + { + global.sys += 2; + global.eng -= 1; + global.wep -= 1; + fin = true; + } + if (global.eng < 1 && global.wep > 1 && !fin) + { + global.sys += 2; + global.wep -= 2; + fin = true; + } + if (global.eng > 1 && global.wep < 1 && !fin) + { + global.sys += 2; + global.eng -= 2; + fin = true; + } + } + if (calc.e == 1) + { + if (global.eng % 2 == 0) + { + if (global.wep >= 1 && !fin) + { + global.sys += 1; + global.wep -= 1; + fin = true; + } + } + else + { + if (global.eng >= 1 && !fin) + { + global.sys += 1; + global.eng -= 1; + fin = true; + } + } + } + + } + update(); + } + public void pwr_wep() + { + bool fin = false; + if (global.wep < 8) + { + if (global.wep == 7) + { + calc.e = 1; + } + else + { + calc.e = 2; + } + if (calc.e == 2) + { + if (global.sys >= 1 && global.eng >= 1 && !fin) + { + global.wep += 2; + global.sys -= 1; + global.eng -= 1; + fin = true; + } + if (global.sys < 1 && global.eng > 1 && !fin) + { + global.wep += 2; + global.eng -= 2; + fin = true; + } + if (global.sys > 1 && global.eng < 1 && !fin) + { + global.wep += 2; + global.sys -= 2; + fin = true; + } + } + if (calc.e == 1) + { + if (global.sys % 2 == 0) + { + if (global.eng >= 1 && !fin) + { + global.wep += 1; + global.eng -= 1; + fin = true; + } + } + else + { + if (global.sys >= 1 && !fin) + { + global.wep += 1; + global.sys -= 1; + fin = true; + } + } + } + + } + update(); + } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { - //capture up arrow key if (keyData == Keys.Up) { - bool fin = false; - if (global.eng < 8) - { - if (global.eng == 7) - { - calc.e = 1; - } - else - { - calc.e = 2; - } - if (calc.e == 2) - { - if (global.sys >= 1 && global.wep >= 1 && !fin) - { - global.eng += 2; - global.sys -= 1; - global.wep -= 1; - fin = true; - } - if (global.sys < 1 && global.wep > 1 && !fin) - { - global.eng += 2; - global.wep -= 2; - fin = true; - } - if (global.sys > 1 && global.wep < 1 && !fin) - { - global.eng += 2; - global.sys -= 2; - fin = true; - } - } - if (calc.e == 1) - { - if (global.sys % 2 == 0) - { - if (global.wep >= 1 && !fin) - { - global.eng += 1; - global.wep -= 1; - fin = true; - } - /*else - { - if (!fin) - { - MessageBox.Show("Internal math error!"); - } - }*/ - } - else - { - if (global.sys >= 1 && !fin) - { - global.eng += 1; - global.sys -= 1; - fin = true; - } - /*else - { - if (!fin) - { - MessageBox.Show("Internal math error!"); - } - }*/ - } - } - - } - update(); + pwr_eng(); return true; } - //capture down arrow key if (keyData == Keys.Down) { - global.eng = 4; - global.sys = 4; - global.wep = 4; - update(); + pwr_reset(); return true; } - //capture left arrow key if (keyData == Keys.Left) { - bool fin = false; - if (global.sys < 8) - { - if (global.sys == 7) - { - calc.e = 1; - } - else - { - calc.e = 2; - } - if (calc.e == 2) - { - if (global.eng >= 1 && global.wep >= 1 && !fin) - { - global.sys += 2; - global.eng -= 1; - global.wep -= 1; - fin = true; - } - if (global.eng < 1 && global.wep > 1 && !fin) - { - global.sys += 2; - global.wep -= 2; - fin = true; - } - if (global.eng > 1 && global.wep < 1 && !fin) - { - global.sys += 2; - global.eng -= 2; - fin = true; - } - } - if (calc.e == 1) - { - if (global.eng % 2 == 0) - { - if (global.wep >= 1 && !fin) - { - global.sys += 1; - global.wep -= 1; - fin = true; - } - } - else - { - if (global.eng >= 1 && !fin) - { - global.sys += 1; - global.eng -= 1; - fin = true; - } - } - } - - } - update(); + pwr_sys(); return true; } - //capture right arrow key if (keyData == Keys.Right) { - bool fin = false; - if (global.wep < 8) - { - if (global.wep == 7) - { - calc.e = 1; - } - else - { - calc.e = 2; - } - if (calc.e == 2) - { - if (global.sys >= 1 && global.eng >= 1 && !fin) - { - global.wep += 2; - global.sys -= 1; - global.eng -= 1; - fin = true; - } - if (global.sys < 1 && global.eng > 1 && !fin) - { - global.wep += 2; - global.eng -= 2; - fin = true; - } - if (global.sys > 1 && global.eng < 1 && !fin) - { - global.wep += 2; - global.sys -= 2; - fin = true; - } - } - if (calc.e == 1) - { - if (global.sys % 2 == 0) - { - if (global.eng >= 1 && !fin) - { - global.wep += 1; - global.eng -= 1; - fin = true; - } - } - else - { - if (global.sys >= 1 && !fin) - { - global.wep += 1; - global.sys -= 1; - fin = true; - } - } - } - - } - update(); + pwr_wep(); return true; } return base.ProcessCmdKey(ref msg, keyData); diff --git a/Elite Power Management Simulator/obj/Debug/Elite Power Management Simulator.csprojAssemblyReference.cache b/Elite Power Management Simulator/obj/Debug/Elite Power Management Simulator.csprojAssemblyReference.cache index f2d690f..5b1acad 100644 Binary files a/Elite Power Management Simulator/obj/Debug/Elite Power Management Simulator.csprojAssemblyReference.cache and b/Elite Power Management Simulator/obj/Debug/Elite Power Management Simulator.csprojAssemblyReference.cache differ diff --git a/Elite Power Management Simulator/obj/Debug/elite_power_sim.exe b/Elite Power Management Simulator/obj/Debug/elite_power_sim.exe index 1d176c4..2000738 100644 Binary files a/Elite Power Management Simulator/obj/Debug/elite_power_sim.exe and b/Elite Power Management Simulator/obj/Debug/elite_power_sim.exe differ diff --git a/Elite Power Management Simulator/obj/Debug/elite_power_sim.pdb b/Elite Power Management Simulator/obj/Debug/elite_power_sim.pdb index 513f0d9..8b120af 100644 Binary files a/Elite Power Management Simulator/obj/Debug/elite_power_sim.pdb and b/Elite Power Management Simulator/obj/Debug/elite_power_sim.pdb differ