-
Notifications
You must be signed in to change notification settings - Fork 42
View Restriction - Add setting to preserve view for vehicle types #107
Conversation
QGVAR(preserveView), | ||
"CHECKBOX", | ||
[LSTRING(SettingPreserveViewName), LSTRING(SettingPreserveViewDesc)], | ||
"ACEX " + localize LSTRING(ModuleDisplayName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use format
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? It's slower and not more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, for 2 strings it's slower. But such a tiny bit that I think just using format is better overall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of changes in the future, it's easier to add another, without risking worse performance loss. But this is so minimal in this case no one cares.
Actually why not just have "ACEX" as part of string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually why not just have "ACEX" as part of string?
It's already used in editor module name.
#include "script_component.hpp" | ||
|
||
params ["_enabled"]; | ||
if (!_enabled || {GVAR(mode) > 0}) exitWith { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline above.
Why exactly is that restriction? Could this not be solved by a simple check of what View Restriction mode is set to and then ignoring the view perservation? |
I just don't need it and don't want to implement those numerous |
Good from my side, can be improved later if someone wants the functionality I mentioned above. Other ACE Settings also need to be moved to CBA Settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two tiny things @Dystopian, small performance gain.
|
||
private _vehicle = vehicle _player; | ||
private _vehicleClass = {if (_vehicle isKindOf _x) exitWith {_x}} forEach ["CAManBase", "LandVehicle", "Air", "Ship", "All"]; | ||
private _varName = QGVAR(preserveView) + _vehicleClass; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use format [QGVAR(preserveView%1), _vehicleClass]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's slower not faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? Last I remember format
was faster. But that could be just on more concatenations or longer strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure. It's faster for more than 2 strings. You said that too above #107 (comment) 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤕
if !([_cameraView, cameraOn] call FUNC(canChangeCamera)) exitWith {}; | ||
|
||
private _vehicleClass = {if (_vehicle isKindOf _x) exitWith {_x}} forEach ["CAManBase", "LandVehicle", "Air", "Ship", "All"]; | ||
private _savedView = profileNamespace getVariable (QGVAR(preserveView) + _vehicleClass); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use format [QGVAR(preserveView%1), _vehicleClass]
.
When merged this pull request will:
This feature switches view on vehicle enter/exit to last used in this vehicle type/on foot. Supported types are the same as for
Selective
mode:LandVehicle
,Air
,Ship
.This setting will work only if View Restriction mode is
Disabled
.Please higher attention to english strings.
To discuss: