Trees drop packets very fast
This commit is contained in:
parent
529c967876
commit
1453aa27be
@ -1659,6 +1659,26 @@ namespace EduNetworkBuilder
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeviceInTree(LinkType myLink, Point location)
|
||||||
|
{
|
||||||
|
NetworkDevice ND = null;
|
||||||
|
if (myLink != LinkType.wireless) return false; //we do not care
|
||||||
|
foreach (NetworkComponent NC in NetComponents)
|
||||||
|
{
|
||||||
|
if (NB.GetComponentType(NC) == GeneralComponentType.device)
|
||||||
|
{
|
||||||
|
ND = (NetworkDevice)NC;
|
||||||
|
if (ND.GetNetType() == NetworkComponentType.tree)
|
||||||
|
{
|
||||||
|
if (ND.GetMyRectangle().Contains(location))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeviceIsOverDamaging(LinkType myLink, Point location)
|
public bool DeviceIsOverDamaging(LinkType myLink, Point location)
|
||||||
{
|
{
|
||||||
NetworkDevice ND;
|
NetworkDevice ND;
|
||||||
|
@ -384,6 +384,10 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
if(theLinkType == LinkType.wireless)
|
if(theLinkType == LinkType.wireless)
|
||||||
{
|
{
|
||||||
|
if(myNet.DeviceInTree(theLinkType, newLocation))
|
||||||
|
{
|
||||||
|
tPacket.health -= 60;
|
||||||
|
}
|
||||||
NetworkDevice sDev = myNet.GetDeviceFromID(SrcNic);
|
NetworkDevice sDev = myNet.GetDeviceFromID(SrcNic);
|
||||||
NetworkDevice dDev = myNet.GetDeviceFromID(DstNic);
|
NetworkDevice dDev = myNet.GetDeviceFromID(DstNic);
|
||||||
double distance = myNet.distance(sDev, dDev) * (tPacket.myLinkPercent * 0.01);
|
double distance = myNet.distance(sDev, dDev) * (tPacket.myLinkPercent * 0.01);
|
||||||
|
Loading…
Reference in New Issue
Block a user