Skip to content

Commit

Permalink
Move garage GETDLC macro to common function (#183)
Browse files Browse the repository at this point in the history
* Move garage GETDLC macro to common function

* Update return value description
  • Loading branch information
mharis001 authored and CreepPork committed Oct 5, 2019
1 parent 0a4942d commit acc11cf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ PREP(earthquake);
PREP(ejectPassengers);
PREP(getActiveTree);
PREP(getAllTurrets);
PREP(getDLC);
PREP(getInventory);
PREP(getPhoneticName);
PREP(getPlayers);
Expand Down
31 changes: 31 additions & 0 deletions addons/common/functions/fnc_getDLC.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Returns the DLC that the given config belongs to.
*
* Arguments:
* 0: Config <CONFIG>
*
* Return Value:
* DLC Classname <STRING>
*
* Example:
* [configFile >> "CfgVehicles" >> "CAManBase"] call zen_common_fnc_getDLC
*
* Public: No
*/

params [["_config", configNull, [configNull]]];

private _dlc = "";
private _addons = configSourceAddonList _config;

if !(_addons isEqualTo []) then {
private _mods = configSourceModList (configFile >> "CfgPatches" >> _addons select 0);

if !(_mods isEqualTo []) then {
_dlc = _mods select 0;
};
};

_dlc
4 changes: 2 additions & 2 deletions addons/common/functions/fnc_getSideIcon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Returns the side icon for given group or unit.
*
* Arguments:
* 0: Unit <OBJECT|GROUP>
* 0: Unit or Group <OBJECT|GROUP>
*
* Return Value:
* Icon file path <STRING>
* Icon File Path <STRING>
*
* Example:
* [player] call zen_common_fnc_getSideIcon
Expand Down
2 changes: 1 addition & 1 deletion addons/garage/functions/fnc_showVehicleInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ _ctrlInfoAuthor ctrlSetText _authorName;

private _ctrlDLC = _display displayCtrl IDC_DLC_ICON;
private _ctrlDLCBackground = _display displayCtrl IDC_DLC_BACKGROUND;
private _vehicleDLC = _vehicleConfig call GETDLC;
private _vehicleDLC = _vehicleConfig call EFUNC(common,getDLC);

if (_vehicleDLC != "") then {
private _dlcParams = modParams [_vehicleDLC, ["name", "logo", "logoOver"]];
Expand Down
13 changes: 0 additions & 13 deletions addons/garage/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@
#define ICON_UNCHECKED "\a3\ui_f\data\gui\rsccommon\rsccheckbox\checkbox_unchecked_ca.paa"
#define CHECK_ICONS [ICON_UNCHECKED, ICON_CHECKED]

#define GETDLC \
{ \
private _dlc = ""; \
private _addons = configSourceAddonList _this; \
if !(_addons isEqualTo []) then { \
private _mods = configSourceModList (configFile >> "CfgPatches" >> _addons select 0); \
if !(_mods isEqualTo []) then { \
_dlc = _mods select 0; \
}; \
}; \
_dlc \
}

#define FADE_DELAY 0.15

#define ZEUS_DISPLAY (findDisplay IDD_RSCDISPLAYCURATOR)
Expand Down

0 comments on commit acc11cf

Please sign in to comment.