From 886744484a95696488766a8dd4291f5162403c97 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 29 Jun 2024 10:38:09 +0200 Subject: [PATCH] Improve displaying dogtags from bodies with no name --- addons/dogtags/XEH_postInit.sqf | 10 +++++++--- addons/dogtags/functions/fnc_addDogtagItem.sqf | 10 ++++++++-- addons/dogtags/functions/fnc_showDogtag.sqf | 10 ++++++++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/addons/dogtags/XEH_postInit.sqf b/addons/dogtags/XEH_postInit.sqf index dae6b62247a..1633aace3cd 100644 --- a/addons/dogtags/XEH_postInit.sqf +++ b/addons/dogtags/XEH_postInit.sqf @@ -66,10 +66,14 @@ if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then { _item = _rightPanel lnbData [_i, 0]; if (_item isKindOf ["ACE_dogtag", _cfgWeapons]) then { - _dogtagData = _allDogtagsData param [_allDogtags find _item, []]; + private _name = (_allDogtagsData param [_allDogtags find _item, []]) param [0, ""]; - // If data doesn't exist, put name as "unknown" - _rightPanel lnbSetText [[_i, 1], [LLSTRING(itemName), ": ", _dogtagData param [0, LELSTRING(common,unknown)]] joinString ""]; + // If data doesn't exist or body has no name, set name as "unknown" + if (_name == "") then { + _name = LELSTRING(common,unknown); + }; + + _rightPanel lnbSetText [[_i, 1], [LLSTRING(itemName), ": ", _name] joinString ""]; }; }; }; diff --git a/addons/dogtags/functions/fnc_addDogtagItem.sqf b/addons/dogtags/functions/fnc_addDogtagItem.sqf index 970bb1926e0..0227cac1bae 100644 --- a/addons/dogtags/functions/fnc_addDogtagItem.sqf +++ b/addons/dogtags/functions/fnc_addDogtagItem.sqf @@ -22,8 +22,14 @@ if (_item == "") exitWith {}; [ace_player, _item] call CBA_fnc_addItem; -_dogtagData params ["_nickName"]; -private _displayText = format [localize LSTRING(takeDogtagSuccess), _nickName]; +_dogtagData params ["_name"]; + +// If data doesn't exist or body has no name, set name as "unknown" +if (_name == "") then { + _name = LELSTRING(common,unknown); +}; + +private _displayText = format [localize LSTRING(takeDogtagSuccess), _name]; // display message [{ diff --git a/addons/dogtags/functions/fnc_showDogtag.sqf b/addons/dogtags/functions/fnc_showDogtag.sqf index 4865ff7de20..9e01bfc3cda 100644 --- a/addons/dogtags/functions/fnc_showDogtag.sqf +++ b/addons/dogtags/functions/fnc_showDogtag.sqf @@ -31,5 +31,11 @@ private _display = uiNamespace getvariable [QGVAR(tag), displayNull]; if(isNull _display) exitWith {}; private _control = _display displayCtrl 1001; -_dogtagData params ["_nickName", "_code", "_bloodType"]; -_control ctrlSetStructuredText parseText format ["%1
%2
%3", toUpper _nickName, _code, _bloodType]; +_dogtagData params ["_name", "_code", "_bloodType"]; + +// If data doesn't exist or body has no name, set name as "unknown" +if (_name == "") then { + _name = LELSTRING(common,unknown); +}; + +_control ctrlSetStructuredText parseText format ["%1
%2
%3", toUpper _name, _code, _bloodType];