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

Area Markers - Add Editable Markers setting #736

Merged
merged 2 commits into from
May 20, 2023
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
5 changes: 0 additions & 5 deletions addons/area_markers/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,4 @@ if (hasInterface) then {
addMissionEventHandler ["MarkerCreated", {call FUNC(onMarkerCreated)}];
addMissionEventHandler ["MarkerDeleted", {call FUNC(onMarkerDeleted)}];
addMissionEventHandler ["MarkerUpdated", {call FUNC(onMarkerUpdated)}];

// Manually trigger event for 3DEN placed and already existent (JIP) markers
{
_x call FUNC(onMarkerCreated);
} forEach allMapMarkers;
};
2 changes: 2 additions & 0 deletions addons/area_markers/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

if (isServer) then {
// Unique ID for creating markers
GVAR(nextID) = 0;
Expand Down
3 changes: 1 addition & 2 deletions addons/area_markers/functions/fnc_deleteIcon.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
params ["_marker"];

if (_marker in GVAR(icons)) then {
ctrlDelete (GVAR(icons) get _marker);
GVAR(icons) deleteAt _marker;
ctrlDelete (GVAR(icons) deleteAt _marker);
};
4 changes: 3 additions & 1 deletion addons/area_markers/functions/fnc_isEditable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@

params ["_marker"];

markerShape _marker in ["RECTANGLE", "ELLIPSE"] && {GVAR(blacklist) findIf {_x in _marker} == -1}
markerShape _marker in ["RECTANGLE", "ELLIPSE"]
&& {GVAR(blacklist) findIf {_x in _marker} == -1}
&& {GVAR(editableMarkers) == EDITABLE_MARKERS_ALL || {QUOTE(ADDON) in _marker}}
25 changes: 25 additions & 0 deletions addons/area_markers/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
QGVAR(editableMarkers),
"LIST",
[LSTRING(EditableMarkers), LSTRING(EditableMarkers_Description)],
[ELSTRING(main,DisplayName), LSTRING(DisplayName)],
[
[
EDITABLE_MARKERS_ALL,
EDITABLE_MARKERS_ONLY_ZEUS_CREATED
],
[
[LSTRING(AllMarkers), LSTRING(AllMarkers_Description)],
[LSTRING(OnlyZeusCreated), LSTRING(OnlyZeusCreated_Description)]
],
0
],
true,
{
// Manually trigger event to update editability of all markers based on the setting
// Also handles 3DEN placed and already existent (JIP) markers
{
_x call FUNC(onMarkerUpdated);
} forEach allMapMarkers;
}
] call CBA_fnc_addSetting;
6 changes: 4 additions & 2 deletions addons/area_markers/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#define POS_H(N) ((N) * GUI_GRID_H)

#define ICON_SIZE 0.6

#define ICON_WIDTH POS_W(ICON_SIZE)
#define ICON_WIDTH POS_W(ICON_SIZE)
#define ICON_HEIGHT POS_H(ICON_SIZE)

#define OFFSET_X POS_W(ICON_SIZE / 2)
Expand Down Expand Up @@ -55,3 +54,6 @@
#define IDC_CONFIGURE_CANCEL 42881

#define IDCS_CONFIGURE_EDIT_BOXES [IDC_CONFIGURE_SIZE_A, IDC_CONFIGURE_SIZE_B, IDC_CONFIGURE_ROTATION_EDIT, IDC_CONFIGURE_ALPHA_EDIT]

#define EDITABLE_MARKERS_ALL 0
#define EDITABLE_MARKERS_ONLY_ZEUS_CREATED 1
21 changes: 21 additions & 0 deletions addons/area_markers/stringtable.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ZEN">
<Package name="Area_Markers">
<Key ID="STR_ZEN_Area_Markers_DisplayName">
<English>Area Markers</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_EditableMarkers">
<English>Editable Markers</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_EditableMarkers_Description">
<English>Controls which area markers are editable through Zeus.</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_AllMarkers">
<English>All Markers</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_AllMarkers_Description">
<English>All area markers (including those placed in 3DEN or created through script) are editable unless manually blacklisted.</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_OnlyZeusCreated">
<English>Only Zeus Created</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_OnlyZeusCreated_Description">
<English>Only area markers created through Zeus are editable.</English>
</Key>
<Key ID="STR_ZEN_Area_Markers_EditAreaMarker">
<English>EDIT AREA MARKER</English>
<Russian>ИЗМЕНИТЬ МАРКЕР ОБЛАСТИ</Russian>
Expand Down