08-28-2016, 08:22 PM
Done cpp version including the changes of 2.01. Only tested a bit but seems to work well. However, the ping command does not work well in both versions as it gives a much lower value than the OS ping command. The following piece of code can't be right:
So, zort just gave a great idea. How about using the system ping command instead of using LF2 to check it? In c++ I'd do it like:
Code:
//LF2 has a inner clock, and it delays its respond if the request was sent quicker that its FPS ratio.
//So I subtract this ratio from the total ping result.
//Apparently LF2 waits 2 frames before it responds.
//I don't sure why. I will check it again when I have some time.
players[i].TotalWaitAmount -= PING_LF2_WAIT_BETWEEN_FRAMES * 2;
if (players[i].TotalWaitAmount < 0) players[i].TotalWaitAmount = 0;
So, zort just gave a great idea. How about using the system ping command instead of using LF2 to check it? In c++ I'd do it like:
Code:
system("ping some_ip");