Skip to content

Instantly share code, notes, and snippets.

@vnetman
Created March 26, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnetman/ad6609837cb96ded15655521d0416ae8 to your computer and use it in GitHub Desktop.
Save vnetman/ad6609837cb96ded15655521d0416ae8 to your computer and use it in GitHub Desktop.
hosts3d packet counter fix
diff --git a/src/hosts3d.cpp b/src/hosts3d.cpp
index 6ac5886..b8b0bed 100644
--- a/src/hosts3d.cpp
+++ b/src/hosts3d.cpp
@@ -49,6 +49,7 @@ host_type *seltd = 0, *lnkht = 0; //selected host, link line host
MyLL hstsLL, lnksLL, altsLL, pktsLL; //dynamic data struct for hosts, links, alerts, packets
GLuint objsDraw; //GL compiled objects
MyGLWin GLWin; //2D GUI
+unsigned long long pktsSeen = 0ull;
#ifdef __MINGW32__
#define usleep(usec) (Sleep((usec) / 1000))
@@ -199,6 +200,7 @@ void pcktCreate(pkif_type *pkt, host_type *sht, host_type *dht, bool lk)
pktsLL.Prev(2);
}
pktsLL.Write(new pckt_type(pckt));
+ pktsSeen++;
if (lk && (sht->alk || dht->alk)) linkCreDel(sht, dht, 0);
if (setts.sona == hst)
{
@@ -527,7 +529,7 @@ void draw2D()
glRasterPos2i(px, 19);
GLWin.DrawString((const unsigned char *)sbuf);
}
- if (goAnim) sprintf(sbuf, "%u", pktsLL.Num());
+ if (goAnim) sprintf(sbuf, "%llu", pktsSeen);
else strcpy(sbuf, "PAUSED");
glRasterPos2i(px, 6);
GLWin.DrawString((const unsigned char *)sbuf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment