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

improve some Hash Functions #238

Closed
wants to merge 4 commits into from
Closed

improve some Hash Functions #238

wants to merge 4 commits into from

Conversation

jokoho48
Copy link
Member

improve some hash functions

simplfy and cleanup

WIP

};
_keys set [_forEachIndex, _x select 0];
_values set [_forEachIndex, _x select 1];
} forEach _array;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 1.55dev
L38 to L47 can be replaced with:

private _keys = _array apply {_x select 0};
private _values = _array apply {_x select 1};

@Killswitch00
Copy link
Contributor

The suggested code changes result in an error being displayed even as the game is started.

Fix the errors and run the CBA hash unit tests and make sure it works.


// Work out whether the new value is the default value for this assoc.
_isDefault = [if (isNil "_value") then { nil } else { _value },
_hash select HASH_DEFAULT_VALUE] call (uiNamespace getVariable "BIS_fnc_areEqual");
_isDefault = _value isEqualTo _hash select HASH_DEFAULT_VALUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right.

fix missing brackets
@Killswitch00
Copy link
Contributor

Still fails two unit tests

@commy2
Copy link
Contributor

commy2 commented Feb 13, 2016

0 spawn cba_fnc_testHash

11:31:09   Error Undefined variable in expression: _defaultvalue
11:31:09 File x\cba\addons\hashes\fnc_hashCreate.sqf, line 28

11:31:09   Error Undefined variable in expression: _isdefault
11:31:09 File x\cba\addons\hashes\fnc_hashSet.sqf, line 42

11:31:09   Error Undefined variable in expression: _value
11:31:09 File x\cba\addons\hashes\fnc_hashSet.sqf, line 15

11:31:09   Error Undefined variable in expression: _isdefault
11:31:09 File x\cba\addons\hashes\fnc_hashSet.sqf, line 19

11:31:09   Error Undefined variable in expression: _result
11:31:09 File x\cba\addons\hashes\test_hashes.sqf, line 37

This is what I meant previously. The hash functions are not usable in scheduled environment currently.

@commy2
Copy link
Contributor

commy2 commented Feb 13, 2016

0 call cba_fnc_testHash

11:33:07 0:15:12.196 (80.632) [x\cba\addons\hashes\test_hashes.sqf:40] -ERROR- Test FAIL
11:33:07             (_result) hashHashKey
11:33:07 0:15:12.198 (80.632) [x\cba\addons\hashes\test_hashes.sqf:82] -ERROR- Test FAIL
11:33:07             (isNil "_result") hashSet/Get

@commy2 commy2 added the WIP label Feb 18, 2016
@commy2 commy2 mentioned this pull request Feb 25, 2016
@commy2 commy2 closed this Feb 25, 2016
@commy2 commy2 mentioned this pull request Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants