From: terencehill <piuntn@gmail.com>
Date: Wed, 11 Jan 2017 14:58:31 +0000 (+0100)
Subject: Small cleanup
X-Git-Tag: xonotic-v0.8.2~299
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0fe210b32161f2f48ea10256adda7ee0368dc658;p=xonotic%2Fxonotic-data.pk3dir.git

Small cleanup
---

diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc
index 9321d388c5..bda5d284a6 100644
--- a/qcsrc/server/bot/default/havocbot/havocbot.qc
+++ b/qcsrc/server/bot/default/havocbot/havocbot.qc
@@ -179,7 +179,7 @@ void havocbot_ai(entity this)
 			// we are currently holding a weapon that's not fully loaded, reload it
 			if(skill >= 2) // bots can only reload the held weapon on purpose past this skill
 			if(this.(weaponentity).clip_load < this.(weaponentity).clip_size)
-				this.impulse = 20; // "press" the reload button, not sure if this is done right
+				this.impulse = IMP_weapon_reload.impulse; // not sure if this is done right
 
 			// if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next
 			// the code above executes next frame, starting the reloading then
@@ -188,7 +188,10 @@ void havocbot_ai(entity this)
 			{
 				FOREACH(Weapons, it != WEP_Null, LAMBDA(
 					if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.(weaponentity).weapon_load[it.m_id] < it.reloading_ammo))
+					{
 						this.(weaponentity).m_switchweapon = it;
+						break;
+					}
 				));
 			}
 		}
@@ -1022,13 +1025,10 @@ float havocbot_chooseweapon_checkreload(entity this, .entity weaponentity, int n
 	// if this weapon is scheduled for reloading, don't switch to it during combat
 	if (this.(weaponentity).weapon_load[new_weapon] < 0)
 	{
-		bool other_weapon_available = false;
 		FOREACH(Weapons, it != WEP_Null, LAMBDA(
 			if(it.wr_checkammo1(it, this, weaponentity) + it.wr_checkammo2(it, this, weaponentity))
-				other_weapon_available = true;
+				return true; // other weapon available
 		));
-		if(other_weapon_available)
-			return true;
 	}
 
 	return false;