diff --git a/addons/csw/dev/checkStaticWeapons.sqf b/addons/csw/dev/checkStaticWeapons.sqf index 59e712cb70..137dc95334 100644 --- a/addons/csw/dev/checkStaticWeapons.sqf +++ b/addons/csw/dev/checkStaticWeapons.sqf @@ -7,16 +7,16 @@ INFO("Checking static weapons"); private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true]; private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2}; -INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic, {(getNumber (_x >> "ace_csw" >> "enabled")) == 1} count _staticPublic); +INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> QUOTE(ADDON) >> "enabled")) == 1} count _staticPublic); INFO("------ Checking static weapons inheritance ------"); private _explicitBases = []; private _inherited = []; { private _config = _x; - private _configEnabled = (getNumber (_config >> "ace_csw" >> "enabled")) == 1; + private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1; if (_configEnabled) then { - private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1; + private _configExplicit = (count configProperties [_config, toString {configName _x == QUOTE(ADDON)}, false]) == 1; if (_configExplicit) then { _explicitBases pushBack (configName _config); _inherited pushBack []; @@ -43,8 +43,8 @@ private _inherited = []; INFO("------ Logging static magazines with no carry version -------"); private _hash = createHashMap; -// private _logAll = true; // logs all possible weapon magazines (even if not used in a static weapon) -private _logAll = false; +private _logAll = false; // logs all possible weapon magazines (even if not used in a static weapon) when set to true + { private _vehicleType = configName _x; private _turretConfig = [_vehicleType, [0]] call CBA_fnc_getTurret; @@ -69,7 +69,7 @@ private _logAll = false; { //IGNORE_PRIVATE_WARNING ["_x", "_y"]; - INFO_2("[%1] has no carry varient - Used in %2",_x,_y); + INFO_2("[%1] has no carry variant - Used in %2",_x,_y); } forEach _hash; INFO("------ End -------"); diff --git a/addons/csw/functions/fnc_assemble_deployTripod.sqf b/addons/csw/functions/fnc_assemble_deployTripod.sqf index 823636a7ce..32cc6db38a 100644 --- a/addons/csw/functions/fnc_assemble_deployTripod.sqf +++ b/addons/csw/functions/fnc_assemble_deployTripod.sqf @@ -40,7 +40,7 @@ _cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine]; }; if (!GVAR(defaultAssemblyMode)) then { - [_cswTripod, "disableWeaponAssembly", "ace_csw", true] call EFUNC(common,statusEffect_set); + [_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); }; private _posATL = _player getRelPos [2, 0]; diff --git a/addons/csw/functions/fnc_compatibleMagazines.sqf b/addons/csw/functions/fnc_compatibleMagazines.sqf index 2b3ebb39ae..ce5afe8a51 100644 --- a/addons/csw/functions/fnc_compatibleMagazines.sqf +++ b/addons/csw/functions/fnc_compatibleMagazines.sqf @@ -7,7 +7,7 @@ * 0: CSW * * Return Value: - * Compatible Magazines + * Compatible Magazines * Magazine classname * Nothing * @@ -23,7 +23,7 @@ if !((typeOf _csw) in GVAR(initializedStaticTypes)) exitWith {createHashMap}; // fast exit for csw with single weapon, most common scenario if (count allTurrets _csw isEqualTo 1 && {count weapons _csw isEqualTo 1}) exitWith { - GVAR(compatibleMagsCache) get ((weapons _csw) select 0) // return + +(GVAR(compatibleMagsCache) get ((weapons _csw) select 0)) // return }; private _weapons = []; @@ -44,4 +44,4 @@ private _carryMagazines = createHashMap; // hashmap for constant lookup _carryMagazines merge [GVAR(compatibleMagsCache) get _weapon, true]; } forEach _weapons; -_carryMagazines // return ++_carryMagazines // return diff --git a/addons/csw/functions/fnc_getAvailableAmmo.sqf b/addons/csw/functions/fnc_getAvailableAmmo.sqf index d4a6edbcf3..ebfacbeebb 100644 --- a/addons/csw/functions/fnc_getAvailableAmmo.sqf +++ b/addons/csw/functions/fnc_getAvailableAmmo.sqf @@ -10,7 +10,7 @@ * 3: Include CSW crew (default: true) * * Return Value: - * Available Ammo + * Available Ammo * Magazine classname * Total Ammo * diff --git a/addons/csw/functions/fnc_proxyWeapon.sqf b/addons/csw/functions/fnc_proxyWeapon.sqf index e8d18ce705..ead2576295 100644 --- a/addons/csw/functions/fnc_proxyWeapon.sqf +++ b/addons/csw/functions/fnc_proxyWeapon.sqf @@ -23,7 +23,7 @@ TRACE_4("proxyWeapon",_vehicle,_turret,_needed,_emptyWeapon); if (_vehicle getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _vehicle); }; -private _proxyWeapon = getText (configOf _vehicle >> "ace_csw" >> "proxyWeapon"); +private _proxyWeapon = getText (configOf _vehicle >> QUOTE(ADDON) >> "proxyWeapon"); TRACE_2("",typeOf _vehicle,_proxyWeapon); if (_proxyWeapon isEqualTo "") exitWith {}; diff --git a/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf b/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf index 7ad4d2c4b0..ed2fe3cc10 100644 --- a/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf +++ b/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf @@ -47,12 +47,18 @@ if (_canAdd) then { TRACE_2("Setting mag ammo",_loadedMag,_currentAmmo); // _vehicle setMagazineTurretAmmo [_loadedMag, _currentAmmo, _turret]; - // setMagazineTurretAmmo is broken on split locality, use setAmmo for now (this may not work for multi turret vehicles) + // setMagazineTurretAmmo is broken on split locality and if there are multiple magazines of the same class (valid 20/12/2023, Arma 2.14) + // use setAmmo for now (this may not work for multi turret vehicles) private _weapon = (_vehicle weaponsTurret _turret) param [0, ""]; TRACE_3("setAmmo",_vehicle,_weapon, _currentAmmo); _vehicle setAmmo [_weapon, _currentAmmo]; private _currentAmmo = _vehicle magazineTurretAmmo [_loadedMag, _turret]; - if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { ERROR_1("failed to setAmmo - %1", _this); }; + if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { + // Don't remove ammo if it failed to load + _ammoRemaining = _ammoRemaining + _ammoUsed; + + ERROR_1("failed to setAmmo - %1",_this); + }; } else { if (_loadedMag != "") then { TRACE_1("Removing emtpy mag",_loadedMag);