[nexuiz-commits] r8265 - trunk/data/qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Nov 10 14:48:22 EST 2009


Author: fruitiex
Date: 2009-11-10 14:48:21 -0500 (Tue, 10 Nov 2009)
New Revision: 8265

Modified:
   trunk/data/qcsrc/client/sbar.qc
Log:
fix division by zero


Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-11-10 05:01:40 UTC (rev 8264)
+++ trunk/data/qcsrc/client/sbar.qc	2009-11-10 19:48:21 UTC (rev 8265)
@@ -129,7 +129,8 @@
 	// draw the weapon accuracy on the HUD
 	if(sbar_accuracy_hud)
  	{
- 		weapon_stats = rint(100*weapon_hit/weapon_damage);
+		if(weapon_damage)
+ 			weapon_stats = rint(100*weapon_hit/weapon_damage);
 		fill_colour = Sbar_AccuracyColor(weapon_stats);
 		if(weapon_damage)
 			drawpic(pos - '2 0 0' + '0 1 0' * (w_height - accuracybar_height), "gfx/hud/sb_accuracy_bar.tga", '1 0 0' * w_width + '0 1 0' * accuracybar_height, fill_colour, sbar_alpha_fg, DRAWFLAG_NORMAL);
@@ -1186,7 +1187,8 @@
 			continue;
 		weapon_hit = weapon_hits[i];
 		weapon_damage = weapon_fired[i];
-		weapon_stats = bound(0, rint(100 * weapon_hit / weapon_damage), 100);
+		if(weapon_damage)
+			weapon_stats = bound(0, rint(100 * weapon_hit / weapon_damage), 100);
 		self = get_weaponinfo(i);
 		float weapon_alpha;
 



More information about the nexuiz-commits mailing list