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

Medical - Deserialisation of wound hashmaps wrong type #9244

Closed
tbeswick96 opened this issue Jul 8, 2023 · 1 comment · Fixed by #9245
Closed

Medical - Deserialisation of wound hashmaps wrong type #9244

tbeswick96 opened this issue Jul 8, 2023 · 1 comment · Fixed by #9245
Assignees
Labels

Comments

@tbeswick96
Copy link
Contributor

Mods (complete and add to the following information):

Description:
The serialize and deserialize functions don't work with this PR

Steps to reproduce:

private _medical = [player]  call ace_medical_fnc_serializeState;
[player, _medical] call ace_medical_fnc_deserializeState;

Which results in the wound hashmaps being the wrong type
e.g

22:45:11 Error in expression <]);
private _legWounds = (_openWounds getOrDefault ["leftleg", []])
+ (_openWo>
22:45:11   Error position: <getOrDefault ["leftleg", []])
+ (_openWo>
22:45:11   Error getordefault: Type Location, expected HashMap
22:45:11 File z\ace\addons\medical_engine\functions\fnc_updateDamageEffects.sqf..., line 54

Expected behavior:
Deserialisation does not populate wound variables with the wrong type

Where did the issue occur?

  • Anywhere

Additional context:
Sugged by @BaerMitUmlaut that the issue may be this line:

private _state = [_json] call CBA_fnc_parseJSON;

needing to be:

private _state = [_json, 2] call CBA_fnc_parseJSON;

If this is not the cause, then this may be a CBA bug as per this minimal repro:

private _inputData = call CBA_fnc_createNamespace; 
_inputData setVariable ["hashmap", createHashmap]; 

private _json = [_inputData] call CBA_fnc_encodeJSON;

private _outputData = [_json] call CBA_fnc_parseJSON; 
private _hashmap = _outputData getVariable "hashmap";
_hashmap

outputs
Location CBA_NamespaceDummy at -1000, -1000

@tbeswick96
Copy link
Contributor Author

tbeswick96 commented Jul 8, 2023

Changing private _state = [_json] call CBA_fnc_parseJSON; to private _state = [_json, 2] call CBA_fnc_parseJSON; didn't do the trick as is

23:31:21 Error in expression <call CBA_fnc_parseJSON;
{
if ((_state getVariable [_x, createHashMap]) isEqual>
23:31:21   Error position: <getVariable [_x, createHashMap]) isEqual>
23:31:21   Error getvariable: Type HashMap, expected Namespace,Object,Group,Display (dialog),Control,Team member,Task,Location
23:31:21 File z\ace\addons\medical\functions\fnc_deserializeState.sqf..., line 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants