Page MenuHomeFeedback Tracker

HashMaps don't retain reference to groups or objects on loading saves
New, NormalPublic

Description

When HashMaps are serialized in the save/load process references to groups and objects are lost.

This is unlike the behaviour of arrays which will retain object and group references post-load, se steps to reproduce below.

For consistency and usability this should not be the case.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce
  1. Create a test mission with a single player entity on the map with the following code as it's init.sqf:
//init.sqf
TEST_D = [group player];
TEST_E = createHashMapFromArray [["test", TEST_D]];
  1. Export the mission to Singleplayer
  2. Run the mission, save and load
  3. Using the debug console or some other variable viewer to observe that:
str TEST_D ==  "[B Alpha 1-1]"
str TEST_E == "[[""test"",[<NULL-group>]]]"
Additional Information

Observed on version 2.06.148470, earlier unknown.

Workaround would be to store the information in an array and rebuild it using createHashMapFromArray with the "Loaded" mission event handler

Event Timeline

mrCurry created this task.Mon, Jan 10, 8:45 PM
mrCurry edited Steps To Reproduce. (Show Details)Mon, Jan 10, 8:48 PM
mrCurry updated the task description. (Show Details)Mon, Jan 10, 8:51 PM
mrCurry edited Additional Information. (Show Details)