X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpacket.cpp;h=213f6b2d8d597e6a459fd5bdd0662c61af5555ac;hb=69bcc0683c313b952981a50a6d66a6ee218ba755;hp=512144a9517414bfd18576c0b9a18478392c0db3;hpb=a56b7174bc4d39064e5fb8d22953963f224315db;p=netvis.git diff --git a/source/packet.cpp b/source/packet.cpp index 512144a..213f6b2 100644 --- a/source/packet.cpp +++ b/source/packet.cpp @@ -6,6 +6,7 @@ Distributed unter the GPL */ #include +#include #include #include #include @@ -27,15 +28,15 @@ Packet::Packet(const Host &s, const Host *d, const GL::Color &c, unsigned i): void Packet::tick(const Time::TimeDelta &dt) { - double f=dt/Time::sec; - x+=f; + double f = dt/Time::sec; + x += f; if(x>1) - x=1; - angle+=rspeed*f; + x = 1; + angle += rspeed*f; if(angle<0) - angle+=M_PI*2; + angle += M_PI*2; if(angle>=M_PI*2) - angle-=M_PI; + angle -= M_PI; } void Packet::render(GL::PrimitiveBuilder &bld) const @@ -45,11 +46,11 @@ void Packet::render(GL::PrimitiveBuilder &bld) const if(!src.get_active() || (dest && !dest->get_active())) return; - const Vector2 &spos=src.get_position(); + const Vector2 &spos = src.get_position(); if(dest) { - const Vector2 &dpos=dest->get_position(); + const Vector2 &dpos = dest->get_position(); Vector2 pos(spos.x*(1-x)+dpos.x*x, spos.y*(1-x)+dpos.y*x); Vector2 corner(cos(angle)*size, sin(angle)*size); @@ -72,7 +73,7 @@ void Packet::render(GL::PrimitiveBuilder &bld) const bld.vertex(spos.x, spos.y); for(unsigned i=0; i<=24; ++i) { - float a=i*M_PI/12; + float a = i*M_PI/12; bld.vertex(spos.x+cos(a)*x*200, spos.y+sin(a)*x*200); } }