View Single Post
  #30  
Old 05-02-2008, 12:35 AM
Doodman's Avatar
Doodman
Developer
 
Join Date: Aug 2003
Posts: 246
Default

Just a couple of comments on the code.

Firstly, excellent work. I love to see fixes for cheats and MQ type hacks.

One thing tho. might not even be yours, but they it was in yours posts:
Quote:
Code:
bool Client::CheckCheat(){
	
		float dx=cheat_x-x_pos;
		float dy=cheat_y-y_pos;
		float result=sqrtf((dx*dx)+(dy*dy));
		return result>(RuleR(Zone, MQWarpDetectorDistance)); //Lieka:  Integrated into Rules System; default value is 30, this allows for beyond GM speed without lag.
Consider pre-squaring "RuleR(Zone, MQWarpDetectorDistance)" and eliminate the sqrtf(). sqrt() is very expensive. Most times you don't need raw distance, you just need to compare the two. i.e.
Expensive: if (sqrtf((dx*dx)+(dy*dy)) > 30)
Cheaper: if (((dx*dx)+(dy*dy)) > 900)

Yet they accomplish the same result.

Just some tips, otherwise looks good.
Reply With Quote