Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move garage GETDLC macro to common function #183

Merged
merged 2 commits into from
Oct 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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