diff --git a/source/src/entity.h b/source/src/entity.h index cf3fb309..96500eb4 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -538,13 +538,14 @@ public: void selectweapon(int w, bool other = false) { + if(!valid_weapon(w)) return; if(weaponsel) prevweaponsel = weaponsel; weaponsel = weapons[(gunselect = w)]; if(!prevweaponsel) prevweaponsel = weaponsel; if(other && (prevweaponsel != weaponsel)) weaponswitch(weaponsel, true); } - void setprimary(int w) { primweap = weapons[(primary = w)]; } + void setprimary(int w) { if(!valid_weapon(w)) return; primweap = weapons[(primary = w)]; } void setnextprimary(int w) { nextprimweap = weapons[(nextprimary = w)]; } bool isspectating() { return state==CS_SPECTATE || (state==CS_DEAD && spectatemode > SM_NONE); } void weaponswitch(weapon *w, bool sound = true)