Fixed a bug in emptying valves initialization on StateMachine startup

This commit is contained in:
Milan Hanajik
2014-09-06 11:35:10 +02:00
parent ef8284586e
commit a6f5b287c9
3 changed files with 8 additions and 11 deletions
@@ -282,20 +282,17 @@ namespace TBF.BenchControl
// Automatic detection of empty tank valves
foreach (var opath in outputPaths)
{
if ((Balance1 != null) && (opath.Balance == Balance1.Cfg.Name))
if ((EmptyTankValve1 == null) && (Balance1 != null) && (opath.Balance == Balance1.Cfg.Name))
{
EmptyTankValve1 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve;
break;
}
if ((Balance2 != null) && (opath.Balance == Balance2.Cfg.Name))
if ((EmptyTankValve2 == null) && (Balance2 != null) && (opath.Balance == Balance2.Cfg.Name))
{
EmptyTankValve2 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve;
break;
}
if ((Balance3 != null) && (opath.Balance == Balance3.Cfg.Name))
if ((EmptyTankValve3 == null) && (Balance3 != null) && (opath.Balance == Balance3.Cfg.Name))
{
EmptyTankValve3 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve;
break;
}
}